Replace AEAD operation init func with macro
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index 7c98806..4065090 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -316,7 +316,7 @@
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
psa_key_type_t key_type = key_type_arg;
psa_algorithm_t alg = alg_arg;
- psa_aead_operation_t operation;
+ psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
unsigned char *output_data = NULL;
unsigned char *part_data = NULL;
unsigned char *final_data = NULL;
@@ -391,9 +391,6 @@
ASSERT_ALLOC( final_data, final_output_size );
- operation = psa_aead_operation_init( );
-
-
if( is_encrypt )
status = psa_aead_encrypt_setup( &operation, key, alg );
else
@@ -3693,7 +3690,7 @@
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
psa_key_type_t key_type = key_type_arg;
psa_algorithm_t alg = alg_arg;
- psa_aead_operation_t operation;
+ psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
uint8_t nonce_buffer[PSA_AEAD_NONCE_MAX_SIZE];
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
@@ -3729,8 +3726,6 @@
ASSERT_ALLOC( ciphertext, ciphertext_size );
- operation = psa_aead_operation_init( );
-
status = psa_aead_encrypt_setup( &operation, key, alg );
/* If the operation is not supported, just skip and not fail in case the
@@ -3792,7 +3787,7 @@
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
psa_key_type_t key_type = key_type_arg;
psa_algorithm_t alg = alg_arg;
- psa_aead_operation_t operation;
+ psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
uint8_t *nonce_buffer = NULL;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
@@ -3828,8 +3823,6 @@
ASSERT_ALLOC( ciphertext, ciphertext_size );
- operation = psa_aead_operation_init( );
-
status = psa_aead_encrypt_setup( &operation, key, alg );
/* If the operation is not supported, just skip and not fail in case the
@@ -3908,7 +3901,7 @@
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
psa_key_type_t key_type = key_type_arg;
psa_algorithm_t alg = alg_arg;
- psa_aead_operation_t operation;
+ psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
psa_status_t expected_status = expected_status_arg;
@@ -3937,8 +3930,6 @@
ASSERT_ALLOC( ciphertext, ciphertext_size );
- operation = psa_aead_operation_init( );
-
status = psa_aead_encrypt_setup( &operation, key, alg );
/* If the operation is not supported, just skip and not fail in case the
@@ -3993,7 +3984,7 @@
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
psa_key_type_t key_type = key_type_arg;
psa_algorithm_t alg = alg_arg;
- psa_aead_operation_t operation;
+ psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
psa_status_t expected_status = expected_status_arg;
@@ -4025,8 +4016,6 @@
ASSERT_ALLOC( tag_buffer, tag_size );
- operation = psa_aead_operation_init( );
-
status = psa_aead_encrypt_setup( &operation, key, alg );
/* If the operation is not supported, just skip and not fail in case the
@@ -4079,7 +4068,7 @@
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
psa_key_type_t key_type = key_type_arg;
psa_algorithm_t alg = alg_arg;
- psa_aead_operation_t operation;
+ psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
psa_status_t expected_status = expected_status_arg;
@@ -4112,8 +4101,6 @@
ASSERT_ALLOC( finish_plaintext, verify_plaintext_size );
- operation = psa_aead_operation_init( );
-
status = psa_aead_decrypt_setup( &operation, key, alg );
/* If the operation is not supported, just skip and not fail in case the
@@ -4166,7 +4153,7 @@
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
psa_key_type_t key_type = key_type_arg;
psa_algorithm_t alg = alg_arg;
- psa_aead_operation_t operation;
+ psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
psa_status_t expected_status = expected_status_arg;
@@ -4181,8 +4168,6 @@
PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
&key ) );
- operation = psa_aead_operation_init( );
-
mbedtls_test_set_step( 0 );
status = psa_aead_encrypt_setup( &operation, key, alg );
@@ -4214,7 +4199,7 @@
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
psa_key_type_t key_type = key_type_arg;
psa_algorithm_t alg = alg_arg;
- psa_aead_operation_t operation;
+ psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
unsigned char *output_data = NULL;
unsigned char *final_data = NULL;
size_t output_size = 0;
@@ -4258,8 +4243,6 @@
/* Test all operations error without calling setup first. */
- operation = psa_aead_operation_init( );
-
TEST_EQUAL( psa_aead_set_nonce( &operation, nonce->x, nonce->len ),
PSA_ERROR_BAD_STATE );