Prepare a key slot to receive key material. This function allocates a key slot and sets its metadata. If this function fails, call psa_fail_key_creation(). This function is intended to be used as follows: -# Call psa_start_key_creation() to allocate a key slot, prepare it with the specified attributes, and in case of a volatile key assign it a volatile key identifier. -# Populate the slot with the key material. -# Call psa_finish_key_creation() to finalize the creation of the slot. In case of failure at any step, stop the sequence and call psa_fail_key_creation(). 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.
Finalize the creation of a key once its key material has been set. This entails writing the key to persistent storage. If this function fails, call psa_fail_key_creation(). See the documentation of psa_start_key_creation() for the intended use of this function. If the finalization succeeds, the function sets the key slot's state to PSA_SLOT_FULL, and the key slot can no longer be accessed as part of the key creation process.
Abort the creation of a key. You may call this function after calling psa_start_key_creation(), or after psa_finish_key_creation() fails. In other circumstances, this function may not clean up persistent storage. See the documentation of psa_start_key_creation() for the intended use of this function. Sets the slot's state to PSA_SLOT_EMPTY.
Validate a key's location. This function checks whether the key's attributes point to a location that is known to the PSA Core, and returns the driver function table if the key is to be found in an external location.
Validate the internal consistency of key attributes. This function only rejects invalid attribute values. If does not validate the consistency of the attributes with any key data that may be involved in the creation of the key. Call this function early in the key creation process.
Find a free slot for a key that is to be created. This function calls the relevant method in the driver to find a suitable slot for a key with the given attributes.