[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 188/282: md5: Added implementation for mbedTLS
From: |
gnunet |
Subject: |
[gnurl] 188/282: md5: Added implementation for mbedTLS |
Date: |
Wed, 01 Apr 2020 14:30:53 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 1d421de9a113736e8a65777b1524c6c23556e63a
Author: Steve Holme <address@hidden>
AuthorDate: Tue Feb 25 21:21:17 2020 +0000
md5: Added implementation for mbedTLS
Reviewed-by: Jay Satiro
Closes #4980
---
lib/md5.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/lib/md5.c b/lib/md5.c
index a450b8394..3f601b3a4 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -30,6 +30,14 @@
#include "curl_hmac.h"
#include "warnless.h"
+#ifdef USE_MBEDTLS
+#include <mbedtls/version.h>
+
+#if(MBEDTLS_VERSION_NUMBER >= 0x02070000)
+ #define HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS
+#endif
+#endif /* USE_MBEDTLS */
+
#if defined(USE_GNUTLS_NETTLE)
#include <nettle/md5.h>
@@ -90,6 +98,46 @@ static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
/* The last #include file should be: */
#include "memdebug.h"
+#elif defined(USE_MBEDTLS)
+
+#include <mbedtls/md5.h>
+
+#include "curl_memory.h"
+
+/* The last #include file should be: */
+#include "memdebug.h"
+
+typedef mbedtls_md5_context MD5_CTX;
+
+static void MD5_Init(MD5_CTX *ctx)
+{
+#if !defined(HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS)
+ mbedtls_md5_starts(ctx);
+#else
+ (void) mbedtls_md5_starts_ret(ctx);
+#endif
+}
+
+static void MD5_Update(MD5_CTX *ctx,
+ const unsigned char *data,
+ unsigned int length)
+{
+#if !defined(HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS)
+ mbedtls_md5_update(ctx, data, length);
+#else
+ (void) mbedtls_md5_update_ret(ctx, data, length);
+#endif
+}
+
+static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
+{
+#if !defined(HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS)
+ mbedtls_md5_finish(ctx, digest);
+#else
+ (void) mbedtls_md5_finish_ret(ctx, digest);
+#endif
+}
+
#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
(__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)) || \
(defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
@@ -164,7 +212,9 @@ static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
}
#else
+
/* When no other crypto library is available we use this code segment */
+
/*
* This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
* MD5 Message-Digest Algorithm (RFC 1321).
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 170/282: http2: make pausing/unpausing set/clear local stream window, (continued)
- [gnurl] 170/282: http2: make pausing/unpausing set/clear local stream window, gnunet, 2020/04/01
- [gnurl] 168/282: tests: Automatically deduce the tool name from the test case for unit tests, gnunet, 2020/04/01
- [gnurl] 185/282: ci/tests: Send test results to Azure DevOps for reporting, gnunet, 2020/04/01
- [gnurl] 189/282: docs: fix typo on CURLINFO_RETRY_AFTER - alwaus -> always, gnunet, 2020/04/01
- [gnurl] 194/282: ci/tests: Make sure that the AZURE_ACCESS_TOKEN is available, gnunet, 2020/04/01
- [gnurl] 197/282: configure.ac: Disable metalink support if an incompatible SSL/TLS specified, gnunet, 2020/04/01
- [gnurl] 196/282: ci/tests: Update Azure DevOps pipeline job display names, gnunet, 2020/04/01
- [gnurl] 195/282: ci/tests: Fix typo in previous commit 597cf2, gnunet, 2020/04/01
- [gnurl] 202/282: altsvc: both h3 backends now speak h3-27, gnunet, 2020/04/01
- [gnurl] 198/282: unit1651: Fixed conversion compilation warning, gnunet, 2020/04/01
- [gnurl] 188/282: md5: Added implementation for mbedTLS,
gnunet <=
- [gnurl] 193/282: build: remove all HAVE_OPENSSL_ENGINE_H defines, gnunet, 2020/04/01
- [gnurl] 206/282: formdata/mime: copyright year range update, gnunet, 2020/04/01
- [gnurl] 201/282: mime: fix the binary encoder to handle large data properly, gnunet, 2020/04/01
- [gnurl] 205/282: Revert "mime: latch last read callback status.", gnunet, 2020/04/01
- [gnurl] 210/282: tests: disable 962, 963 and 964 on Windows, gnunet, 2020/04/01
- [gnurl] 208/282: configure: bump the AC_COPYRIGHT year range, gnunet, 2020/04/01
- [gnurl] 192/282: CMake: clean up and improve build procedures, gnunet, 2020/04/01
- [gnurl] 207/282: tests: disable SMTP UTF-8 tests on Windows, gnunet, 2020/04/01
- [gnurl] 203/282: Revert "mime: fix the binary encoder to handle large data properly", gnunet, 2020/04/01
- [gnurl] 213/282: ci/tests: some MacOS builds randomly take longer than 20min, gnunet, 2020/04/01