Function esp_idf_sys::psa_close_key
source ยท pub unsafe extern "C" fn psa_close_key(
handle: psa_key_handle_t,
) -> psa_status_t
Expand description
Close a key handle.
If the handle designates a volatile key, this will destroy the key material and free all associated resources, just like psa_destroy_key().
If this is the last open handle to a persistent key, then closing the handle will free all resources associated with the key in volatile memory. The key data in persistent storage is not affected and can be opened again later with a call to psa_open_key().
Closing the key handle makes the handle invalid, and the key handle must not be used again by the application.
\note This API is not part of the PSA Cryptography API Release 1.0.0 specification. It was defined in the 1.0 Beta 3 version of the specification but was removed in the 1.0.0 released version. This API is kept for the time being to not break applications relying on it. It is not deprecated yet but will be in the near future.
\note If the key handle was used to set up an active
:ref:`multipart operation
\param handle The key handle to close. If this is \c 0, do nothing and return \c PSA_SUCCESS.
\retval #PSA_SUCCESS \p handle was a valid handle or \c 0. It is now closed. \retval #PSA_ERROR_INVALID_HANDLE \p handle is not a valid handle nor \c 0. \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription \retval #PSA_ERROR_BAD_STATE The library has not been previously initialized by psa_crypto_init(). It is implementation-dependent whether a failure to initialize results in this error code.