EVP: Centralise fetching error reporting
authorRichard Levitte <levitte@openssl.org>
Sat, 29 Aug 2020 07:46:24 +0000 (09:46 +0200)
committerRichard Levitte <levitte@openssl.org>
Sun, 13 Sep 2020 18:52:48 +0000 (20:52 +0200)
commitec0ce188f44b7ab261b1d691e34913b338479b1f
tree46b93af67b4dc2340b3ebe2a199bcfb8ed8dbfaf
parent225c9660a5a3435d9bcfc9166b9f79f132996249
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)
crypto/evp/digest.c
crypto/evp/evp_enc.c
crypto/evp/evp_fetch.c
test/evp_test.c