mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-07 06:42:56 +03:00
Fix size_t and longlong specifiers for MinGW
MinGW and older windows compilers cannot cope with %zu or %lld (there is a workaround for MinGW, but it involves linking more code, there is no workaround for Windows compilers prior to 2013). Attempt to work around this by defining printf specifiers for size_t per platform for the compilers that cannot use the C99 specifiers. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
@@ -2215,7 +2215,8 @@ int mbedtls_ssl_write_certificate( mbedtls_ssl_context *ssl )
|
||||
n = crt->raw.len;
|
||||
if( n > MBEDTLS_SSL_OUT_CONTENT_LEN - 3 - i )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "certificate too large, %zu > %zu",
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "certificate too large, %" MBEDTLS_PRINTF_SIZET
|
||||
" > %" MBEDTLS_PRINTF_SIZET,
|
||||
i + 3 + n, (size_t) MBEDTLS_SSL_OUT_CONTENT_LEN ) );
|
||||
return( MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE );
|
||||
}
|
||||
@@ -2831,7 +2832,7 @@ int mbedtls_ssl_parse_certificate( mbedtls_ssl_context *ssl )
|
||||
chain = mbedtls_calloc( 1, sizeof( mbedtls_x509_crt ) );
|
||||
if( chain == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc(%zu bytes) failed",
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc(%" MBEDTLS_PRINTF_SIZET " bytes) failed",
|
||||
sizeof( mbedtls_x509_crt ) ) );
|
||||
mbedtls_ssl_send_alert_message( ssl,
|
||||
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||
@@ -3858,7 +3859,7 @@ int mbedtls_ssl_setup( mbedtls_ssl_context *ssl,
|
||||
ssl->in_buf = mbedtls_calloc( 1, in_buf_len );
|
||||
if( ssl->in_buf == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc(%zu bytes) failed", in_buf_len ) );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc(%" MBEDTLS_PRINTF_SIZET " bytes) failed", in_buf_len ) );
|
||||
ret = MBEDTLS_ERR_SSL_ALLOC_FAILED;
|
||||
goto error;
|
||||
}
|
||||
@@ -3869,7 +3870,7 @@ int mbedtls_ssl_setup( mbedtls_ssl_context *ssl,
|
||||
ssl->out_buf = mbedtls_calloc( 1, out_buf_len );
|
||||
if( ssl->out_buf == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc(%zu bytes) failed", out_buf_len ) );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc(%" MBEDTLS_PRINTF_SIZET " bytes) failed", out_buf_len ) );
|
||||
ret = MBEDTLS_ERR_SSL_ALLOC_FAILED;
|
||||
goto error;
|
||||
}
|
||||
|
Reference in New Issue
Block a user