Make psa_close_key(0) and psa_destroy_key(0) succeed

This commit is contained in:
Gilles Peskine 2019-10-08 15:48:25 +02:00
parent f102e4e4f6
commit 1841cf43ee
2 changed files with 6 additions and 0 deletions

View file

@ -1013,6 +1013,9 @@ psa_status_t psa_destroy_key( psa_key_handle_t handle )
psa_se_drv_table_entry_t *driver; psa_se_drv_table_entry_t *driver;
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */ #endif /* MBEDTLS_PSA_CRYPTO_SE_C */
if( handle == 0 )
return( PSA_SUCCESS );
status = psa_get_key_slot( handle, &slot ); status = psa_get_key_slot( handle, &slot );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( status ); return( status );

View file

@ -255,6 +255,9 @@ psa_status_t psa_close_key( psa_key_handle_t handle )
psa_status_t status; psa_status_t status;
psa_key_slot_t *slot; psa_key_slot_t *slot;
if( handle == 0 )
return( PSA_SUCCESS );
status = psa_get_key_slot( handle, &slot ); status = psa_get_key_slot( handle, &slot );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( status ); return( status );