Aligh update buffer test variables with psa naming

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
Paul Elliott 2021-09-01 12:04:23 +01:00
parent 3d7d52c2ed
commit c6d11d02f5

View file

@ -3878,7 +3878,7 @@ exit:
/* BEGIN_CASE */ /* BEGIN_CASE */
void aead_multipart_update_buffer_test( int key_type_arg, data_t *key_data, void aead_multipart_update_buffer_test( int key_type_arg, data_t *key_data,
int alg_arg, int alg_arg,
int buffer_size, int output_size_arg,
data_t *nonce, data_t *nonce,
data_t *additional_data, data_t *additional_data,
data_t *input_data, data_t *input_data,
@ -3892,10 +3892,11 @@ void aead_multipart_update_buffer_test( int key_type_arg, data_t *key_data,
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_status_t status = PSA_ERROR_GENERIC_ERROR; psa_status_t status = PSA_ERROR_GENERIC_ERROR;
psa_status_t expected_status = expected_status_arg; psa_status_t expected_status = expected_status_arg;
unsigned char *output_data = NULL; unsigned char *output = NULL;
unsigned char *final_data = NULL; unsigned char *ciphertext = NULL;
size_t finish_output_size = 0; size_t output_size = output_size_arg;
size_t output_length = 0; size_t ciphertext_size = 0;
size_t ciphertext_length = 0;
size_t tag_length = 0; size_t tag_length = 0;
uint8_t tag_buffer[PSA_AEAD_TAG_MAX_SIZE]; uint8_t tag_buffer[PSA_AEAD_TAG_MAX_SIZE];
@ -3910,13 +3911,11 @@ void aead_multipart_update_buffer_test( int key_type_arg, data_t *key_data,
PSA_ASSERT( psa_get_key_attributes( key, &attributes ) ); PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
ASSERT_ALLOC( output_data, buffer_size ); ASSERT_ALLOC( output, output_size );
finish_output_size = PSA_AEAD_FINISH_OUTPUT_SIZE( key_type, alg ); ciphertext_size = PSA_AEAD_FINISH_OUTPUT_SIZE( key_type, alg );
TEST_ASSERT( finish_output_size <= PSA_AEAD_FINISH_OUTPUT_MAX_SIZE ); ASSERT_ALLOC( ciphertext, ciphertext_size );
ASSERT_ALLOC( final_data, finish_output_size );
operation = psa_aead_operation_init( ); operation = psa_aead_operation_init( );
@ -3939,22 +3938,22 @@ void aead_multipart_update_buffer_test( int key_type_arg, data_t *key_data,
additional_data->len ) ); additional_data->len ) );
status = psa_aead_update( &operation, input_data->x, input_data->len, status = psa_aead_update( &operation, input_data->x, input_data->len,
output_data, buffer_size, &output_length ); output, output_size, &ciphertext_length );
TEST_EQUAL( status, expected_status ); TEST_EQUAL( status, expected_status );
if( expected_status == PSA_SUCCESS ) if( expected_status == PSA_SUCCESS )
{ {
/* Ensure we can still complete operation. */ /* Ensure we can still complete operation. */
PSA_ASSERT( psa_aead_finish( &operation, final_data, finish_output_size, PSA_ASSERT( psa_aead_finish( &operation, ciphertext, ciphertext_size,
&output_length, tag_buffer, &ciphertext_length, tag_buffer,
PSA_AEAD_TAG_MAX_SIZE, &tag_length ) ); PSA_AEAD_TAG_MAX_SIZE, &tag_length ) );
} }
exit: exit:
psa_destroy_key( key ); psa_destroy_key( key );
mbedtls_free( output_data ); mbedtls_free( output );
mbedtls_free( final_data ); mbedtls_free( ciphertext );
psa_aead_abort( &operation ); psa_aead_abort( &operation );
PSA_DONE( ); PSA_DONE( );
} }