]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
EVP: Don't shadow EVP_PKEY_CTX_new* error records
authorRichard Levitte <levitte@openssl.org>
Thu, 3 Sep 2020 10:42:43 +0000 (12:42 +0200)
committerRichard Levitte <levitte@openssl.org>
Tue, 8 Sep 2020 04:26:19 +0000 (06:26 +0200)
There are places that add an ERR_R_MALLOC_FAILURE record when any of
EVP_PKEY_CTX_new*() return NULL, which is 1) inaccurate, and 2)
shadows the more accurate error record generated when trying to create
the EVP_PKEY_CTX.

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
(Merged from https://github.com/openssl/openssl/pull/12785)

crypto/evp/p_lib.c

index e22e900d9495016d8679abe87f88641338289013..fec4e2d43bbb6013b1278f7f67a446eeb53c67cf 100644 (file)
@@ -606,10 +606,8 @@ static EVP_PKEY *new_cmac_key_int(const unsigned char *priv, size_t len,
     }
 
     ctx = EVP_PKEY_CTX_new_from_name(libctx, "CMAC", propq);
-    if (ctx == NULL) {
-        EVPerr(0, ERR_R_MALLOC_FAILURE);
+    if (ctx == NULL)
         goto err;
-    }
 
     if (!EVP_PKEY_key_fromdata_init(ctx)) {
         EVPerr(0, EVP_R_KEY_SETUP_FAILED);