mirror of
https://github.com/curl/curl.git
synced 2026-07-28 16:33:07 +03:00
md5
This commit is contained in:
parent
cfeb1bd6e5
commit
80e74bd384
1 changed files with 2 additions and 19 deletions
21
lib/md5.c
21
lib/md5.c
|
|
@ -36,10 +36,8 @@
|
|||
|
||||
#ifdef USE_MBEDTLS
|
||||
#include <mbedtls/version.h>
|
||||
|
||||
#if(MBEDTLS_VERSION_NUMBER >= 0x02070000) && \
|
||||
(MBEDTLS_VERSION_NUMBER < 0x03000000)
|
||||
#define HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS
|
||||
#if MBEDTLS_VERSION_NUMBER < 0x03000000
|
||||
#error "mbedTLS 3.0.0 or later required"
|
||||
#endif
|
||||
#endif /* USE_MBEDTLS */
|
||||
|
||||
|
|
@ -161,15 +159,8 @@ typedef mbedtls_md5_context my_md5_ctx;
|
|||
|
||||
static CURLcode my_md5_init(void *ctx)
|
||||
{
|
||||
#if (MBEDTLS_VERSION_NUMBER >= 0x03000000)
|
||||
if(mbedtls_md5_starts(ctx))
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
#elif defined(HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS)
|
||||
if(mbedtls_md5_starts_ret(ctx))
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
#else
|
||||
(void)mbedtls_md5_starts(ctx);
|
||||
#endif
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
|
|
@ -177,20 +168,12 @@ static void my_md5_update(void *ctx,
|
|||
const unsigned char *data,
|
||||
unsigned int length)
|
||||
{
|
||||
#ifndef HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS
|
||||
(void)mbedtls_md5_update(ctx, data, length);
|
||||
#else
|
||||
(void)mbedtls_md5_update_ret(ctx, data, length);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void my_md5_final(unsigned char *digest, void *ctx)
|
||||
{
|
||||
#ifndef HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS
|
||||
(void)mbedtls_md5_finish(ctx, digest);
|
||||
#else
|
||||
(void)mbedtls_md5_finish_ret(ctx, digest);
|
||||
#endif
|
||||
}
|
||||
|
||||
#elif defined(AN_APPLE_OS)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue