mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 10:55:38 +01:00
Remove references to malloc in strings/names
This commit is contained in:
parent
5b9e5b19a1
commit
b2a18a2a98
@ -1154,7 +1154,7 @@ static int ssl_parse_hello_verify_request( mbedtls_ssl_context *ssl )
|
||||
ssl->handshake->verify_cookie = mbedtls_calloc( 1, cookie_len );
|
||||
if( ssl->handshake->verify_cookie == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "malloc failed (%d bytes)", cookie_len ) );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc failed (%d bytes)", cookie_len ) );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
}
|
||||
|
||||
@ -2913,7 +2913,7 @@ static int ssl_parse_new_session_ticket( mbedtls_ssl_context *ssl )
|
||||
|
||||
if( ( ticket = mbedtls_calloc( 1, ticket_len ) ) == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "ticket malloc failed" ) );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "ticket alloc failed" ) );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
}
|
||||
|
||||
|
@ -932,7 +932,7 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
|
||||
ssl->compress_buf = mbedtls_calloc( 1, MBEDTLS_SSL_BUFFER_LEN );
|
||||
if( ssl->compress_buf == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "malloc(%d bytes) failed",
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc(%d bytes) failed",
|
||||
MBEDTLS_SSL_BUFFER_LEN ) );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
}
|
||||
@ -2456,14 +2456,14 @@ static int ssl_flight_append( mbedtls_ssl_context *ssl )
|
||||
/* Allocate space for current message */
|
||||
if( ( msg = mbedtls_calloc( 1, sizeof( mbedtls_ssl_flight_item ) ) ) == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "malloc %d bytes failed",
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc %d bytes failed",
|
||||
sizeof( mbedtls_ssl_flight_item ) ) );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
}
|
||||
|
||||
if( ( msg->p = mbedtls_calloc( 1, ssl->out_msglen ) ) == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "malloc %d bytes failed", ssl->out_msglen ) );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc %d bytes failed", ssl->out_msglen ) );
|
||||
mbedtls_free( msg );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
}
|
||||
@ -2927,7 +2927,7 @@ static int ssl_reassemble_dtls_handshake( mbedtls_ssl_context *ssl )
|
||||
ssl->handshake->hs_msg = mbedtls_calloc( 1, alloc_len );
|
||||
if( ssl->handshake->hs_msg == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "malloc failed (%d bytes)", alloc_len ) );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc failed (%d bytes)", alloc_len ) );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
}
|
||||
|
||||
@ -3978,7 +3978,7 @@ int mbedtls_ssl_parse_certificate( mbedtls_ssl_context *ssl )
|
||||
if( ( ssl->session_negotiate->peer_cert = mbedtls_calloc( 1,
|
||||
sizeof( mbedtls_x509_crt ) ) ) == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "malloc(%d bytes) failed",
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc(%d bytes) failed",
|
||||
sizeof( mbedtls_x509_crt ) ) );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
}
|
||||
@ -4916,7 +4916,7 @@ static int ssl_handshake_init( mbedtls_ssl_context *ssl )
|
||||
ssl->transform_negotiate == NULL ||
|
||||
ssl->session_negotiate == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "malloc() of ssl sub-contexts failed" ) );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc() of ssl sub-contexts failed" ) );
|
||||
|
||||
mbedtls_free( ssl->handshake );
|
||||
mbedtls_free( ssl->transform_negotiate );
|
||||
@ -5005,7 +5005,7 @@ int mbedtls_ssl_setup( mbedtls_ssl_context *ssl,
|
||||
if( ( ssl-> in_buf = mbedtls_calloc( 1, len ) ) == NULL ||
|
||||
( ssl->out_buf = mbedtls_calloc( 1, len ) ) == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "malloc(%d bytes) failed", len ) );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc(%d bytes) failed", len ) );
|
||||
mbedtls_free( ssl->in_buf );
|
||||
ssl->in_buf = NULL;
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
|
@ -87,7 +87,7 @@ int main( void )
|
||||
#define MEM_BLOCK_OVERHEAD ( 2 * sizeof( size_t ) )
|
||||
|
||||
/*
|
||||
* Size to use for the malloc buffer if MEMORY_BUFFER_ALLOC_C is defined.
|
||||
* Size to use for the alloc buffer if MEMORY_BUFFER_ALLOC_C is defined.
|
||||
*/
|
||||
#define HEAP_SIZE (1u << 16) // 64k
|
||||
|
||||
@ -253,7 +253,7 @@ int main( int argc, char *argv[] )
|
||||
char title[TITLE_LEN];
|
||||
todo_list todo;
|
||||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
|
||||
unsigned char malloc_buf[HEAP_SIZE] = { 0 };
|
||||
unsigned char alloc_buf[HEAP_SIZE] = { 0 };
|
||||
#endif
|
||||
|
||||
if( argc <= 1 )
|
||||
@ -319,7 +319,7 @@ int main( int argc, char *argv[] )
|
||||
mbedtls_printf( "\n" );
|
||||
|
||||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
|
||||
mbedtls_memory_buffer_alloc_init( malloc_buf, sizeof( malloc_buf ) );
|
||||
mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof( alloc_buf ) );
|
||||
#endif
|
||||
memset( buf, 0xAA, sizeof( buf ) );
|
||||
memset( tmp, 0xBB, sizeof( tmp ) );
|
||||
|
Loading…
Reference in New Issue
Block a user