diff --git a/programs/psa/aead_cipher_psa.c b/programs/psa/aead_cipher_psa.c index a2b47d13d..bac3ea27d 100644 --- a/programs/psa/aead_cipher_psa.c +++ b/programs/psa/aead_cipher_psa.c @@ -311,7 +311,10 @@ static int aead_encrypt( psa_key_id_t key, psa_algorithm_t alg, olen = p - out; print_out( "aead ", out, olen ); + exit: + /* required on errors, harmless on success */ + psa_aead_abort( &op ); return( status ); } @@ -336,6 +339,8 @@ static psa_status_t aead( const char *info ) msg2_part2, sizeof( msg2_part2 ) ) ); exit: + psa_destroy_key( key ); + return( status ); } diff --git a/programs/psa/hmac_md_psa.c b/programs/psa/hmac_md_psa.c index 003fb5c7d..49e1eced7 100644 --- a/programs/psa/hmac_md_psa.c +++ b/programs/psa/hmac_md_psa.c @@ -150,6 +150,7 @@ psa_status_t mac(void) exit: psa_mac_abort( &op ); + psa_destroy_key( key ); return( status ); }