summaryrefslogtreecommitdiffstats
path: root/crypto/evp/digest.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-08-29 09:46:24 +0200
committerRichard Levitte <levitte@openssl.org>2020-09-13 20:52:48 +0200
commitec0ce188f44b7ab261b1d691e34913b338479b1f (patch)
tree46b93af67b4dc2340b3ebe2a199bcfb8ed8dbfaf /crypto/evp/digest.c
parent225c9660a5a3435d9bcfc9166b9f79f132996249 (diff)
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 <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12857)
Diffstat (limited to 'crypto/evp/digest.c')
-rw-r--r--crypto/evp/digest.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index 07bf12e5ae..a177abdb67 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -213,10 +213,8 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
#else
EVP_MD *provmd = EVP_MD_fetch(NULL, OBJ_nid2sn(type->type), "");
- if (provmd == NULL) {
- EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_INITIALIZATION_ERROR);
+ if (provmd == NULL)
return 0;
- }
type = provmd;
EVP_MD_free(ctx->fetched_digest);
ctx->fetched_digest = provmd;