From 091e73b22b4759d938ee0afeb9bf6d7b112fd861 Mon Sep 17 00:00:00 2001 From: mohammad1603 Date: Mon, 30 Apr 2018 17:24:39 +0300 Subject: [PATCH] Fix usage of TEST_ASSERT Add missing == PSA_SUCCESS in TEST_ASSERT usage --- tests/suites/test_suite_psa_crypto.function | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index 4721c87f3..6376e5659 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 );