From: Richard Levitte Date: Sat, 29 Aug 2020 18:48:51 +0000 (+0200) Subject: EVP: Don't report malloc failure in new_raw_key_int() X-Git-Tag: openssl-3.0.0-alpha7~395 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4feda976de1291d9e0d2bbb4d87b39b89dfe6dcd;p=thirdparty%2Fopenssl.git EVP: Don't report malloc failure in new_raw_key_int() On failure by EVP_PKEY_CTX_new_from_name(), this function reported ERR_R_MALLOC_FAILURE. However, that's not necessarily true, as it can fail because the algorithm isn't present. Either way, EVP_PKEY_CTX_new_from_name() records more accurate errors on its own, and one of them - EVP_R_FETCH_FAILED - is significant for test/evp_test.c. Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/12587) --- diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index 16c674d920c..fd2a6c5abc1 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -381,10 +381,8 @@ static EVP_PKEY *new_raw_key_int(OPENSSL_CTX *libctx, strtype != NULL ? strtype : OBJ_nid2sn(nidtype), propq); - if (ctx == NULL) { - EVPerr(0, ERR_R_MALLOC_FAILURE); + if (ctx == NULL) goto err; - } /* May fail if no provider available */ ERR_set_mark(); if (EVP_PKEY_key_fromdata_init(ctx) == 1) {