diff options
Diffstat (limited to 'crypto/evp/evp_enc.c')
-rw-r--r-- | crypto/evp/evp_enc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index 7818ab25ea..c1c8f1cf28 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -1470,6 +1470,12 @@ static void *evp_cipher_from_dispatch(const int name_id, if (prov != NULL) ossl_provider_up_ref(prov); + if (!evp_cipher_cache_constants(cipher)) { + EVP_CIPHER_free(cipher); + ERR_raise(ERR_LIB_EVP, EVP_R_CACHE_CONSTANTS_FAILED); + cipher = NULL; + } + return cipher; } @@ -1491,10 +1497,6 @@ EVP_CIPHER *EVP_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, evp_cipher_from_dispatch, evp_cipher_up_ref, evp_cipher_free); - if (cipher != NULL && !evp_cipher_cache_constants(cipher)) { - EVP_CIPHER_free(cipher); - cipher = NULL; - } return cipher; } |