psa_reserve_free_key_slot() function
Find a free key slot and reserve it to be filled with a key. This function finds a key slot that is free, sets its state to PSA_SLOT_FILLING and then returns the slot. On success, the key slot's state is PSA_SLOT_FILLING. It is the responsibility of the caller to change the slot's state to PSA_SLOT_EMPTY/FULL once key creation has finished. If multi-threading is enabled, the caller must hold the global key slot mutex.
Arguments
volatile_key_id
- If null, reserve a cache slot for a persistent or built-in key. - If non-null, allocate a slot for a volatile key. On success, \p *volatile_key_id is the identifier corresponding to the returned slot. It is the caller's responsibility to set this key identifier in the attributes.
p_slot
On success, a pointer to the slot.
Return value
#PSA_SUCCESS \emptydescription #PSA_ERROR_INSUFFICIENT_MEMORY There were no free key slots. When #MBEDTLS_PSA_KEY_STORE_DYNAMIC is enabled, there was not enough memory to allocate more slots. #PSA_ERROR_BAD_STATE \emptydescription #PSA_ERROR_CORRUPTION_DETECTED This function attempted to operate on a key slot which was in an unexpected state.