Add mbedtls_printf alias for !PLATFORM_C

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu 2022-01-25 10:39:33 +08:00
parent 370e146acb
commit 6ade743a43

View file

@ -31,9 +31,11 @@
#include "mbedtls/platform.h"
#else
#include <stdlib.h>
#include <stdio.h>
#define mbedtls_calloc calloc
#define mbedtls_free free
#endif
#define mbedtls_printf printf
#endif /* !MBEDTLS_PLATFORM_C */
#include "mbedtls/ssl.h"
#include "ssl_misc.h"
@ -6622,11 +6624,9 @@ static int ssl_array_has_duplicated_entries( uint16_t * array )
{
if( array[i] == array[j] )
{
#if defined(MBEDTLS_PLATFORM_C)
mbedtls_printf( " entry(%04x,%" MBEDTLS_PRINTF_SIZET
") is duplicated at %" MBEDTLS_PRINTF_SIZET "\n",
array[i], j, i );
#endif
ret = -1;
}
}
@ -6649,34 +6649,26 @@ int mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf,
#if defined(MBEDTLS_DEBUG_C) && defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
if( ssl_array_has_duplicated_entries( ssl_preset_suiteb_sig_algs ) )
{
#if defined(MBEDTLS_PLATFORM_C)
mbedtls_printf( "ssl_preset_suiteb_sig_algs has duplicated entries\n" );
#endif
return( MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED );
}
if( ssl_array_has_duplicated_entries( ssl_preset_default_sig_algs ) )
{
#if defined(MBEDTLS_PLATFORM_C)
mbedtls_printf( "ssl_preset_default_sig_algs has duplicated entries\n" );
#endif
return( MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED );
}
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
if( ssl_array_has_duplicated_entries( ssl_tls12_preset_suiteb_sig_algs ) )
{
#if defined(MBEDTLS_PLATFORM_C)
mbedtls_printf( "ssl_tls12_preset_suiteb_sig_algs has duplicated entries\n" );
#endif
return( MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED );
}
if( ssl_array_has_duplicated_entries( ssl_tls12_preset_default_sig_algs ) )
{
#if defined(MBEDTLS_PLATFORM_C)
mbedtls_printf( "ssl_tls12_preset_default_sig_algs has duplicated entries\n" );
#endif
return( MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED );
}
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */