mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 12:05:36 +00:00
Omit runtime configuration of calloc/free if macro config enabled
This commit removes the definition of the API function `mbedtls_platform_set_calloc_free()` from `library/platform.c` in case the macros `MBEDTLS_PLATFORM_CALLOC_MACRO` `MBEDTLS_PLATFORM_FREE_MACRO` for compile time configuration of calloc/free are set. This is in line with the corresponding header `mbedtls/platform.h` which declares `mbedtls_platform_set_calloc_free()` only if `MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO` are not defined. Fixes #1642.
This commit is contained in:
parent
72311b468d
commit
643f311921
|
@ -37,7 +37,14 @@ static void mbedtls_zeroize( void *v, size_t n ) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_PLATFORM_MEMORY)
|
||||
/* The compile time configuration of memory allocation via the macros
|
||||
* MBEDTLS_PLATFORM_{FREE/CALLOC}_MACRO takes precedence over the runtime
|
||||
* configuration via mbedtls_platform_set_calloc_free(). So, omit everything
|
||||
* related to the latter if MBEDTLS_PLATFORM_{FREE/CALLOC}_MACRO are defined. */
|
||||
#if defined(MBEDTLS_PLATFORM_MEMORY) && \
|
||||
!( defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && \
|
||||
defined(MBEDTLS_PLATFORM_FREE_MACRO) )
|
||||
|
||||
#if !defined(MBEDTLS_PLATFORM_STD_CALLOC)
|
||||
static void *platform_calloc_uninit( size_t n, size_t size )
|
||||
{
|
||||
|
@ -68,7 +75,9 @@ int mbedtls_platform_set_calloc_free( void * (*calloc_func)( size_t, size_t ),
|
|||
mbedtls_free = free_func;
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* MBEDTLS_PLATFORM_MEMORY */
|
||||
#endif /* MBEDTLS_PLATFORM_MEMORY &&
|
||||
!( defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&
|
||||
defined(MBEDTLS_PLATFORM_FREE_MACRO) ) */
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <stdarg.h>
|
||||
|
|
Loading…
Reference in a new issue