From 93c6ff23924818e8775165a080c62d83bb955f1f Mon Sep 17 00:00:00 2001 From: Jarno Lamsa Date: Tue, 4 Jun 2019 15:36:18 +0300 Subject: [PATCH] Address review comments for code-style issues --- programs/ssl/ssl_client2.c | 19 ++++++++++++------- programs/ssl/ssl_server2.c | 17 +++++++++++------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 495827c7c..3456dd3df 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -2925,23 +2925,27 @@ send_request: opt.serialize = 0; 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; } - 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; } 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; } @@ -2950,12 +2954,13 @@ send_request: 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; } } -#endif +#endif /* MBEDTLS_SSL_CONTEXT_SERIALIZATION */ /* * 7d. Continue doing data exchanges? diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index 88748b1d7..173593bdd 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -3936,23 +3936,27 @@ data_exchange: opt.serialize = 0; 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; } 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; } 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; } @@ -3961,12 +3965,13 @@ data_exchange: 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; } } -#endif +#endif /* MBEDTLS_SSL_CONTEXT_SERIALIZATION */ /* * 7c. Continue doing data exchanges?