summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2021-12-10 16:53:02 +0000
committerMatt Caswell <matt@openssl.org>2022-01-10 16:47:34 +0000
commit43927f81a5d1ea1d32508430eee2df85736ba105 (patch)
treeaaba40b212c86003319b8ef321d333aa09574778 /crypto/evp
parent617203e64f17371b95fc8d64fc7fde9f8bc6e9db (diff)
Ensure that MDs created via EVP_MD_meth_new() go down the legacy route
MDs created via EVP_MD_meth_new() are inherently legacy and therefore need to go down the legacy route when they are used. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/17255) (cherry picked from commit d9ad5b16b32172df6f7d02cfb1c339cc85d0db01)
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/digest.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index d92059cbcc..161ae7f198 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -207,7 +207,8 @@ static int evp_md_init_internal(EVP_MD_CTX *ctx, const EVP_MD *type,
#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
|| tmpimpl != NULL
#endif
- || (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) != 0) {
+ || (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) != 0
+ || type->origin == EVP_ORIG_METH) {
if (ctx->digest == ctx->fetched_digest)
ctx->digest = NULL;
EVP_MD_free(ctx->fetched_digest);