]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: jwt: Remove the use of a trash buffer in jwt_jwsverify_rsa_ecdsa()
authorTim Duesterhus <tim@bastelstu.be>
Mon, 18 Oct 2021 16:40:29 +0000 (18:40 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 28 Oct 2021 07:45:48 +0000 (09:45 +0200)
`trash` was completely unused within this function.

src/jwt.c

index d075bcfd445ac5ace05267ec811508db42eaa261..94bfa5adb1e8d30009c0f6ac9aac6cbc70df6ad1 100644 (file)
--- a/src/jwt.c
+++ b/src/jwt.c
@@ -214,14 +214,9 @@ jwt_jwsverify_rsa_ecdsa(const struct jwt_ctx *ctx, const struct buffer *decoded_
        const EVP_MD *evp = NULL;
        EVP_MD_CTX *evp_md_ctx;
        enum jwt_vrfy_status retval = JWT_VRFY_KO;
-       struct buffer *trash = NULL;
        struct ebmb_node *eb;
        struct jwt_cert_tree_entry *entry = NULL;
 
-       trash = alloc_trash_chunk();
-       if (!trash)
-               return JWT_VRFY_OUT_OF_MEMORY;
-
        switch(ctx->alg) {
        case JWS_ALG_RS256:
        case JWS_ALG_ES256:
@@ -239,10 +234,8 @@ jwt_jwsverify_rsa_ecdsa(const struct jwt_ctx *ctx, const struct buffer *decoded_
        }
 
        evp_md_ctx = EVP_MD_CTX_new();
-       if (!evp_md_ctx) {
-               free_trash_chunk(trash);
+       if (!evp_md_ctx)
                return JWT_VRFY_OUT_OF_MEMORY;
-       }
 
        eb = ebst_lookup(&jwt_cert_tree, ctx->key);
 
@@ -267,7 +260,6 @@ jwt_jwsverify_rsa_ecdsa(const struct jwt_ctx *ctx, const struct buffer *decoded_
 
 end:
        EVP_MD_CTX_free(evp_md_ctx);
-       free_trash_chunk(trash);
        return retval;
 }