diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index 9a6004a49..b592c6eca 100755 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -577,7 +577,8 @@ exit: /* BEGIN_CASE */ void aead_encrypt_decrypt( int key_type_arg, char * key_hex, int alg_arg, char * input_hex, - char * add_data, int expected_result ) + char * add_data + , int expected_result_arg ) { int slot = 1; psa_key_type_t key_type = key_type_arg; @@ -597,6 +598,7 @@ void aead_encrypt_decrypt( int key_type_arg, char * key_hex, unsigned char *additional_data = NULL; size_t additional_data_length = 0; size_t i = 0; + psa_status_t expected_result = (psa_status_t) expected_result_arg; key_data = unhexify_alloc( key_hex, &key_size ); @@ -625,7 +627,7 @@ void aead_encrypt_decrypt( int key_type_arg, char * key_hex, nonce, nonce_length, additional_data, additional_data_length, input_data, input_size, output_data, - output_size, &output_length ) == ( psa_status_t )expected_result ); + output_size, &output_length ) == expected_result ); output_data2 = mbedtls_calloc( 1, output_length ); TEST_ASSERT( output_data2 != NULL ); @@ -634,9 +636,9 @@ void aead_encrypt_decrypt( int key_type_arg, char * key_hex, nonce, nonce_length, additional_data, additional_data_length, output_data, output_length - tag_length, output_data2, - output_length, &output_length2 ) == ( psa_status_t )expected_result ); + output_length, &output_length2 ) == expected_result ); - if( expected_result == 0 ) + if( PSA_SUCCESS == expected_result ) { TEST_ASSERT( memcmp( input_data, output_data2, input_size ) == 0 ); @@ -649,6 +651,7 @@ exit: mbedtls_free( input_data ); mbedtls_free( additional_data ); mbedtls_free( output_data ); + mbedtls_free( output_data2 ); mbedtls_psa_crypto_free( ); } /* END_CASE */