diff --git a/tests/suites/test_suite_base64.function b/tests/suites/test_suite_base64.function index b8ddba72a..3ba59dc95 100644 --- a/tests/suites/test_suite_base64.function +++ b/tests/suites/test_suite_base64.function @@ -39,7 +39,8 @@ void base64_decode( char *src_string, char *dst_string, int result ) memset(dst_str, 0x00, 1000); strncpy( (char *) src_str, src_string, sizeof(src_str) - 1 ); - TEST_ASSERT( res = base64_decode( dst_str, &len, src_str, strlen( (char *) src_str ) ) == result ); + res = base64_decode( dst_str, &len, src_str, strlen( (char *) src_str ) ); + TEST_ASSERT( res == result ); if( result == 0 ) { TEST_ASSERT( strcmp( (char *) dst_str, dst_string ) == 0 ); diff --git a/tests/suites/test_suite_ecdsa.function b/tests/suites/test_suite_ecdsa.function index e6c2f939c..10fb66ba9 100644 --- a/tests/suites/test_suite_ecdsa.function +++ b/tests/suites/test_suite_ecdsa.function @@ -113,7 +113,8 @@ void ecdsa_det_test_vectors( int id, char *d_str, int md_alg, TEST_ASSERT( mpi_read_string( &r_check, 16, r_str ) == 0 ); TEST_ASSERT( mpi_read_string( &s_check, 16, s_str ) == 0 ); - TEST_ASSERT( ( md_info = md_info_from_type( md_alg ) ) != NULL ); + md_info = md_info_from_type( md_alg ); + TEST_ASSERT( md_info != NULL ); hlen = md_info->size; md( md_info, (const unsigned char *) msg, strlen( msg ), hash ); diff --git a/tests/suites/test_suite_ecp.function b/tests/suites/test_suite_ecp.function index 0c51b10e8..1e8e31aa8 100644 --- a/tests/suites/test_suite_ecp.function +++ b/tests/suites/test_suite_ecp.function @@ -14,9 +14,12 @@ void ecp_curve_info( int id, int tls_id, int size, char *name ) { const ecp_curve_info *by_id, *by_tls, *by_name; - TEST_ASSERT( ( by_id = ecp_curve_info_from_grp_id( id ) ) != NULL ); - TEST_ASSERT( ( by_tls = ecp_curve_info_from_tls_id( tls_id ) ) != NULL ); - TEST_ASSERT( ( by_name = ecp_curve_info_from_name( name ) ) != NULL ); + by_id = ecp_curve_info_from_grp_id( id ); + by_tls = ecp_curve_info_from_tls_id( tls_id ); + by_name = ecp_curve_info_from_name( name ); + TEST_ASSERT( by_id != NULL ); + TEST_ASSERT( by_tls != NULL ); + TEST_ASSERT( by_name != NULL ); TEST_ASSERT( by_id == by_tls ); TEST_ASSERT( by_id == by_name ); @@ -547,7 +550,8 @@ void ecp_tls_write_read_group( int id ) TEST_ASSERT( ecp_use_known_dp( &grp1, id ) == 0 ); TEST_ASSERT( ecp_tls_write_group( &grp1, &len, buf, 10 ) == 0 ); - TEST_ASSERT( ( ret = ecp_tls_read_group( &grp2, &vbuf, len ) ) == 0 ); + ret = ecp_tls_read_group( &grp2, &vbuf, len ); + TEST_ASSERT( ret == 0 ); if( ret == 0 ) { diff --git a/tests/suites/test_suite_hmac_drbg.function b/tests/suites/test_suite_hmac_drbg.function index d9a365d0f..715875676 100644 --- a/tests/suites/test_suite_hmac_drbg.function +++ b/tests/suites/test_suite_hmac_drbg.function @@ -44,7 +44,8 @@ void hmac_drbg_entropy_usage( int md_alg ) entropy.len = sizeof( buf ); entropy.p = buf; - TEST_ASSERT( ( md_info = md_info_from_type( md_alg ) ) != NULL ); + md_info = md_info_from_type( md_alg ); + TEST_ASSERT( md_info != NULL ); /* Init must use entropy */ last_len = entropy.len; @@ -110,7 +111,9 @@ void hmac_drbg_seed_file( int md_alg, char *path, int ret ) const md_info_t *md_info; hmac_drbg_context ctx; - TEST_ASSERT( ( md_info = md_info_from_type( md_alg ) ) != NULL ); + md_info = md_info_from_type( md_alg ); + TEST_ASSERT( md_info != NULL ); + TEST_ASSERT( hmac_drbg_init( &ctx, md_info, rnd_std_rand, NULL, NULL, 0 ) == 0 ); @@ -133,7 +136,8 @@ void hmac_drbg_buf( int md_alg ) memset( buf, 0, sizeof( buf ) ); memset( out, 0, sizeof( out ) ); - TEST_ASSERT( ( md_info = md_info_from_type( md_alg ) ) != NULL ); + md_info = md_info_from_type( md_alg ); + TEST_ASSERT( md_info != NULL ); TEST_ASSERT( hmac_drbg_init_buf( &ctx, md_info, buf, sizeof( buf ) ) == 0 ); /* Make sure it never tries to reseed (would segfault otherwise) */ @@ -174,7 +178,8 @@ void hmac_drbg_no_reseed( int md_alg, p_entropy.len = unhexify( entropy, entropy_hex ); p_entropy.p = entropy; - TEST_ASSERT( ( md_info = md_info_from_type( md_alg ) ) != NULL ); + md_info = md_info_from_type( md_alg ); + TEST_ASSERT( md_info != NULL ); /* Test the simplified buffer-based variant */ memcpy( data, entropy, p_entropy.len ); @@ -231,7 +236,9 @@ void hmac_drbg_nopr( int md_alg, p_entropy.len = unhexify( entropy, entropy_hex ); p_entropy.p = entropy; - TEST_ASSERT( ( md_info = md_info_from_type( md_alg ) ) != NULL ); + md_info = md_info_from_type( md_alg ); + TEST_ASSERT( md_info != NULL ); + TEST_ASSERT( hmac_drbg_init( &ctx, md_info, entropy_func, &p_entropy, custom, custom_len ) == 0 ); TEST_ASSERT( hmac_drbg_reseed( &ctx, add1, add1_len ) == 0 ); @@ -272,7 +279,9 @@ void hmac_drbg_pr( int md_alg, p_entropy.len = unhexify( entropy, entropy_hex ); p_entropy.p = entropy; - TEST_ASSERT( ( md_info = md_info_from_type( md_alg ) ) != NULL ); + md_info = md_info_from_type( md_alg ); + TEST_ASSERT( md_info != NULL ); + TEST_ASSERT( hmac_drbg_init( &ctx, md_info, entropy_func, &p_entropy, custom, custom_len ) == 0 ); hmac_drbg_set_prediction_resistance( &ctx, POLARSSL_HMAC_DRBG_PR_ON ); diff --git a/tests/suites/test_suite_md.function b/tests/suites/test_suite_md.function index 7b6f9e5b1..afd2f5e0d 100644 --- a/tests/suites/test_suite_md.function +++ b/tests/suites/test_suite_md.function @@ -27,7 +27,8 @@ void md_process( ) */ for( md_type_ptr = md_list(); *md_type_ptr != 0; md_type_ptr++ ) { - TEST_ASSERT( ( info = md_info_from_type( *md_type_ptr ) ) != NULL ); + info = md_info_from_type( *md_type_ptr ); + TEST_ASSERT( info != NULL ); TEST_ASSERT( md_init_ctx( &ctx, info ) == 0 ); TEST_ASSERT( md_process( &ctx, buf ) == 0 ); TEST_ASSERT( md_free_ctx( &ctx ) == 0 ); @@ -42,7 +43,8 @@ void md_info( int md_type, char *md_name, int md_size ) const int *md_type_ptr; int found; - TEST_ASSERT( ( md_info = md_info_from_type( md_type ) ) != NULL ); + md_info = md_info_from_type( md_type ); + TEST_ASSERT( md_info != NULL ); TEST_ASSERT( md_info == md_info_from_string( md_name ) ); TEST_ASSERT( md_get_type( md_info ) == (md_type_t) md_type ); diff --git a/tests/suites/test_suite_x509write.function b/tests/suites/test_suite_x509write.function index 0cea5f949..2eb270f16 100644 --- a/tests/suites/test_suite_x509write.function +++ b/tests/suites/test_suite_x509write.function @@ -117,8 +117,8 @@ void x509_crt_check( char *subject_key_file, char *subject_pwd, f = fopen( cert_check_file, "r" ); TEST_ASSERT( f != NULL ); - TEST_ASSERT( ( olen = fread( check_buf, 1, sizeof(check_buf), f ) ) < - sizeof(check_buf) ); + olen = fread( check_buf, 1, sizeof(check_buf), f ); + TEST_ASSERT( olen < sizeof(check_buf) ); fclose( f ); TEST_ASSERT( olen >= pem_len - 1 );