From 513451987d409673f0b2f4a6a96af8aa932f1fbe Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Fri, 16 Oct 2020 16:07:03 +0200 Subject: [PATCH] Fix close/purge of a key In case of persistent keys, do not load the key in a slot before to close/purge it. Signed-off-by: Ronald Cron --- library/psa_crypto_slot_management.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/psa_crypto_slot_management.c b/library/psa_crypto_slot_management.c index 33149f059a..b6f76ad26c 100644 --- a/library/psa_crypto_slot_management.c +++ b/library/psa_crypto_slot_management.c @@ -332,7 +332,7 @@ psa_status_t psa_close_key( psa_key_handle_t handle ) if( psa_key_handle_is_null( handle ) ) return( PSA_SUCCESS ); - status = psa_get_key_slot( handle, &slot ); + status = psa_search_key_in_slots( handle, &slot ); if( status != PSA_SUCCESS ) return( status ); @@ -344,7 +344,7 @@ psa_status_t psa_purge_key( mbedtls_svc_key_id_t key ) psa_status_t status; psa_key_slot_t *slot; - status = psa_get_key_slot( key, &slot ); + status = psa_search_key_in_slots( key, &slot ); if( status != PSA_SUCCESS ) return( status );