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:38:35 +0000
commitd9ad5b16b32172df6f7d02cfb1c339cc85d0db01 (patch)
tree8d8ad44d714ad53175fc4e30e04c122a01a364bc /crypto/evp
parent64a8f6008acce93d0bf184559c63e66c0cc0e23d (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)
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 322cfe7646..5fe80a63f4 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -208,7 +208,8 @@ static int evp_md_init_internal(EVP_MD_CTX *ctx, const EVP_MD *type,
|| tmpimpl != NULL
# endif
#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);