1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

SE key registration: call p_validate_slot_number

When registering a key in a secure element, if the driver has a
p_validate_slot_number method, call it.
This commit is contained in:
Gilles Peskine
2019-08-05 16:46:18 +02:00
parent d772958ffc
commit a5f8749812
2 changed files with 36 additions and 1 deletions

View File

@ -1902,6 +1902,21 @@ psa_status_t mbedtls_psa_register_se_key(
goto exit;
}
/* If the driver has a slot number validation method, call it.
* If it doesn't, it means the secure element is unable to validate
* anything and so we have to trust the application. */
if( drv->key_management != NULL &&
drv->key_management->p_validate_slot_number != NULL )
{
status = drv->key_management->p_validate_slot_number(
psa_get_se_driver_context( driver ),
attributes,
PSA_KEY_CREATION_REGISTER,
slot->data.se.slot_number );
if( status != PSA_SUCCESS )
goto exit;
}
status = psa_finish_key_creation( slot, driver );
exit: