diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index 4721c87f32..6376e56599 100755 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -591,7 +591,7 @@ void aead_encrypt_decrypt( int key_type_arg, char *key_hex, unsigned char *output_data2 = NULL; size_t output_length2; psa_status_t actual_status; - uint8_t* nonce = NULL; + uint8_t nonce[16]; size_t nonce_length = 16; size_t tag_length = 16; @@ -606,8 +606,7 @@ void aead_encrypt_decrypt( int key_type_arg, char *key_hex, { nonce_length = 12; } - nonce = mbedtls_calloc( 1, nonce_length ); - TEST_ASSERT( nonce != NULL ); + for( int i = 0; i < nonce_length; ++nonce_length ) nonce[i] = i; @@ -620,7 +619,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, - input_size, &output_length ) ); + input_size, &output_length ) == PSA_SUCCESS ); output_data2 = mbedtls_calloc( 1, output_length ); TEST_ASSERT( output_data2 != NULL ); @@ -629,7 +628,7 @@ 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 ) ); + output_length, &output_length2 ) == PSA_SUCCESS ); TEST_ASSERT( memcmp( input, output_data2, input_size ) == 0 );