From adad813d7b5b780c59c5049b97e4cffdf26a578c Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 25 Jul 2019 11:31:23 +0200 Subject: [PATCH] psa_key_slot_is_external exists. Use it. --- library/psa_crypto.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 8595a0f9a..92364ca4c 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -888,10 +888,7 @@ static psa_status_t psa_get_transparent_key( psa_key_handle_t handle, psa_status_t status = psa_get_key_from_slot( handle, p_slot, usage, alg ); if( status != PSA_SUCCESS ) return( status ); - /* Use a simple, cheap test to check whether the key is transparent. - * This check assumes that there are no persistent lifetimes other than - * PSA_KEY_LIFETIME_PERSISTENT. */ - if( ( *p_slot )->lifetime > PSA_KEY_LIFETIME_PERSISTENT ) + if( psa_key_slot_is_external( *p_slot ) ) { *p_slot = NULL; return( PSA_ERROR_NOT_SUPPORTED );