Add missing cleanup to some multipart operation tests

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2020-08-25 23:15:20 +02:00
parent a09713c795
commit 64f13ef6ab

View file

@ -3066,6 +3066,7 @@ void mac_sign( int key_type_arg,
sizeof( actual_mac ) - mac_length ) ); sizeof( actual_mac ) - mac_length ) );
exit: exit:
psa_mac_abort( &operation );
psa_destroy_key( handle ); psa_destroy_key( handle );
PSA_DONE( ); PSA_DONE( );
} }
@ -3104,6 +3105,7 @@ void mac_verify( int key_type_arg,
expected_mac->len ) ); expected_mac->len ) );
exit: exit:
psa_mac_abort( &operation );
psa_destroy_key( handle ); psa_destroy_key( handle );
PSA_DONE( ); PSA_DONE( );
} }
@ -3183,6 +3185,7 @@ void cipher_setup( int key_type_arg,
#endif #endif
exit: exit:
psa_cipher_abort( &operation );
PSA_DONE( ); PSA_DONE( );
} }
/* END_CASE */ /* END_CASE */
@ -3335,6 +3338,7 @@ void cipher_bad_order( )
PSA_ASSERT( psa_destroy_key( handle ) ); PSA_ASSERT( psa_destroy_key( handle ) );
exit: exit:
psa_cipher_abort( &operation );
PSA_DONE( ); PSA_DONE( );
} }
/* END_CASE */ /* END_CASE */
@ -3393,6 +3397,7 @@ void cipher_encrypt( int alg_arg, int key_type_arg,
} }
exit: exit:
psa_cipher_abort( &operation );
mbedtls_free( output ); mbedtls_free( output );
psa_destroy_key( handle ); psa_destroy_key( handle );
PSA_DONE( ); PSA_DONE( );
@ -3461,6 +3466,7 @@ void cipher_encrypt_multipart( int alg_arg, int key_type_arg,
output, total_output_length ); output, total_output_length );
exit: exit:
psa_cipher_abort( &operation );
mbedtls_free( output ); mbedtls_free( output );
psa_destroy_key( handle ); psa_destroy_key( handle );
PSA_DONE( ); PSA_DONE( );
@ -3532,6 +3538,7 @@ void cipher_decrypt_multipart( int alg_arg, int key_type_arg,
output, total_output_length ); output, total_output_length );
exit: exit:
psa_cipher_abort( &operation );
mbedtls_free( output ); mbedtls_free( output );
psa_destroy_key( handle ); psa_destroy_key( handle );
PSA_DONE( ); PSA_DONE( );
@ -3593,6 +3600,7 @@ void cipher_decrypt( int alg_arg, int key_type_arg,
} }
exit: exit:
psa_cipher_abort( &operation );
mbedtls_free( output ); mbedtls_free( output );
psa_destroy_key( handle ); psa_destroy_key( handle );
PSA_DONE( ); PSA_DONE( );
@ -3674,6 +3682,8 @@ void cipher_verify_output( int alg_arg, int key_type_arg,
ASSERT_COMPARE( input->x, input->len, output2, output2_length ); ASSERT_COMPARE( input->x, input->len, output2, output2_length );
exit: exit:
psa_cipher_abort( &operation1 );
psa_cipher_abort( &operation2 );
mbedtls_free( output1 ); mbedtls_free( output1 );
mbedtls_free( output2 ); mbedtls_free( output2 );
psa_destroy_key( handle ); psa_destroy_key( handle );
@ -3777,6 +3787,8 @@ void cipher_verify_output_multipart( int alg_arg,
ASSERT_COMPARE( input->x, input->len, output2, output2_length ); ASSERT_COMPARE( input->x, input->len, output2, output2_length );
exit: exit:
psa_cipher_abort( &operation1 );
psa_cipher_abort( &operation2 );
mbedtls_free( output1 ); mbedtls_free( output1 );
mbedtls_free( output2 ); mbedtls_free( output2 );
psa_destroy_key( handle ); psa_destroy_key( handle );