Only set slot to OCCUPIED on successful key loading
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
This commit is contained in:
parent
34d6a5c3df
commit
975d411d92
2 changed files with 7 additions and 2 deletions
|
@ -1786,7 +1786,6 @@ static psa_status_t psa_start_key_creation(
|
|||
* definition. */
|
||||
|
||||
slot->attr = attributes->core;
|
||||
slot->status = PSA_SLOT_OCCUPIED;
|
||||
if (PSA_KEY_LIFETIME_IS_VOLATILE(slot->attr.lifetime)) {
|
||||
#if !defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
|
||||
slot->attr.id = volatile_key_id;
|
||||
|
@ -1850,6 +1849,8 @@ static psa_status_t psa_start_key_creation(
|
|||
}
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
|
||||
|
||||
slot->status = PSA_SLOT_OCCUPIED;
|
||||
|
||||
return PSA_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -221,7 +221,6 @@ static psa_status_t psa_load_persistent_key_into_slot(psa_key_slot_t *slot)
|
|||
if (status != PSA_SUCCESS) {
|
||||
goto exit;
|
||||
}
|
||||
slot->status = PSA_SLOT_OCCUPIED;
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
|
||||
/* Special handling is required for loading keys associated with a
|
||||
|
@ -243,6 +242,11 @@ static psa_status_t psa_load_persistent_key_into_slot(psa_key_slot_t *slot)
|
|||
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
|
||||
|
||||
status = psa_copy_key_material_into_slot(slot, key_data, key_data_length);
|
||||
if (status != PSA_SUCCESS){
|
||||
goto exit;
|
||||
}
|
||||
|
||||
slot->status = PSA_SLOT_OCCUPIED;
|
||||
|
||||
exit:
|
||||
psa_free_persistent_key_data(key_data, key_data_length);
|
||||
|
|
Loading…
Reference in a new issue