aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2020-02-26 18:24:31 +0000
committerSteve Holme <steve_holme@hotmail.com>2020-02-29 20:53:03 +0000
commitf0ec0e902a9579227550f18ebdb5bbee50c3aca8 (patch)
tree9a90f6332b5766038a1bc1c58528940d9aa8e399
parentada581f2cc32f48c1629b729707ac19208435b27 (diff)
md4: Use non-deprecated functions in mbedTLS >= 2.7.0
Closes #4983
-rw-r--r--lib/md4.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/md4.c b/lib/md4.c
index 87418647a..b33ec8415 100644
--- a/lib/md4.c
+++ b/lib/md4.c
@@ -29,10 +29,16 @@
#ifdef USE_OPENSSL
#include <openssl/opensslconf.h>
-#endif
+#endif /* USE_OPENSSL */
+
#ifdef USE_MBEDTLS
#include <mbedtls/config.h>
+#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)
@@ -182,6 +188,7 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
#include <mbedtls/md4.h>
#include "curl_memory.h"
+
/* The last #include file should be: */
#include "memdebug.h"
@@ -210,7 +217,11 @@ static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
{
if(ctx->data != NULL) {
+#if !defined(HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS)
mbedtls_md4(ctx->data, ctx->size, result);
+#else
+ (void) mbedtls_md4_ret(ctx->data, ctx->size, result);
+#endif
Curl_safefree(ctx->data);
ctx->size = 0;