Remove double initialisation of AEAD operation
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
bb979e7748
commit
a2a09b096c
1 changed files with 2 additions and 66 deletions
|
@ -4191,8 +4191,6 @@ void aead_multipart_setup( int key_type_arg, data_t *key_data,
|
|||
|
||||
psa_aead_abort( &operation );
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
mbedtls_test_set_step( 1 );
|
||||
|
||||
status = psa_aead_decrypt_setup( &operation, key, alg );
|
||||
|
@ -4267,8 +4265,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
psa_aead_abort( &operation );
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
TEST_EQUAL( psa_aead_generate_nonce( &operation, nonce_buffer,
|
||||
PSA_AEAD_NONCE_MAX_SIZE,
|
||||
&nonce_length ),
|
||||
|
@ -4278,8 +4274,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
TEST_EQUAL( psa_aead_set_lengths( &operation, additional_data->len,
|
||||
input_data->len ),
|
||||
PSA_ERROR_BAD_STATE );
|
||||
|
@ -4288,8 +4282,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
TEST_EQUAL( psa_aead_update_ad( &operation, additional_data->x,
|
||||
additional_data->len ),
|
||||
PSA_ERROR_BAD_STATE );
|
||||
|
@ -4298,8 +4290,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
TEST_EQUAL( psa_aead_update( &operation, input_data->x,
|
||||
input_data->len, output_data,
|
||||
output_size, &output_length ),
|
||||
|
@ -4309,8 +4299,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
TEST_EQUAL( psa_aead_finish( &operation, final_data,
|
||||
finish_output_size,
|
||||
&output_part_length,
|
||||
|
@ -4322,8 +4310,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
TEST_EQUAL( psa_aead_verify( &operation, final_data,
|
||||
finish_output_size,
|
||||
&output_part_length,
|
||||
|
@ -4335,8 +4321,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test for double setups. */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
TEST_EQUAL( psa_aead_encrypt_setup( &operation, key, alg ),
|
||||
|
@ -4346,8 +4330,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_decrypt_setup( &operation, key, alg ) );
|
||||
|
||||
TEST_EQUAL( psa_aead_decrypt_setup( &operation, key, alg ),
|
||||
|
@ -4357,8 +4339,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
TEST_EQUAL( psa_aead_decrypt_setup( &operation, key, alg ),
|
||||
|
@ -4368,8 +4348,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_decrypt_setup( &operation, key, alg ) );
|
||||
|
||||
TEST_EQUAL( psa_aead_encrypt_setup( &operation, key, alg ),
|
||||
|
@ -4379,8 +4357,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test for not setting a nonce. */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
TEST_EQUAL( psa_aead_update_ad( &operation, additional_data->x,
|
||||
|
@ -4391,8 +4367,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
TEST_EQUAL( psa_aead_update( &operation, input_data->x,
|
||||
|
@ -4404,8 +4378,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
TEST_EQUAL( psa_aead_finish( &operation, final_data,
|
||||
|
@ -4419,8 +4391,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_decrypt_setup( &operation, key, alg ) );
|
||||
|
||||
TEST_EQUAL( psa_aead_verify( &operation, final_data,
|
||||
|
@ -4434,8 +4404,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test for double setting nonce. */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
@ -4447,8 +4415,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test for double generating nonce. */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_generate_nonce( &operation, nonce_buffer,
|
||||
|
@ -4465,8 +4431,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test for generate nonce then set and vice versa */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_generate_nonce( &operation, nonce_buffer,
|
||||
|
@ -4480,8 +4444,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
@ -4495,8 +4457,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test for generating nonce in decrypt setup. */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_decrypt_setup( &operation, key, alg ) );
|
||||
|
||||
TEST_EQUAL( psa_aead_generate_nonce( &operation, nonce_buffer,
|
||||
|
@ -4508,8 +4468,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test for setting lengths twice. */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
@ -4525,8 +4483,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test for setting lengths after already starting data. */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
@ -4542,8 +4498,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
@ -4561,8 +4515,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
/* Test for not sending any additional data or data after setting non zero
|
||||
* lengths for them. (encrypt) */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
@ -4582,8 +4534,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
/* Test for not sending any additional data or data after setting non-zero
|
||||
* lengths for them. (decrypt) */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_decrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
@ -4603,8 +4553,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
/* Test for not sending any additional data after setting a non-zero length
|
||||
* for it. */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
@ -4621,8 +4569,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test for not sending any data after setting a non-zero length for it.*/
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
@ -4644,8 +4590,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test for sending too much additional data after setting lengths. */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
@ -4659,7 +4603,7 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
psa_aead_abort( &operation );
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
|
@ -4679,8 +4623,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test for sending too much data after setting lengths. */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
@ -4694,7 +4636,7 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
psa_aead_abort( &operation );
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
|
@ -4719,8 +4661,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test sending additional data after data. */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
@ -4737,8 +4677,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test calling finish on decryption. */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_decrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
@ -4754,8 +4692,6 @@ void aead_multipart_state_test( int key_type_arg, data_t *key_data,
|
|||
|
||||
/* Test calling verify on encryption. */
|
||||
|
||||
operation = psa_aead_operation_init( );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt_setup( &operation, key, alg ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_set_nonce( &operation, nonce->x, nonce->len ) );
|
||||
|
|
Loading…
Reference in a new issue