Style fixes in pem, x509_crl and buf_alloc

This commit is contained in:
Andres Amaya Garcia 2017-07-06 10:06:58 +01:00 committed by Andres Amaya Garcia
parent 8ec3bfe180
commit f1ee63562a
3 changed files with 5 additions and 4 deletions

View File

@ -184,7 +184,7 @@ static int verify_chain()
{
memory_header *prv = heap.first, *cur;
if( heap.first == NULL || verify_header( heap.first ) != 0 )
if( prv == NULL || verify_header( prv ) != 0 )
{
#if defined(MBEDTLS_MEMORY_DEBUG)
mbedtls_fprintf( stderr, "FATAL: verification of first header "

View File

@ -435,7 +435,8 @@ int mbedtls_pem_write_buffer( const char *header, const char *footer,
return( MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL );
}
if( use_len != 0 && ( encode_buf = mbedtls_calloc( 1, use_len ) ) == NULL )
if( use_len != 0 &&
( ( encode_buf = mbedtls_calloc( 1, use_len ) ) == NULL ) )
return( MBEDTLS_ERR_PEM_ALLOC_FAILED );
if( ( ret = mbedtls_base64_encode( encode_buf, use_len, &use_len, der_data,

View File

@ -257,7 +257,7 @@ int mbedtls_x509_crl_parse_der( mbedtls_x509_crl *chain,
{
int ret;
size_t len;
unsigned char *p = NULL, *end;
unsigned char *p = NULL, *end = NULL;
mbedtls_x509_buf sig_params1, sig_params2, sig_oid2;
mbedtls_x509_crl *crl = chain;
@ -294,7 +294,7 @@ int mbedtls_x509_crl_parse_der( mbedtls_x509_crl *chain,
/*
* Copy raw DER-encoded CRL
*/
if( buflen != 0 && ( p = mbedtls_calloc( 1, buflen ) ) == NULL )
if( buflen != 0 && ( ( p = mbedtls_calloc( 1, buflen ) ) == NULL ) )
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
memcpy( p, buf, buflen );