From fe37bc80d40b5f2b3ba77f6c6f7a66c904396128 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Tue, 13 Feb 2024 16:01:43 +0100 Subject: [PATCH] [winpr,crypto] fix WITH_INTERNAL_MD5 handling If WITH_INTERNAL_MD5=ON also use it with winpr_Digest_Init_Allow_FIPS --- winpr/libwinpr/crypto/hash.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/winpr/libwinpr/crypto/hash.c b/winpr/libwinpr/crypto/hash.c index f98968e36..3760e31cb 100644 --- a/winpr/libwinpr/crypto/hash.c +++ b/winpr/libwinpr/crypto/hash.c @@ -531,6 +531,18 @@ BOOL winpr_Digest_Init_Allow_FIPS(WINPR_DIGEST_CTX* ctx, WINPR_MD_TYPE md) { WINPR_ASSERT(ctx); + switch (md) + { +#if defined(WITH_INTERNAL_MD5) + case WINPR_MD_MD5: + ctx->md = md; + winpr_MD5_Init(&ctx->md5); + return TRUE; +#endif + default: + break; + } + #if defined(WITH_OPENSSL) const EVP_MD* evp = winpr_openssl_get_evp_md(md); @@ -663,11 +675,8 @@ BOOL winpr_DigestSign_Init(WINPR_DIGEST_CTX* ctx, WINPR_MD_TYPE digest, void* ke { WINPR_ASSERT(ctx); - const char* hash = winpr_md_type_to_string(digest); - WINPR_ASSERT(hash); - #if defined(WITH_OPENSSL) - const EVP_MD* evp = EVP_get_digestbyname(hash); + const EVP_MD* evp = winpr_openssl_get_evp_md(digest); if (!evp) return FALSE;