[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 50/220: md4: Move the GNU TLS gcrypt MD4 implementa
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 50/220: md4: Move the GNU TLS gcrypt MD4 implementation out of the NTLM code |
Date: |
Thu, 12 Sep 2019 17:26:50 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit c89365929bb5d4eda4d234b3d82e89192b74ca47
Author: Steve Holme <address@hidden>
AuthorDate: Sun Apr 14 02:09:52 2019 +0100
md4: Move the GNU TLS gcrypt MD4 implementation out of the NTLM code
---
lib/curl_md4.h | 6 ++++--
lib/curl_ntlm_core.c | 8 ++------
lib/md4.c | 36 +++++++++++++++++++++++++++++++++---
3 files changed, 39 insertions(+), 11 deletions(-)
diff --git a/lib/curl_md4.h b/lib/curl_md4.h
index b70ed0d88..f41e3921d 100644
--- a/lib/curl_md4.h
+++ b/lib/curl_md4.h
@@ -29,10 +29,12 @@
(defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) || \
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C))
+#define MD4_DIGEST_LENGTH 16
+
void Curl_md4it(unsigned char *output, const unsigned char *input, size_t len);
-#endif /* defined(USE_GNUTLS_NETTLE) || defined(USE_NSS) ||
- defined(USE_OS400CRYPTO) ||
+#endif /* defined(USE_GNUTLS_NETTLE) || defined(USE_GNUTLS) ||
+ 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 d840aed47..d1b508cb7 100644
--- a/lib/curl_ntlm_core.c
+++ b/lib/curl_ntlm_core.c
@@ -83,9 +83,9 @@
#elif defined(USE_GNUTLS)
+# include "curl_md4.h"
# include <gcrypt.h>
# define MD5_DIGEST_LENGTH 16
-# define MD4_DIGEST_LENGTH 16
#elif defined(USE_NSS)
@@ -580,11 +580,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struct Curl_easy *data,
#elif defined(USE_GNUTLS_NETTLE)
Curl_md4it(ntbuffer, pw, 2 * len);
#elif defined(USE_GNUTLS)
- gcry_md_hd_t MD4pw;
- gcry_md_open(&MD4pw, GCRY_MD_MD4, 0);
- gcry_md_write(MD4pw, pw, 2 * len);
- memcpy(ntbuffer, gcry_md_read(MD4pw, 0), MD4_DIGEST_LENGTH);
- gcry_md_close(MD4pw);
+ Curl_md4it(ntbuffer, pw, 2 * len);
#elif defined(USE_NSS)
Curl_md4it(ntbuffer, pw, 2 * len);
#elif defined(USE_MBEDTLS)
diff --git a/lib/md4.c b/lib/md4.c
index 6e82990b5..6bc2c6f65 100644
--- a/lib/md4.c
+++ b/lib/md4.c
@@ -57,6 +57,34 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
md4_digest(ctx, MD4_DIGEST_SIZE, result);
}
+#elif defined(USE_GNUTLS)
+
+#include <gcrypt.h>
+
+#include "curl_md4.h"
+#include "warnless.h"
+#include "curl_memory.h"
+/* The last #include file should be: */
+#include "memdebug.h"
+
+typedef struct gcry_md_hd_t MD4_CTX;
+
+static void MD4_Init(MD4_CTX *ctx)
+{
+ gcry_md_open(ctx, GCRY_MD_MD4, 0);
+}
+
+static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
+{
+ gcry_md_write(*ctx, data, size);
+}
+
+static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
+{
+ memcpy(result, gcry_md_read(ctx, 0), MD4_DIGEST_LENGTH);
+ gcry_md_close(ctx);
+}
+
#elif defined(USE_NSS) || defined(USE_OS400CRYPTO) || \
(defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) || \
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C))
@@ -357,8 +385,9 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
#endif /* CRYPTO LIBS */
-#if defined(USE_GNUTLS_NETTLE) || defined(USE_NSS) || \
- defined(USE_OS400CRYPTO) || \
+#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(OPENSSL_NO_MD4)) || \
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C))
@@ -370,7 +399,8 @@ void Curl_md4it(unsigned char *output, const unsigned char
*input, size_t len)
MD4_Final(output, &ctx);
}
-#endif /* defined(USE_NSS) || defined(USE_OS400CRYPTO) ||
+#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_MBEDTLS) && !defined(MBEDTLS_MD4_C)) */
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [gnurl] 28/220: cleanup: remove the 'numsocks' argument used in many places, (continued)
- [GNUnet-SVN] [gnurl] 28/220: cleanup: remove the 'numsocks' argument used in many places, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 29/220: curl: remove outdated comment, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 27/220: readwrite_data: repair setting the TIMER_STARTTRANSFER stamp, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 39/220: mailmap: added 4 more names, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 41/220: mailmap: added Kyohei Kadota, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 36/220: appveyor: pass on -k to make, gnunet, 2019/09/12
- [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 <=
- [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, 2019/09/12
- [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