remove compilation warnings

This commit is contained in:
mohammad1603 2018-05-31 03:18:45 -07:00 committed by itayzafrir
parent f07db2e919
commit 9b07132591

View File

@ -577,7 +577,8 @@ exit:
/* BEGIN_CASE */ /* BEGIN_CASE */
void aead_encrypt_decrypt( int key_type_arg, char * key_hex, void aead_encrypt_decrypt( int key_type_arg, char * key_hex,
int alg_arg, char * input_hex, int alg_arg, char * input_hex,
char * add_data, int expected_result ) char * add_data
, int expected_result_arg )
{ {
int slot = 1; int slot = 1;
psa_key_type_t key_type = key_type_arg; 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; unsigned char *additional_data = NULL;
size_t additional_data_length = 0; size_t additional_data_length = 0;
size_t i = 0; size_t i = 0;
psa_status_t expected_result = (psa_status_t) expected_result_arg;
key_data = unhexify_alloc( key_hex, &key_size ); 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, nonce, nonce_length,
additional_data, additional_data_length, additional_data, additional_data_length,
input_data, input_size, output_data, 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 ); output_data2 = mbedtls_calloc( 1, output_length );
TEST_ASSERT( output_data2 != NULL ); TEST_ASSERT( output_data2 != NULL );
@ -634,9 +636,9 @@ void aead_encrypt_decrypt( int key_type_arg, char * key_hex,
nonce, nonce_length, nonce, nonce_length,
additional_data, additional_data_length, additional_data, additional_data_length,
output_data, output_length - tag_length, output_data2, 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, TEST_ASSERT( memcmp( input_data, output_data2,
input_size ) == 0 ); input_size ) == 0 );
@ -649,6 +651,7 @@ exit:
mbedtls_free( input_data ); mbedtls_free( input_data );
mbedtls_free( additional_data ); mbedtls_free( additional_data );
mbedtls_free( output_data ); mbedtls_free( output_data );
mbedtls_free( output_data2 );
mbedtls_psa_crypto_free( ); mbedtls_psa_crypto_free( );
} }
/* END_CASE */ /* END_CASE */