Add volatile key identifiers
Volatile key identifiers are introduced in
PSA Crypto API v1.0.0. They are returned by the APIs
when importing or generating or deriving a volatile key.
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/library/psa_crypto_slot_management.c b/library/psa_crypto_slot_management.c
index 4f651d9..43282b4 100644
--- a/library/psa_crypto_slot_management.c
+++ b/library/psa_crypto_slot_management.c
@@ -114,7 +114,8 @@
}
psa_status_t psa_get_empty_key_slot( psa_key_handle_t *handle,
- psa_key_slot_t **p_slot )
+ psa_key_id_t *volatile_key_id,
+ psa_key_slot_t **p_slot )
{
if( ! global_data.key_slots_initialized )
return( PSA_ERROR_BAD_STATE );
@@ -123,7 +124,11 @@
{
*p_slot = &global_data.key_slots[*handle - 1];
if( ! psa_is_key_slot_occupied( *p_slot ) )
+ {
+ *volatile_key_id = PSA_KEY_ID_VOLATILE_MIN + ( *handle ) - 1;
+
return( PSA_SUCCESS );
+ }
}
*p_slot = NULL;
return( PSA_ERROR_INSUFFICIENT_MEMORY );
@@ -215,6 +220,7 @@
{
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C)
psa_status_t status;
+ psa_key_id_t volatile_key_id;
psa_key_slot_t *slot;
*handle = 0;
@@ -223,7 +229,7 @@
if( status != PSA_SUCCESS )
return( status );
- status = psa_get_empty_key_slot( handle, &slot );
+ status = psa_get_empty_key_slot( handle, &volatile_key_id, &slot );
if( status != PSA_SUCCESS )
return( status );