From 39309979220294af8f534c2231676cf1dc62ad52 Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Tue, 20 Oct 2020 17:01:35 +0200 Subject: [PATCH] tests: slot mgmt: Add purge checks in volatile key lifecycle test Signed-off-by: Ronald Cron --- .../test_suite_psa_crypto_slot_management.function | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/suites/test_suite_psa_crypto_slot_management.function b/tests/suites/test_suite_psa_crypto_slot_management.function index 2f9d01b37..9fc2eac6d 100644 --- a/tests/suites/test_suite_psa_crypto_slot_management.function +++ b/tests/suites/test_suite_psa_crypto_slot_management.function @@ -157,6 +157,16 @@ void transient_slot_lifecycle( int usage_arg, int alg_arg, TEST_ASSERT( ! mbedtls_svc_key_id_is_null( key ) ); PSA_ASSERT( psa_get_key_attributes( key, &attributes ) ); 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. */ if( ! invalidate_key( close_method, key ) )