summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2019-04-14 02:25:50 +0100
committerSteve Holme <steve_holme@hotmail.com>2019-08-04 18:01:26 +0100
commit24c298fb4db4c97d477f806a269f2ee524ceb814 (patch)
treea7cef93e948952e703397b06a0018dbc0e4c4599 /lib
parentc89365929bb5d4eda4d234b3d82e89192b74ca47 (diff)
downloadcurl-24c298fb4db4c97d477f806a269f2ee524ceb814.tar.gz
md4: Use the Curl_md4it() function for OpenSSL based NTLM
Diffstat (limited to 'lib')
-rw-r--r--lib/curl_md4.h8
-rw-r--r--lib/curl_ntlm_core.c13
-rw-r--r--lib/md4.c18
3 files changed, 13 insertions, 26 deletions
diff --git a/lib/curl_md4.h b/lib/curl_md4.h
index f41e3921d..979a82b62 100644
--- a/lib/curl_md4.h
+++ b/lib/curl_md4.h
@@ -24,9 +24,8 @@
#include "curl_setup.h"
-#if defined(USE_GNUTLS_NETTLE) || defined(USE_NSS) || \
- defined(USE_OS400CRYPTO) || \
- (defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) || \
+#if defined(USE_GNUTLS_NETTLE) || defined(USE_GNUTLS) || \
+ defined(USE_OPENSSL) || defined(USE_NSS) || defined(USE_OS400CRYPTO) || \
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C))
#define MD4_DIGEST_LENGTH 16
@@ -34,8 +33,7 @@
void Curl_md4it(unsigned char *output, const unsigned char *input, size_t len);
#endif /* defined(USE_GNUTLS_NETTLE) || defined(USE_GNUTLS) ||
- defined(USE_NSS) || defined(USE_OS400CRYPTO) ||
- (defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) ||
+ defined(USE_OPENSSL) || defined(USE_NSS) || defined(USE_OS400CRYPTO) ||
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C)) */
#endif /* HEADER_CURL_MD4_H */
diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c
index d1b508cb7..9ad0de8f7 100644
--- a/lib/curl_ntlm_core.c
+++ b/lib/curl_ntlm_core.c
@@ -55,11 +55,6 @@
#ifdef USE_OPENSSL
# include <openssl/des.h>
-# ifndef OPENSSL_NO_MD4
-# include <openssl/md4.h>
-# else
-# include "curl_md4.h"
-# endif
# include <openssl/md5.h>
# include <openssl/ssl.h>
# include <openssl/rand.h>
@@ -75,6 +70,7 @@
# define DESKEYARG(x) *x
# define DESKEY(x) &x
# endif
+# include "curl_md4.h"
#elif defined(USE_GNUTLS_NETTLE)
@@ -569,14 +565,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struct Curl_easy *data,
{
/* Create NT hashed password. */
#ifdef USE_OPENSSL
-#if !defined(OPENSSL_NO_MD4)
- MD4_CTX MD4pw;
- MD4_Init(&MD4pw);
- MD4_Update(&MD4pw, pw, 2 * len);
- MD4_Final(ntbuffer, &MD4pw);
-#else
Curl_md4it(ntbuffer, pw, 2 * len);
-#endif
#elif defined(USE_GNUTLS_NETTLE)
Curl_md4it(ntbuffer, pw, 2 * len);
#elif defined(USE_GNUTLS)
diff --git a/lib/md4.c b/lib/md4.c
index 6bc2c6f65..1b1e31540 100644
--- a/lib/md4.c
+++ b/lib/md4.c
@@ -85,6 +85,13 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
gcry_md_close(ctx);
}
+#elif defined(USE_OPENSSL) && !defined(OPENSSL_NO_MD4)
+/* When OpenSSL is available we use the MD4-functions from OpenSSL */
+#include <openssl/md4.h>
+
+#include "curl_md4.h"
+#include "warnless.h"
+
#elif defined(USE_NSS) || defined(USE_OS400CRYPTO) || \
(defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) || \
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C))
@@ -131,8 +138,6 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
#include "curl_md4.h"
#include "warnless.h"
-#ifndef HAVE_OPENSSL
-
#include <string.h>
/* Any 32-bit or wider unsigned integer data type will do */
@@ -381,13 +386,10 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
memset(ctx, 0, sizeof(*ctx));
}
-#endif
-
#endif /* CRYPTO LIBS */
#if defined(USE_GNUTLS_NETTLE) || defined(USE_GNUTLS) || \
- defined(USE_NSS) || defined(USE_OS400CRYPTO) || \
- (defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) || \
+ defined(USE_OPENSSL) || defined(USE_NSS) || defined(USE_OS400CRYPTO) || \
(defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) || \
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C))
@@ -400,7 +402,5 @@ void Curl_md4it(unsigned char *output, const unsigned char *input, size_t len)
}
#endif /* defined(USE_GNUTLS_NETTLE) || defined(USE_GNUTLS) ||
- defined(USE_NSS) || defined(USE_OS400CRYPTO) ||
- defined(USE_OS400CRYPTO) ||
- (defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) ||
+ defined(USE_OPENSSL) || defined(USE_NSS) || defined(USE_OS400CRYPTO) || \
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C)) */