psa_key_slot_is_external exists. Use it.

This commit is contained in:
Gilles Peskine 2019-07-25 11:31:23 +02:00
parent 6a3dd89a64
commit adad813d7b

View File

@ -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 );