From: Matt Caswell Date: Fri, 10 Dec 2021 16:53:02 +0000 (+0000) Subject: Ensure that MDs created via EVP_MD_meth_new() go down the legacy route X-Git-Tag: openssl-3.2.0-alpha1~3105 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d9ad5b16b32172df6f7d02cfb1c339cc85d0db01;p=thirdparty%2Fopenssl.git 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 (Merged from https://github.com/openssl/openssl/pull/17255) --- diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index 322cfe76461..5fe80a63f49 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);