@@ -1985,8 +1985,8 @@ void mac_sign( int key_type_arg,
1985
1985
&mac_length ) );
1986
1986
1987
1987
/* Compare with the expected value. */
1988
- TEST_EQUAL( mac_length , expected_mac->len );
1989
- TEST_EQUAL( memcmp( actual_mac, expected_mac->x, mac_length ), 0 );
1988
+ ASSERT_COMPARE( expected_mac->x , expected_mac->len,
1989
+ actual_mac, mac_length );
1990
1990
1991
1991
/* Verify that the end of the buffer is untouched. */
1992
1992
TEST_ASSERT( mem_is_char( actual_mac + mac_length, '+',
@@ -3576,8 +3576,8 @@ void derive_output( int alg_arg,
3576
3576
/* Success. Check the read data. */
3577
3577
PSA_ASSERT( status );
3578
3578
if( output_sizes[i] != 0 )
3579
- TEST_EQUAL( memcmp( output_buffer, expected_outputs [i],
3580
- output_sizes [i] ), 0 );
3579
+ ASSERT_COMPARE( output_buffer, output_sizes [i],
3580
+ expected_outputs [i], output_sizes[i] );
3581
3581
/* Check the generator status. */
3582
3582
expected_capacity -= output_sizes[i];
3583
3583
PSA_ASSERT( psa_get_generator_capacity( &generator,
@@ -3805,7 +3805,8 @@ void derive_key_export( int alg_arg,
3805
3805
TEST_EQUAL( length, bytes2 );
3806
3806
3807
3807
/* Compare the outputs from the two runs. */
3808
- TEST_EQUAL( memcmp( output_buffer, export_buffer, capacity ), 0 );
3808
+ ASSERT_COMPARE( output_buffer, bytes1 + bytes2,
3809
+ export_buffer, capacity );
3809
3810
3810
3811
exit:
3811
3812
mbedtls_free( output_buffer );
@@ -3948,15 +3949,15 @@ void key_agreement_output( int alg_arg,
3948
3949
PSA_ASSERT( psa_generator_read( &generator,
3949
3950
actual_output,
3950
3951
expected_output1->len ) );
3951
- TEST_EQUAL( memcmp( actual_output, expected_output1->x ,
3952
- expected_output1->len ), 0 );
3952
+ ASSERT_COMPARE( actual_output, expected_output1->len ,
3953
+ expected_output1->x, expected_output1->len );
3953
3954
if( expected_output2->len != 0 )
3954
3955
{
3955
3956
PSA_ASSERT( psa_generator_read( &generator,
3956
3957
actual_output,
3957
3958
expected_output2->len ) );
3958
- TEST_EQUAL( memcmp( actual_output, expected_output2->x ,
3959
- expected_output2->len ), 0 );
3959
+ ASSERT_COMPARE( actual_output, expected_output2->len ,
3960
+ expected_output2->x, expected_output2->len );
3960
3961
}
3961
3962
3962
3963
exit:
@@ -3993,7 +3994,8 @@ void generate_random( int bytes_arg )
3993
3994
PSA_ASSERT( psa_generate_random( output, bytes ) );
3994
3995
3995
3996
/* Check that no more than bytes have been overwritten */
3996
- TEST_EQUAL( memcmp( output + bytes, trail, sizeof( trail ) ), 0 );
3997
+ ASSERT_COMPARE( output + bytes, sizeof( trail ),
3998
+ trail, sizeof( trail ) );
3997
3999
3998
4000
for( i = 0; i < bytes; i++ )
3999
4001
{
0 commit comments