mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-28 00:21:48 +03:00
Rename ERR_xxx_MALLOC_FAILED to ..._ALLOC_FAILED
This commit is contained in:
@ -273,7 +273,7 @@ int mbedtls_asn1_get_sequence_of( unsigned char **p,
|
||||
cur->next = mbedtls_calloc( 1, sizeof( mbedtls_asn1_sequence ) );
|
||||
|
||||
if( cur->next == NULL )
|
||||
return( MBEDTLS_ERR_ASN1_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_ASN1_ALLOC_FAILED );
|
||||
|
||||
cur = cur->next;
|
||||
}
|
||||
|
@ -105,12 +105,12 @@ int mbedtls_mpi_grow( mbedtls_mpi *X, size_t nblimbs )
|
||||
mbedtls_mpi_uint *p;
|
||||
|
||||
if( nblimbs > MBEDTLS_MPI_MAX_LIMBS )
|
||||
return( MBEDTLS_ERR_MPI_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_MPI_ALLOC_FAILED );
|
||||
|
||||
if( X->n < nblimbs )
|
||||
{
|
||||
if( ( p = mbedtls_calloc( nblimbs, ciL ) ) == NULL )
|
||||
return( MBEDTLS_ERR_MPI_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_MPI_ALLOC_FAILED );
|
||||
|
||||
if( X->p != NULL )
|
||||
{
|
||||
@ -148,7 +148,7 @@ int mbedtls_mpi_shrink( mbedtls_mpi *X, size_t nblimbs )
|
||||
i = nblimbs;
|
||||
|
||||
if( ( p = mbedtls_calloc( i, ciL ) ) == NULL )
|
||||
return( MBEDTLS_ERR_MPI_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_MPI_ALLOC_FAILED );
|
||||
|
||||
if( X->p != NULL )
|
||||
{
|
||||
|
@ -534,7 +534,7 @@ static int load_file( const char *path, unsigned char **buf, size_t *n )
|
||||
( *buf = mbedtls_calloc( 1, *n + 1 ) ) == NULL )
|
||||
{
|
||||
fclose( f );
|
||||
return( MBEDTLS_ERR_DHM_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_DHM_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
if( fread( *buf, 1, *n, f ) != *n )
|
||||
|
@ -791,7 +791,7 @@ static int ecp_normalize_jac_many( const mbedtls_ecp_group *grp,
|
||||
return( ecp_normalize_jac( grp, *T ) );
|
||||
|
||||
if( ( c = mbedtls_calloc( t_len, sizeof( mbedtls_mpi ) ) ) == NULL )
|
||||
return( MBEDTLS_ERR_ECP_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_ECP_ALLOC_FAILED );
|
||||
|
||||
mbedtls_mpi_init( &u ); mbedtls_mpi_init( &Zi ); mbedtls_mpi_init( &ZZi );
|
||||
|
||||
@ -1364,7 +1364,7 @@ static int ecp_mul_comb( mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
|
||||
T = mbedtls_calloc( pre_len, sizeof( mbedtls_ecp_point ) );
|
||||
if( T == NULL )
|
||||
{
|
||||
ret = MBEDTLS_ERR_ECP_MALLOC_FAILED;
|
||||
ret = MBEDTLS_ERR_ECP_ALLOC_FAILED;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "DHM - Calculation of the DHM secret failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_DHM_INVALID_FORMAT) )
|
||||
mbedtls_snprintf( buf, buflen, "DHM - The ASN.1 data is not formatted correctly" );
|
||||
if( use_ret == -(MBEDTLS_ERR_DHM_MALLOC_FAILED) )
|
||||
if( use_ret == -(MBEDTLS_ERR_DHM_ALLOC_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "DHM - Allocation of memory failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_DHM_FILE_IO_ERROR) )
|
||||
mbedtls_snprintf( buf, buflen, "DHM - Read/write of file failed" );
|
||||
@ -249,7 +249,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "ECP - Requested curve not available" );
|
||||
if( use_ret == -(MBEDTLS_ERR_ECP_VERIFY_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "ECP - The signature is not valid" );
|
||||
if( use_ret == -(MBEDTLS_ERR_ECP_MALLOC_FAILED) )
|
||||
if( use_ret == -(MBEDTLS_ERR_ECP_ALLOC_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "ECP - Memory allocation failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_ECP_RANDOM_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "ECP - Generation of random value, such as (ephemeral) key, failed" );
|
||||
@ -275,7 +275,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "PEM - No PEM header or footer found" );
|
||||
if( use_ret == -(MBEDTLS_ERR_PEM_INVALID_DATA) )
|
||||
mbedtls_snprintf( buf, buflen, "PEM - PEM string is not as expected" );
|
||||
if( use_ret == -(MBEDTLS_ERR_PEM_MALLOC_FAILED) )
|
||||
if( use_ret == -(MBEDTLS_ERR_PEM_ALLOC_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "PEM - Failed to allocate memory" );
|
||||
if( use_ret == -(MBEDTLS_ERR_PEM_INVALID_ENC_IV) )
|
||||
mbedtls_snprintf( buf, buflen, "PEM - RSA IV is not in hex-format" );
|
||||
@ -292,7 +292,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
#endif /* MBEDTLS_PEM_PARSE_C || MBEDTLS_PEM_WRITE_C */
|
||||
|
||||
#if defined(MBEDTLS_PK_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_PK_MALLOC_FAILED) )
|
||||
if( use_ret == -(MBEDTLS_ERR_PK_ALLOC_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "PK - Memory alloation failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_PK_TYPE_MISMATCH) )
|
||||
mbedtls_snprintf( buf, buflen, "PK - Type mismatch, eg attempt to encrypt with an ECDSA key" );
|
||||
@ -427,7 +427,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "SSL - Processing of the ChangeCipherSpec handshake message failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_FINISHED) )
|
||||
mbedtls_snprintf( buf, buflen, "SSL - Processing of the Finished handshake message failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_SSL_MALLOC_FAILED) )
|
||||
if( use_ret == -(MBEDTLS_ERR_SSL_ALLOC_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "SSL - Memory allocation failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_SSL_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "SSL - Hardware acceleration function returned with error" );
|
||||
@ -498,7 +498,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "X509 - Format not recognized as DER or PEM" );
|
||||
if( use_ret == -(MBEDTLS_ERR_X509_BAD_INPUT_DATA) )
|
||||
mbedtls_snprintf( buf, buflen, "X509 - Input invalid" );
|
||||
if( use_ret == -(MBEDTLS_ERR_X509_MALLOC_FAILED) )
|
||||
if( use_ret == -(MBEDTLS_ERR_X509_ALLOC_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "X509 - Allocation of memory failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_X509_FILE_IO_ERROR) )
|
||||
mbedtls_snprintf( buf, buflen, "X509 - Read/write of file failed" );
|
||||
@ -551,7 +551,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "ASN1 - Actual length differs from expected length" );
|
||||
if( use_ret == -(MBEDTLS_ERR_ASN1_INVALID_DATA) )
|
||||
mbedtls_snprintf( buf, buflen, "ASN1 - Data is invalid. (not used)" );
|
||||
if( use_ret == -(MBEDTLS_ERR_ASN1_MALLOC_FAILED) )
|
||||
if( use_ret == -(MBEDTLS_ERR_ASN1_ALLOC_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "ASN1 - Memory allocation failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_ASN1_BUF_TOO_SMALL) )
|
||||
mbedtls_snprintf( buf, buflen, "ASN1 - Buffer too small when writing ASN.1 data structure" );
|
||||
@ -579,7 +579,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "BIGNUM - The input argument for division is zero, which is not allowed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_MPI_NOT_ACCEPTABLE) )
|
||||
mbedtls_snprintf( buf, buflen, "BIGNUM - The input arguments are not acceptable" );
|
||||
if( use_ret == -(MBEDTLS_ERR_MPI_MALLOC_FAILED) )
|
||||
if( use_ret == -(MBEDTLS_ERR_MPI_ALLOC_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "BIGNUM - Memory allocation failed" );
|
||||
#endif /* MBEDTLS_BIGNUM_C */
|
||||
|
||||
|
@ -322,7 +322,7 @@ int mbedtls_pem_read_buffer( mbedtls_pem_context *ctx, const char *header, const
|
||||
return( MBEDTLS_ERR_PEM_INVALID_DATA + ret );
|
||||
|
||||
if( ( buf = mbedtls_calloc( 1, len ) ) == NULL )
|
||||
return( MBEDTLS_ERR_PEM_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_PEM_ALLOC_FAILED );
|
||||
|
||||
if( ( ret = mbedtls_base64_decode( buf, &len, s1, s2 - s1 ) ) != 0 )
|
||||
{
|
||||
@ -408,7 +408,7 @@ int mbedtls_pem_write_buffer( const char *header, const char *footer,
|
||||
}
|
||||
|
||||
if( ( encode_buf = mbedtls_calloc( 1, use_len ) ) == NULL )
|
||||
return( MBEDTLS_ERR_PEM_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_PEM_ALLOC_FAILED );
|
||||
|
||||
if( ( ret = mbedtls_base64_encode( encode_buf, &use_len, der_data,
|
||||
der_len ) ) != 0 )
|
||||
|
@ -105,7 +105,7 @@ int mbedtls_pk_setup( mbedtls_pk_context *ctx, const mbedtls_pk_info_t *info )
|
||||
return( MBEDTLS_ERR_PK_BAD_INPUT_DATA );
|
||||
|
||||
if( ( ctx->pk_ctx = info->ctx_alloc_func() ) == NULL )
|
||||
return( MBEDTLS_ERR_PK_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_PK_ALLOC_FAILED );
|
||||
|
||||
ctx->pk_info = info;
|
||||
|
||||
@ -128,7 +128,7 @@ int mbedtls_pk_setup_rsa_alt( mbedtls_pk_context *ctx, void * key,
|
||||
return( MBEDTLS_ERR_PK_BAD_INPUT_DATA );
|
||||
|
||||
if( ( ctx->pk_ctx = info->ctx_alloc_func() ) == NULL )
|
||||
return( MBEDTLS_ERR_PK_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_PK_ALLOC_FAILED );
|
||||
|
||||
ctx->pk_info = info;
|
||||
|
||||
|
@ -96,7 +96,7 @@ int mbedtls_pk_load_file( const char *path, unsigned char **buf, size_t *n )
|
||||
( *buf = mbedtls_calloc( 1, *n + 1 ) ) == NULL )
|
||||
{
|
||||
fclose( f );
|
||||
return( MBEDTLS_ERR_PK_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_PK_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
if( fread( *buf, 1, *n, f ) != *n )
|
||||
|
@ -1155,7 +1155,7 @@ static int ssl_parse_hello_verify_request( mbedtls_ssl_context *ssl )
|
||||
if( ssl->handshake->verify_cookie == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc failed (%d bytes)", cookie_len ) );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
memcpy( ssl->handshake->verify_cookie, p, cookie_len );
|
||||
@ -2914,7 +2914,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 alloc failed" ) );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
memcpy( ticket, msg + 6, ticket_len );
|
||||
|
@ -68,7 +68,7 @@ int mbedtls_ssl_set_client_transport_id( mbedtls_ssl_context *ssl,
|
||||
mbedtls_free( ssl->cli_id );
|
||||
|
||||
if( ( ssl->cli_id = mbedtls_calloc( 1, ilen ) ) == NULL )
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
|
||||
memcpy( ssl->cli_id, info, ilen );
|
||||
ssl->cli_id_len = ilen;
|
||||
@ -264,7 +264,7 @@ static int ssl_parse_supported_elliptic_curves( mbedtls_ssl_context *ssl,
|
||||
our_size = MBEDTLS_ECP_DP_MAX;
|
||||
|
||||
if( ( curves = mbedtls_calloc( our_size, sizeof( *curves ) ) ) == NULL )
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
|
||||
ssl->handshake->curves = curves;
|
||||
|
||||
|
@ -247,7 +247,7 @@ static int ssl_load_session( mbedtls_ssl_session *session,
|
||||
session->peer_cert = mbedtls_calloc( 1, sizeof( mbedtls_x509_crt ) );
|
||||
|
||||
if( session->peer_cert == NULL )
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
|
||||
mbedtls_x509_crt_init( session->peer_cert );
|
||||
|
||||
|
@ -175,7 +175,7 @@ static int ssl_session_copy( mbedtls_ssl_session *dst, const mbedtls_ssl_session
|
||||
|
||||
dst->peer_cert = mbedtls_calloc( 1, sizeof(mbedtls_x509_crt) );
|
||||
if( dst->peer_cert == NULL )
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
|
||||
mbedtls_x509_crt_init( dst->peer_cert );
|
||||
|
||||
@ -194,7 +194,7 @@ static int ssl_session_copy( mbedtls_ssl_session *dst, const mbedtls_ssl_session
|
||||
{
|
||||
dst->ticket = mbedtls_calloc( 1, src->ticket_len );
|
||||
if( dst->ticket == NULL )
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
|
||||
memcpy( dst->ticket, src->ticket, src->ticket_len );
|
||||
}
|
||||
@ -934,7 +934,7 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc(%d bytes) failed",
|
||||
MBEDTLS_SSL_BUFFER_LEN ) );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
@ -2458,14 +2458,14 @@ static int ssl_flight_append( mbedtls_ssl_context *ssl )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc %d bytes failed",
|
||||
sizeof( mbedtls_ssl_flight_item ) ) );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
if( ( msg->p = mbedtls_calloc( 1, ssl->out_msglen ) ) == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc %d bytes failed", ssl->out_msglen ) );
|
||||
mbedtls_free( msg );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
/* Copy current handshake message with headers */
|
||||
@ -2928,7 +2928,7 @@ static int ssl_reassemble_dtls_handshake( mbedtls_ssl_context *ssl )
|
||||
if( ssl->handshake->hs_msg == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc failed (%d bytes)", alloc_len ) );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
/* Prepare final header: copy msg_type, length and message_seq,
|
||||
@ -3978,7 +3978,7 @@ int mbedtls_ssl_parse_certificate( mbedtls_ssl_context *ssl )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc(%d bytes) failed",
|
||||
sizeof( mbedtls_x509_crt ) ) );
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
mbedtls_x509_crt_init( ssl->session_negotiate->peer_cert );
|
||||
@ -4924,7 +4924,7 @@ static int ssl_handshake_init( mbedtls_ssl_context *ssl )
|
||||
ssl->transform_negotiate = NULL;
|
||||
ssl->session_negotiate = NULL;
|
||||
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
/* Initialize structures */
|
||||
@ -5006,7 +5006,7 @@ int mbedtls_ssl_setup( mbedtls_ssl_context *ssl,
|
||||
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 );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
@ -5306,7 +5306,7 @@ static int ssl_append_key_cert( mbedtls_ssl_key_cert **head,
|
||||
|
||||
new = mbedtls_calloc( 1, sizeof( mbedtls_ssl_key_cert ) );
|
||||
if( new == NULL )
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
|
||||
new->cert = cert;
|
||||
new->key = key;
|
||||
@ -5384,7 +5384,7 @@ int mbedtls_ssl_conf_psk( mbedtls_ssl_config *conf,
|
||||
{
|
||||
mbedtls_free( conf->psk );
|
||||
conf->psk = NULL;
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
conf->psk_len = psk_len;
|
||||
@ -5412,7 +5412,7 @@ int mbedtls_ssl_set_hs_psk( mbedtls_ssl_context *ssl,
|
||||
{
|
||||
mbedtls_free( ssl->handshake->psk );
|
||||
ssl->handshake->psk = NULL;
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
ssl->handshake->psk_len = psk_len;
|
||||
@ -5490,7 +5490,7 @@ int mbedtls_ssl_set_hostname( mbedtls_ssl_context *ssl, const char *hostname )
|
||||
ssl->hostname = mbedtls_calloc( 1, hostname_len + 1 );
|
||||
|
||||
if( ssl->hostname == NULL )
|
||||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
|
||||
memcpy( ssl->hostname, hostname, hostname_len );
|
||||
|
||||
|
@ -455,7 +455,7 @@ int mbedtls_x509_get_name( unsigned char **p, const unsigned char *end,
|
||||
cur->next = mbedtls_calloc( 1, sizeof( mbedtls_x509_name ) );
|
||||
|
||||
if( cur->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
cur = cur->next;
|
||||
}
|
||||
@ -469,7 +469,7 @@ int mbedtls_x509_get_name( unsigned char **p, const unsigned char *end,
|
||||
cur->next = mbedtls_calloc( 1, sizeof( mbedtls_x509_name ) );
|
||||
|
||||
if( cur->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
cur = cur->next;
|
||||
}
|
||||
@ -595,7 +595,7 @@ int mbedtls_x509_get_sig_alg( const mbedtls_x509_buf *sig_oid, const mbedtls_x50
|
||||
|
||||
pss_opts = mbedtls_calloc( 1, sizeof( mbedtls_pk_rsassa_pss_options ) );
|
||||
if( pss_opts == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
ret = mbedtls_x509_get_rsassa_pss_params( sig_params,
|
||||
md_alg,
|
||||
|
@ -137,7 +137,7 @@ int mbedtls_x509_string_to_names( mbedtls_asn1_named_data **head, const char *na
|
||||
(unsigned char *) data,
|
||||
d - data ) == NULL )
|
||||
{
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
while( c < end && *(c + 1) == ' ' )
|
||||
@ -177,7 +177,7 @@ int mbedtls_x509_set_extension( mbedtls_asn1_named_data **head, const char *oid,
|
||||
if( ( cur = mbedtls_asn1_store_named_data( head, oid, oid_len,
|
||||
NULL, val_len + 1 ) ) == NULL )
|
||||
{
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
cur->val.p[0] = critical;
|
||||
|
@ -241,7 +241,7 @@ static int x509_get_entries( unsigned char **p,
|
||||
cur_entry->next = mbedtls_calloc( 1, sizeof( mbedtls_x509_crl_entry ) );
|
||||
|
||||
if( cur_entry->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
cur_entry = cur_entry->next;
|
||||
}
|
||||
@ -285,7 +285,7 @@ int mbedtls_x509_crl_parse_der( mbedtls_x509_crl *chain,
|
||||
if( crl->next == NULL )
|
||||
{
|
||||
mbedtls_x509_crl_free( crl );
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
mbedtls_x509_crl_init( crl->next );
|
||||
@ -296,7 +296,7 @@ int mbedtls_x509_crl_parse_der( mbedtls_x509_crl *chain,
|
||||
* Copy raw DER-encoded CRL
|
||||
*/
|
||||
if( ( p = mbedtls_calloc( 1, buflen ) ) == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
memcpy( p, buf, buflen );
|
||||
|
||||
|
@ -363,7 +363,7 @@ static int x509_get_subject_alt_name( unsigned char **p,
|
||||
|
||||
if( cur->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +
|
||||
MBEDTLS_ERR_ASN1_MALLOC_FAILED );
|
||||
MBEDTLS_ERR_ASN1_ALLOC_FAILED );
|
||||
|
||||
cur = cur->next;
|
||||
}
|
||||
@ -554,7 +554,7 @@ static int x509_crt_parse_der_core( mbedtls_x509_crt *crt, const unsigned char *
|
||||
|
||||
p = mbedtls_calloc( 1, len = buflen );
|
||||
if( p == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
memcpy( p, buf, buflen );
|
||||
|
||||
@ -810,7 +810,7 @@ int mbedtls_x509_crt_parse_der( mbedtls_x509_crt *chain, const unsigned char *bu
|
||||
crt->next = mbedtls_calloc( 1, sizeof( mbedtls_x509_crt ) );
|
||||
|
||||
if( crt->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
prev = crt;
|
||||
mbedtls_x509_crt_init( crt->next );
|
||||
@ -919,7 +919,7 @@ int mbedtls_x509_crt_parse( mbedtls_x509_crt *chain, const unsigned char *buf, s
|
||||
/*
|
||||
* Quit parsing on a memory error
|
||||
*/
|
||||
if( ret == MBEDTLS_ERR_X509_MALLOC_FAILED )
|
||||
if( ret == MBEDTLS_ERR_X509_ALLOC_FAILED )
|
||||
return( ret );
|
||||
|
||||
if( first_error == 0 )
|
||||
|
@ -116,7 +116,7 @@ int mbedtls_x509_csr_parse_der( mbedtls_x509_csr *csr,
|
||||
p = mbedtls_calloc( 1, len = buflen );
|
||||
|
||||
if( p == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
memcpy( p, buf, buflen );
|
||||
|
||||
|
Reference in New Issue
Block a user