summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Raad <Marcel.Raad@teamviewer.com>2021-09-26 09:19:51 +0200
committerMarcel Raad <Marcel.Raad@teamviewer.com>2021-10-07 18:40:03 +0200
commitb352e03ec815d35630f34b8b140f0cf4c0b07e1a (patch)
tree78300c10c265b42d463698922e8183216a68126f
parent8dd0f1aa46c68c42401f79634a37f4b259e5ae6f (diff)
downloadcurl-b352e03ec815d35630f34b8b140f0cf4c0b07e1a.tar.gz
md5: fix compilation with OpenSSL 3.0 API
Only use OpenSSL's MD5 code if it's available. Also fix wolfSSL build with `NO_MD5`, in which case neither the wolfSSL/OpenSSL implementation nor the fallback implementation was used. Closes https://github.com/curl/curl/pull/7808
-rw-r--r--lib/md5.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/md5.c b/lib/md5.c
index 00b40af4d..810c5fba8 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -39,6 +39,20 @@
#endif
#endif /* USE_MBEDTLS */
+#if defined(USE_OPENSSL) && !defined(USE_AMISSL)
+ #include <openssl/opensslconf.h>
+ #if !defined(OPENSSL_NO_MD5) && !defined(OPENSSL_NO_DEPRECATED_3_0)
+ #define USE_OPENSSL_MD5
+ #endif
+#endif
+
+#ifdef USE_WOLFSSL
+ #include <wolfssl/options.h>
+ #ifndef NO_MD5
+ #define USE_WOLFSSL_MD5
+ #endif
+#endif
+
#if defined(USE_GNUTLS)
#include <nettle/md5.h>
@@ -65,19 +79,13 @@ static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
md5_digest(ctx, 16, digest);
}
-#elif (defined(USE_OPENSSL) && !defined(USE_AMISSL)) || defined(USE_WOLFSSL)
+#elif defined(USE_OPENSSL_MD5) || defined(USE_WOLFSSL_MD5)
-#ifdef USE_WOLFSSL
-#include <wolfssl/options.h>
-#endif
-
-#if defined(USE_OPENSSL) || (defined(USE_WOLFSSL) && !defined(NO_MD5))
/* When OpenSSL or wolfSSL is available, we use their MD5 functions. */
#include <openssl/md5.h>
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
-#endif
#elif defined(USE_MBEDTLS)