md4, md5: switch to wolfCrypt API in wolfSSL builds

Replacing the OpenSSL-like compatibility interface, and syncing with other
hashes, when building with wolfSSL.

Also: stop stomping on OpenSSL public MD4 symbols. This makes the wolfSSL
coexist workaround unnecessary, while also syncing up with MD5 sources.

After this patch the only remaining reference to wolfSSL's OpenSSL
compatibility layer is in `lib/curl_ntlm_core.c`.

Closes #21093
This commit is contained in:
Viktor Szakats 2026-03-25 00:49:38 +01:00
parent 486334509f
commit bf6a34d8eb
No known key found for this signature in database
2 changed files with 64 additions and 50 deletions

View file

@ -67,14 +67,9 @@ static void my_md5_final(unsigned char *digest, void *ctx)
md5_digest(ctx, 16, digest);
}
#elif (defined(USE_OPENSSL) && \
!defined(OPENSSL_NO_MD5) && !defined(OPENSSL_NO_DEPRECATED_3_0)) || \
(defined(USE_WOLFSSL) && !defined(NO_MD5) && !defined(OPENSSL_COEXIST))
#ifdef USE_OPENSSL
#elif defined(USE_OPENSSL) && \
!defined(OPENSSL_NO_MD5) && !defined(OPENSSL_NO_DEPRECATED_3_0)
#include <openssl/md5.h>
#else
#include <wolfssl/openssl/md5.h>
#endif
typedef MD5_CTX my_md5_ctx;
@ -98,27 +93,26 @@ static void my_md5_final(unsigned char *digest, void *ctx)
}
#elif defined(USE_WOLFSSL) && !defined(NO_MD5)
#include <wolfssl/openssl/md5.h>
#include <wolfssl/wolfcrypt/md5.h>
typedef WOLFSSL_MD5_CTX my_md5_ctx;
typedef wc_Md5 my_md5_ctx;
static CURLcode my_md5_init(void *ctx)
{
if(!wolfSSL_MD5_Init(ctx))
if(wc_InitMd5(ctx))
return CURLE_OUT_OF_MEMORY;
return CURLE_OK;
}
static void my_md5_update(void *ctx,
const unsigned char *input, unsigned int len)
{
(void)wolfSSL_MD5_Update(ctx, input, len);
(void)wc_Md5Update(ctx, input, (word32)len);
}
static void my_md5_final(unsigned char *digest, void *ctx)
{
(void)wolfSSL_MD5_Final(digest, ctx);
(void)wc_Md5Final(ctx, digest);
}
#elif defined(USE_MBEDTLS) && \