From d69f4017fbf949ab3aceca178b034b73e6e43dbc Mon Sep 17 00:00:00 2001 From: Ryan Everett Date: Thu, 23 Nov 2023 16:20:45 +0000 Subject: [PATCH] Refactor `psa_load_persistent_key_into_slot` to remove bad `goto` Merges the two calls to `psa_copy_key_material_into_slot. Signed-off-by: Ryan Everett --- library/psa_crypto_slot_management.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/library/psa_crypto_slot_management.c b/library/psa_crypto_slot_management.c index 5ecc3a76c..027800984 100644 --- a/library/psa_crypto_slot_management.c +++ b/library/psa_crypto_slot_management.c @@ -234,14 +234,10 @@ static psa_status_t psa_load_persistent_key_into_slot(psa_key_slot_t *slot) status = PSA_ERROR_DATA_INVALID; goto exit; } - data = (psa_se_key_data_storage_t *) key_data; - status = psa_copy_key_material_into_slot( - slot, data->slot_number, sizeof(data->slot_number)); - if (status == PSA_SUCCESS) { - slot->status = PSA_SLOT_OCCUPIED; - } - goto exit; + data = (psa_se_key_data_storage_t *) key_data; + key_data = data->slot_number; + key_data_length = sizeof(key_data); } #endif /* MBEDTLS_PSA_CRYPTO_SE_C */