From ec0ce188f44b7ab261b1d691e34913b338479b1f Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Sat, 29 Aug 2020 09:46:24 +0200 Subject: EVP: Centralise fetching error reporting Instead of sometimes, and sometimes not reporting an error in the caller of EVP_XXX_fetch(), where the error may or may not be very accurate, it's now centralised to the inner EVP fetch functionality. It's made in such a way that it can determine if an error occured because the algorithm in question is not there, or if something else went wrong, and will report EVP_R_UNSUPPORTED_ALGORITHM for the former, and EVP_R_FETCH_FAILED for the latter. This helps our own test/evp_test.c when it tries to figure out why an EVP_PKEY it tried to load failed to do so. Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/12857) --- crypto/evp/evp_enc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'crypto/evp/evp_enc.c') diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index 71b5386232..62c0966409 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -174,10 +174,8 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, : OBJ_nid2sn(cipher->nid), ""); - if (provciph == NULL) { - EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); + if (provciph == NULL) return 0; - } cipher = provciph; EVP_CIPHER_free(ctx->fetched_cipher); ctx->fetched_cipher = provciph; -- cgit v1.2.3