[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 52/220: md4: Move the SecureTransport implementatio
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 52/220: md4: Move the SecureTransport implementation out of the NTLM code |
Date: |
Thu, 12 Sep 2019 17:26:52 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 11c50f76552711f12f304bfb626f4f4ebfe8567a
Author: Steve Holme <address@hidden>
AuthorDate: Sun Apr 14 02:45:02 2019 +0100
md4: Move the SecureTransport implementation out of the NTLM code
---
lib/curl_md4.h | 6 ++++--
lib/curl_ntlm_core.c | 3 ++-
lib/md4.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
3 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/lib/curl_md4.h b/lib/curl_md4.h
index 979a82b62..59935480d 100644
--- a/lib/curl_md4.h
+++ b/lib/curl_md4.h
@@ -25,7 +25,8 @@
#include "curl_setup.h"
#if defined(USE_GNUTLS_NETTLE) || defined(USE_GNUTLS) || \
- defined(USE_OPENSSL) || defined(USE_NSS) || defined(USE_OS400CRYPTO) || \
+ defined(USE_OPENSSL) || defined(USE_SECTRANSP) || defined(USE_NSS) || \
+ defined(USE_OS400CRYPTO) || \
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C))
#define MD4_DIGEST_LENGTH 16
@@ -33,7 +34,8 @@
void Curl_md4it(unsigned char *output, const unsigned char *input, size_t len);
#endif /* defined(USE_GNUTLS_NETTLE) || defined(USE_GNUTLS) ||
- defined(USE_OPENSSL) || defined(USE_NSS) || defined(USE_OS400CRYPTO) ||
+ defined(USE_OPENSSL) || defined(USE_SECTRANSP) || 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 9ad0de8f7..332d9409a 100644
--- a/lib/curl_ntlm_core.c
+++ b/lib/curl_ntlm_core.c
@@ -103,6 +103,7 @@
# include <CommonCrypto/CommonCryptor.h>
# include <CommonCrypto/CommonDigest.h>
+# include "curl_md4.h"
#elif defined(USE_OS400CRYPTO)
# include "cipher.mih" /* mih/cipher */
@@ -579,7 +580,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struct Curl_easy *data,
Curl_md4it(ntbuffer, pw, 2 * len);
#endif
#elif defined(USE_SECTRANSP)
- (void)CC_MD4(pw, (CC_LONG)(2 * len), ntbuffer);
+ Curl_md4it(ntbuffer, pw, 2 * len);
#elif defined(USE_OS400CRYPTO)
Curl_md4it(ntbuffer, pw, 2 * len);
#elif defined(USE_WIN32_CRYPTO)
diff --git a/lib/md4.c b/lib/md4.c
index 1b1e31540..eaf513774 100644
--- a/lib/md4.c
+++ b/lib/md4.c
@@ -92,6 +92,48 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
#include "curl_md4.h"
#include "warnless.h"
+#elif defined(USE_SECTRANSP)
+
+#include <CommonCrypto/CommonDigest.h>
+
+#include "curl_md4.h"
+#include "warnless.h"
+#include "curl_memory.h"
+/* The last #include file should be: */
+#include "memdebug.h"
+
+typedef struct {
+ void *data;
+ unsigned long size;
+} MD4_CTX;
+
+static void MD4_Init(MD4_CTX *ctx)
+{
+ ctx->data = NULL;
+ ctx->size = 0;
+}
+
+static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
+{
+ if(ctx->data == NULL) {
+ ctx->data = malloc(size);
+ if(ctx->data != NULL) {
+ memcpy(ctx->data, data, size);
+ ctx->size = size;
+ }
+ }
+}
+
+static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
+{
+ if(ctx->data != NULL) {
+ (void)CC_MD4(ctx->data, (CC_LONG) ctx->size, result);
+
+ Curl_safefree(ctx->data);
+ ctx->size = 0;
+ }
+}
+
#elif defined(USE_NSS) || defined(USE_OS400CRYPTO) || \
(defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) || \
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C))
@@ -389,7 +431,8 @@ 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_NSS) || defined(USE_OS400CRYPTO) || \
+ defined(USE_OPENSSL) || defined(USE_SECTRANSP) || defined(USE_NSS) || \
+ defined(USE_OS400CRYPTO) || \
(defined(USE_OPENSSL) && defined(OPENSSL_NO_MD4)) || \
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C))
@@ -402,5 +445,6 @@ void Curl_md4it(unsigned char *output, const unsigned char
*input, size_t len)
}
#endif /* defined(USE_GNUTLS_NETTLE) || defined(USE_GNUTLS) ||
- defined(USE_OPENSSL) || defined(USE_NSS) || defined(USE_OS400CRYPTO) || \
+ defined(USE_OPENSSL) || defined(USE_SECTRANSP) || defined(USE_NSS) ||
+ defined(USE_OS400CRYPTO) ||
(defined(USE_MBEDTLS) && !defined(MBEDTLS_MD4_C)) */
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [gnurl] 48/220: OS400: Add CURLOPT_H3 symbols, (continued)
- [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
- [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 <=
- [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
- [GNUnet-SVN] [gnurl] 76/220: quiche: flush egress in h3_stream_recv() too, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 82/220: docs/ALTSVC.md: first basic file format description, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 75/220: RELEASE-NOTES: synced, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 83/220: CURLINFO_RETRY_AFTER: parse the Retry-After header value, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 32/220: plan9: add support for running on Plan 9, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 74/220: os400: take care of CURLOPT_SASL_AUTHZID in curl_easy_setopt_ccsid()., gnunet, 2019/09/12