Address review comments for code-style issues

This commit is contained in:
Jarno Lamsa 2019-06-04 15:36:18 +03:00
parent 38061f4a17
commit 5737ec97a6
2 changed files with 23 additions and 13 deletions

View File

@ -2371,23 +2371,27 @@ send_request:
opt.serialize = 0; opt.serialize = 0;
mbedtls_printf( " Serializing live connection..." ); mbedtls_printf( " Serializing live connection..." );
if( ( ret = mbedtls_ssl_context_save( &ssl, NULL, 0, &len) ) != MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ) if( ( ret = mbedtls_ssl_context_save( &ssl, NULL, 0, &len ) )
!= MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL )
{ {
mbedtls_printf( " failed\n ! mbedtls_ssl_context_save returned -0x%x\n\n", -ret ); mbedtls_printf( " failed\n ! mbedtls_ssl_context_save returned "
"-0x%x\n\n", -ret );
goto exit; goto exit;
} }
if( ( buf = mbedtls_calloc( 1, len ) ) == NULL ) if( ( buf = mbedtls_calloc( 1, len ) ) == NULL )
{ {
mbedtls_printf( " failed\n ! Couldn't allocate buffer for serialized context" ); mbedtls_printf( " failed\n ! Couldn't allocate buffer for "
"serialized context" );
goto exit; goto exit;
} }
if( ( ret = mbedtls_ssl_context_save( &ssl, buf, len, &len ) ) != 0 ) if( ( ret = mbedtls_ssl_context_save( &ssl, buf, len, &len ) ) != 0 )
{ {
mbedtls_printf( "failed\n ! mbedtls_ssl_context_save returned -0x%x\n\n", -ret ); mbedtls_printf( "failed\n ! mbedtls_ssl_context_save returned "
"-0x%x\n\n", -ret );
goto exit; goto exit;
} }
@ -2396,12 +2400,13 @@ send_request:
if( ( ret = mbedtls_ssl_context_load( &ssl, buf, len ) ) != 0 ) if( ( ret = mbedtls_ssl_context_load( &ssl, buf, len ) ) != 0 )
{ {
mbedtls_printf( "failed\n ! mbedtls_ssl_context_load returned -0x%x\n\n", -ret ); mbedtls_printf( "failed\n ! mbedtls_ssl_context_load returned "
"-0x%x\n\n", -ret );
goto exit; goto exit;
} }
} }
#endif #endif /* MBEDTLS_SSL_CONTEXT_SERIALIZATION */
/* /*
* 7d. Continue doing data exchanges? * 7d. Continue doing data exchanges?

View File

@ -3356,23 +3356,27 @@ data_exchange:
opt.serialize = 0; opt.serialize = 0;
mbedtls_printf( " Serializing live connection..." ); mbedtls_printf( " Serializing live connection..." );
if( ( ret = mbedtls_ssl_context_save( &ssl, NULL, 0, &len) ) != MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ) if( ( ret = mbedtls_ssl_context_save( &ssl, NULL, 0, &len ) )
!= MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL )
{ {
mbedtls_printf( " failed\n ! mbedtls_ssl_context_save returned -0x%x\n\n", -ret ); mbedtls_printf( " failed\n ! mbedtls_ssl_context_save returned "
"-0x%x\n\n", -ret );
goto exit; goto exit;
} }
if( ( buf = mbedtls_calloc(1, len) ) == NULL ) if( ( buf = mbedtls_calloc(1, len) ) == NULL )
{ {
mbedtls_printf( " failed\n ! Couldn't allocate buffer for serialized context" ); mbedtls_printf( " failed\n ! Couldn't allocate buffer for "
"serialized context" );
goto exit; goto exit;
} }
if( ( ret = mbedtls_ssl_context_save( &ssl, buf, len, &len ) ) != 0 ) if( ( ret = mbedtls_ssl_context_save( &ssl, buf, len, &len ) ) != 0 )
{ {
mbedtls_printf( "failed\n ! mbedtls_ssl_context_save returned -0x%x\n\n", -ret ); mbedtls_printf( "failed\n ! mbedtls_ssl_context_save returned "
"-0x%x\n\n", -ret );
goto exit; goto exit;
} }
@ -3381,12 +3385,13 @@ data_exchange:
if( ( ret = mbedtls_ssl_context_load( &ssl, buf, len ) ) != 0 ) if( ( ret = mbedtls_ssl_context_load( &ssl, buf, len ) ) != 0 )
{ {
mbedtls_printf( "failed\n ! mbedtls_ssl_context_load returned -0x%x\n\n", -ret ); mbedtls_printf( "failed\n ! mbedtls_ssl_context_load returned "
"-0x%x\n\n", -ret );
goto exit; goto exit;
} }
} }
#endif #endif /* MBEDTLS_SSL_CONTEXT_SERIALIZATION */
/* /*
* 7c. Continue doing data exchanges? * 7c. Continue doing data exchanges?