mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-07-30 16:26:33 +08:00
psa_crypto_slot_management: check key ID range when loading a persistent key
Do not try to load a persistent key whose key ID is in the volatile range. Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
d80b9ff511
commit
1b93588d93
@ -684,6 +684,12 @@ static psa_status_t psa_load_persistent_key_into_slot(psa_key_slot_t *slot)
|
||||
psa_status_t status = PSA_SUCCESS;
|
||||
uint8_t *key_data = NULL;
|
||||
size_t key_data_length = 0;
|
||||
psa_key_id_t key_id = MBEDTLS_SVC_KEY_ID_GET_KEY_ID(slot->attr.id);
|
||||
|
||||
/* Do not try to load a persistent key whose ID is in the volatile range. */
|
||||
if ((key_id >= PSA_KEY_ID_VOLATILE_MIN) && (key_id <= PSA_KEY_ID_VOLATILE_MAX)) {
|
||||
return PSA_ERROR_DOES_NOT_EXIST;
|
||||
}
|
||||
|
||||
status = psa_load_persistent_key(&slot->attr,
|
||||
&key_data, &key_data_length);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user