From 850a295b41543a11c5a0b5f4943e9b4fbc20da59 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Sun, 14 Apr 2019 19:24:28 +0100 Subject: md4: Use our own MD4 implementation when no crypto libraries are available Closes #3780 --- lib/md4.c | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) (limited to 'lib/md4.c') diff --git a/lib/md4.c b/lib/md4.c index 0729c3954..bbf897508 100644 --- a/lib/md4.c +++ b/lib/md4.c @@ -22,6 +22,11 @@ #include "curl_setup.h" +#if !defined(CURL_DISABLE_CRYPTO_AUTH) + +#include "curl_md4.h" +#include "warnless.h" + #ifdef USE_OPENSSL #include #endif @@ -33,8 +38,6 @@ #include -#include "curl_md4.h" -#include "warnless.h" #include "curl_memory.h" /* The last #include file should be: */ @@ -61,8 +64,6 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx) #include -#include "curl_md4.h" -#include "warnless.h" #include "curl_memory.h" /* The last #include file should be: */ #include "memdebug.h" @@ -89,15 +90,10 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx) /* When OpenSSL is available we use the MD4-functions from OpenSSL */ #include -#include "curl_md4.h" -#include "warnless.h" - #elif defined(USE_SECTRANSP) #include -#include "curl_md4.h" -#include "warnless.h" #include "curl_memory.h" /* The last #include file should be: */ #include "memdebug.h" @@ -138,8 +134,6 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx) #include -#include "curl_md4.h" -#include "warnless.h" #include "curl_memory.h" /* The last #include file should be: */ #include "memdebug.h" @@ -184,8 +178,6 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx) #include -#include "curl_md4.h" -#include "warnless.h" #include "curl_memory.h" /* The last #include file should be: */ #include "memdebug.h" @@ -222,12 +214,9 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx) } } -#elif defined(USE_NSS) || defined(USE_OS400CRYPTO) || \ - (defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) || \ - (defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C)) -/* The NSS, OS/400, and when not included, OpenSSL and mbed TLS crypto - * libraries do not provide the MD4 hash algorithm, so we use this - * implementation of it +#else +/* When no other crypto library is available, or the crypto library doesn't + * support MD4, we use this code segment this implementation of it * * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc. * MD4 Message-Digest Algorithm (RFC 1320). @@ -265,8 +254,6 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx) * compile-time configuration. */ -#include "curl_md4.h" -#include "warnless.h" #include @@ -518,11 +505,6 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx) #endif /* CRYPTO LIBS */ -#if defined(USE_GNUTLS_NETTLE) || defined(USE_GNUTLS) || \ - defined(USE_OPENSSL) || defined(USE_SECTRANSP) || \ - defined(USE_WIN32_CRYPTO) || defined(USE_NSS) || \ - defined(USE_OS400CRYPTO) || defined(USE_MBEDTLS) - void Curl_md4it(unsigned char *output, const unsigned char *input, size_t len) { MD4_CTX ctx; @@ -531,7 +513,4 @@ void Curl_md4it(unsigned char *output, const unsigned char *input, size_t len) MD4_Final(output, &ctx); } -#endif /* defined(USE_GNUTLS_NETTLE) || defined(USE_GNUTLS) || - defined(USE_OPENSSL) || defined(USE_SECTRANSP) || - defined(USE_WIN32_CRYPTO) || defined(USE_NSS) || - defined(USE_OS400CRYPTO) || defined(USE_MBEDTLS) */ +#endif /* CURL_DISABLE_CRYPTO_AUTH */ -- cgit v1.2.3