Skip to content

Commit da73da0

Browse files
Rename psa_internal_allocate_key_slot to psa_get_empty_key_slot
This function no longer modifies anything, so it doesn't actually allocate the slot. Now, it just returns the empty key slot, and it's up to the caller to cause the slot to be in use (or not).
1 parent 135129a commit da73da0

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

library/psa_crypto.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,7 @@ static psa_status_t psa_start_key_creation(
15451545
if( status != PSA_SUCCESS )
15461546
return( status );
15471547

1548-
status = psa_internal_allocate_key_slot( handle, p_slot );
1548+
status = psa_get_empty_key_slot( handle, p_slot );
15491549
if( status != PSA_SUCCESS )
15501550
return( status );
15511551
slot = *p_slot;
@@ -1561,7 +1561,7 @@ static psa_status_t psa_start_key_creation(
15611561
/* Erase external-only flags from the internal copy. To access
15621562
* external-only flags, query `attributes`. Thanks to the check
15631563
* in psa_validate_key_attributes(), this leaves the dual-use
1564-
* flags and any internal flag that psa_internal_allocate_key_slot()
1564+
* flags and any internal flag that psa_get_empty_key_slot()
15651565
* may have set. */
15661566
slot->attr.flags &= ~MBEDTLS_PSA_KA_MASK_EXTERNAL_ONLY;
15671567

library/psa_crypto_slot_management.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void psa_wipe_all_key_slots( void )
102102
global_data.key_slots_initialized = 0;
103103
}
104104

105-
psa_status_t psa_internal_allocate_key_slot( psa_key_handle_t *handle,
105+
psa_status_t psa_get_empty_key_slot( psa_key_handle_t *handle,
106106
psa_key_slot_t **p_slot )
107107
{
108108
if( ! global_data.key_slots_initialized )
@@ -228,7 +228,7 @@ psa_status_t psa_open_key( psa_key_file_id_t id, psa_key_handle_t *handle )
228228
if( status != PSA_SUCCESS )
229229
return( status );
230230

231-
status = psa_internal_allocate_key_slot( handle, &slot );
231+
status = psa_get_empty_key_slot( handle, &slot );
232232
if( status != PSA_SUCCESS )
233233
return( status );
234234

library/psa_crypto_slot_management.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ void psa_wipe_all_key_slots( void );
7171
* \retval #PSA_ERROR_INSUFFICIENT_MEMORY
7272
* \retval #PSA_ERROR_BAD_STATE
7373
*/
74-
psa_status_t psa_internal_allocate_key_slot( psa_key_handle_t *handle,
75-
psa_key_slot_t **p_slot );
74+
psa_status_t psa_get_empty_key_slot( psa_key_handle_t *handle,
75+
psa_key_slot_t **p_slot );
7676

7777
/** Test whether a lifetime designates a key in an external cryptoprocessor.
7878
*

0 commit comments

Comments
 (0)