test: pake: fail in case the opaque key is destroyed unexpectedly

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
This commit is contained in:
Valerio Setti 2022-12-13 11:51:32 +01:00
parent 785116a5be
commit d75c5c4405
2 changed files with 14 additions and 2 deletions

View file

@ -3338,8 +3338,14 @@ exit:
psa_key_attributes_t check_attributes = PSA_KEY_ATTRIBUTES_INIT; psa_key_attributes_t check_attributes = PSA_KEY_ATTRIBUTES_INIT;
/* Verify that the key is still valid before destroying it */ /* Verify that the key is still valid before destroying it */
if( psa_get_key_attributes( ecjpake_pw_slot, &check_attributes ) == if( psa_get_key_attributes( ecjpake_pw_slot, &check_attributes ) !=
PSA_SUCCESS ) PSA_SUCCESS )
{
if( ret == 0 )
ret = 1;
mbedtls_printf( "The EC J-PAKE password key has unexpectedly been already destroyed\n" );
}
else
{ {
psa_destroy_key( ecjpake_pw_slot ); psa_destroy_key( ecjpake_pw_slot );
} }

View file

@ -4448,8 +4448,14 @@ exit:
psa_key_attributes_t check_attributes = PSA_KEY_ATTRIBUTES_INIT; psa_key_attributes_t check_attributes = PSA_KEY_ATTRIBUTES_INIT;
/* Verify that the key is still valid before destroying it */ /* Verify that the key is still valid before destroying it */
if( psa_get_key_attributes( ecjpake_pw_slot, &check_attributes ) == if( psa_get_key_attributes( ecjpake_pw_slot, &check_attributes ) !=
PSA_SUCCESS ) PSA_SUCCESS )
{
if( ret == 0 )
ret = 1;
mbedtls_printf( "The EC J-PAKE password key has unexpectedly been already destroyed\n" );
}
else
{ {
psa_destroy_key( ecjpake_pw_slot ); psa_destroy_key( ecjpake_pw_slot );
} }