tests: slot mgmt: Add purge checks in volatile key lifecycle test

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2020-10-20 17:01:35 +02:00
parent 5425a21fd2
commit 3930997922

View File

@ -157,6 +157,16 @@ void transient_slot_lifecycle( int usage_arg, int alg_arg,
TEST_ASSERT( ! mbedtls_svc_key_id_is_null( key ) ); TEST_ASSERT( ! mbedtls_svc_key_id_is_null( key ) );
PSA_ASSERT( psa_get_key_attributes( key, &attributes ) ); PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
TEST_EQUAL( psa_get_key_type( &attributes ), type ); TEST_EQUAL( psa_get_key_type( &attributes ), type );
psa_reset_key_attributes( &attributes );
/*
* Purge the key and make sure that it is still valid, as purging a
* volatile key shouldn't invalidate/destroy it.
*/
PSA_ASSERT( psa_purge_key( key ) );
PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
TEST_EQUAL( psa_get_key_type( &attributes ), type );
psa_reset_key_attributes( &attributes );
/* Do something that invalidates the key. */ /* Do something that invalidates the key. */
if( ! invalidate_key( close_method, key ) ) if( ! invalidate_key( close_method, key ) )