[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 49/220: md4: Move the GNU TLS Nettle MD4 implementa
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 49/220: md4: Move the GNU TLS Nettle MD4 implementation out of the NTLM code |
Date: |
Thu, 12 Sep 2019 17:26:49 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 78e263676b6f75fed852db651887a099137e72cb
Author: Steve Holme <address@hidden>
AuthorDate: Sun Apr 14 01:55:18 2019 +0100
md4: Move the GNU TLS Nettle MD4 implementation out of the NTLM code
---
lib/curl_md4.h | 6 ++--
lib/curl_ntlm_core.c | 7 ++--
lib/md4.c | 92 ++++++++++++++++++++++++++++++++++++++++++----------
3 files changed, 80 insertions(+), 25 deletions(-)
diff --git a/lib/curl_md4.h b/lib/curl_md4.h
index 392203f9e..b70ed0d88 100644
--- a/lib/curl_md4.h
+++ b/lib/curl_md4.h
@@ -24,13 +24,15 @@
#include "curl_setup.h"
-#if defined(USE_NSS) || defined(USE_OS400CRYPTO) || \
+#if defined(USE_GNUTLS_NETTLE) || defined(USE_NSS) || \
+ defined(USE_OS400CRYPTO) || \
(defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) || \
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C))
void Curl_md4it(unsigned char *output, const unsigned char *input, size_t len);
-#endif /* defined(USE_NSS) || defined(USE_OS400CRYPTO) ||
+#endif /* defined(USE_GNUTLS_NETTLE) || defined(USE_NSS) ||
+ defined(USE_OS400CRYPTO) ||
(defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) ||
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C)) */
diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c
index ce6f22392..d840aed47 100644
--- a/lib/curl_ntlm_core.c
+++ b/lib/curl_ntlm_core.c
@@ -79,7 +79,7 @@
#elif defined(USE_GNUTLS_NETTLE)
# include <nettle/des.h>
-# include <nettle/md4.h>
+# include "curl_md4.h"
#elif defined(USE_GNUTLS)
@@ -578,10 +578,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struct Curl_easy *data,
Curl_md4it(ntbuffer, pw, 2 * len);
#endif
#elif defined(USE_GNUTLS_NETTLE)
- struct md4_ctx MD4pw;
- md4_init(&MD4pw);
- md4_update(&MD4pw, (unsigned int)(2 * len), pw);
- md4_digest(&MD4pw, MD4_DIGEST_SIZE, ntbuffer);
+ Curl_md4it(ntbuffer, pw, 2 * len);
#elif defined(USE_GNUTLS)
gcry_md_hd_t MD4pw;
gcry_md_open(&MD4pw, GCRY_MD_MD4, 0);
diff --git a/lib/md4.c b/lib/md4.c
index 0b4ea9a3c..6e82990b5 100644
--- a/lib/md4.c
+++ b/lib/md4.c
@@ -1,5 +1,69 @@
-/*
- * !checksrc! disable COPYRIGHT
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2019, Daniel Stenberg, <address@hidden>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+#include "curl_setup.h"
+
+#ifdef USE_OPENSSL
+#include <openssl/opensslconf.h>
+#endif
+#ifdef USE_MBEDTLS
+#include <mbedtls/config.h>
+#endif
+
+#if defined(USE_GNUTLS_NETTLE)
+
+#include <nettle/md4.h>
+
+#include "curl_md4.h"
+#include "warnless.h"
+#include "curl_memory.h"
+
+/* The last #include file should be: */
+#include "memdebug.h"
+
+typedef struct md4_ctx MD4_CTX;
+
+static void MD4_Init(MD4_CTX *ctx)
+{
+ md4_init(ctx);
+}
+
+static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
+{
+ md4_update(ctx, size, data);
+}
+
+static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
+{
+ md4_digest(ctx, MD4_DIGEST_SIZE, result);
+}
+
+#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
+ *
* This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
* MD4 Message-Digest Algorithm (RFC 1320).
*
@@ -36,22 +100,6 @@
* compile-time configuration.
*/
-#include "curl_setup.h"
-
-#ifdef USE_OPENSSL
-#include <openssl/opensslconf.h>
-#endif
-#ifdef USE_MBEDTLS
-#include <mbedtls/config.h>
-#endif
-
-/* 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 */
-#if defined(USE_NSS) || defined(USE_OS400CRYPTO) || \
- (defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) || \
- (defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C))
-
#include "curl_md4.h"
#include "warnless.h"
@@ -307,6 +355,13 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
#endif
+#endif /* CRYPTO LIBS */
+
+#if defined(USE_GNUTLS_NETTLE) || defined(USE_NSS) || \
+ defined(USE_OS400CRYPTO) || \
+ (defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) || \
+ (defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C))
+
void Curl_md4it(unsigned char *output, const unsigned char *input, size_t len)
{
MD4_CTX ctx;
@@ -316,5 +371,6 @@ void Curl_md4it(unsigned char *output, const unsigned char
*input, size_t len)
}
#endif /* defined(USE_NSS) || defined(USE_OS400CRYPTO) ||
+ defined(USE_OS400CRYPTO) ||
(defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) ||
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C)) */
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [gnurl] 30/220: curl.h: fix outdated comment, (continued)
- [GNUnet-SVN] [gnurl] 30/220: curl.h: fix outdated comment, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 42/220: quiche: add failf() calls for two error cases, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 34/220: ROADMAP: parallel transfers are merged now, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 35/220: timediff: make it 64 bit (if possible) even with 32 bit time_t, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 50/220: md4: Move the GNU TLS gcrypt MD4 implementation out of the NTLM code, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 47/220: url: make use of new HTTP version if alt-svc has one, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 48/220: OS400: Add CURLOPT_H3 symbols, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 55/220: md4: No need for the NTLM code to call Curl_md4it() for each TLS library, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 60/220: lib/Makefile.am: make checksrc run in vquic too, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 64/220: quiche: show the actual version number, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 49/220: md4: Move the GNU TLS Nettle MD4 implementation out of the NTLM code,
gnunet <=
- [GNUnet-SVN] [gnurl] 57/220: md4: Use our own MD4 implementation when no crypto libraries are available, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 62/220: http09: disable HTTP/0.9 by default in both tool and library, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 68/220: mesalink: implement client authentication, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 80/220: curl.h: add CURL_HTTP_VERSION_3 to the version enum, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 79/220: quiche: make use of the connection timeout API properly, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 52/220: md4: Move the SecureTransport implementation out of the NTLM code, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 65/220: altsvc: make quiche use h3-22 now, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 66/220: quiche:h3_stream_recv return 0 at end of stream, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 61/220: quiche: initial h3 request send/receive, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 63/220: quiche: first working HTTP/3 request, gnunet, 2019/09/12