Mbed OS Reference
|
PSA cryptography module: Backward compatibility aliases. More...
Go to the source code of this file.
Macros | |
#define | PSA_ERROR_UNKNOWN_ERROR MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_GENERIC_ERROR ) |
#define | PSA_ERROR_OCCUPIED_SLOT MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_ALREADY_EXISTS ) |
#define | PSA_ERROR_EMPTY_SLOT MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_DOES_NOT_EXIST ) |
#define | PSA_ERROR_INSUFFICIENT_CAPACITY MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_INSUFFICIENT_DATA ) |
#define | PSA_ERROR_TAMPERING_DETECTED MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_CORRUPTION_DETECTED ) |
Functions | |
psa_status_t | psa_open_key (mbedtls_svc_key_id_t key, psa_key_handle_t *handle) |
Open a handle to an existing persistent key. More... | |
psa_status_t | psa_close_key (psa_key_handle_t handle) |
Close a key handle. More... | |
PSA cryptography module: Backward compatibility aliases.
This header declares alternative names for macro and functions. New application code should not use these names. These names may be removed in a future version of Mbed Crypto.
Definition in file crypto_compat.h.
#define PSA_ERROR_UNKNOWN_ERROR MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_GENERIC_ERROR ) |
Definition at line 90 of file crypto_compat.h.
#define PSA_ERROR_OCCUPIED_SLOT MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_ALREADY_EXISTS ) |
Definition at line 95 of file crypto_compat.h.
#define PSA_ERROR_EMPTY_SLOT MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_DOES_NOT_EXIST ) |
Definition at line 100 of file crypto_compat.h.
#define PSA_ERROR_INSUFFICIENT_CAPACITY MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_INSUFFICIENT_DATA ) |
Definition at line 105 of file crypto_compat.h.
#define PSA_ERROR_TAMPERING_DETECTED MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_CORRUPTION_DETECTED ) |
Definition at line 110 of file crypto_compat.h.
psa_status_t psa_open_key | ( | mbedtls_svc_key_id_t | key, |
psa_key_handle_t * | handle | ||
) |
Open a handle to an existing persistent key.
Open a handle to a persistent key. A key is persistent if it was created with a lifetime other than PSA_KEY_LIFETIME_VOLATILE. A persistent key always has a nonzero key identifier, set with psa_set_key_id() when creating the key. Implementations may provide additional pre-provisioned keys that can be opened with psa_open_key(). Such keys have an application key identifier in the vendor range, as documented in the description of psa_key_id_t.
The application must eventually close the handle with psa_close_key() or psa_destroy_key() to release associated resources. If the application dies without calling one of these functions, the implementation should perform the equivalent of a call to psa_close_key().
Some implementations permit an application to open the same key multiple times. If this is successful, each call to psa_open_key() will return a different key handle.
key | The persistent identifier of the key. | |
[out] | handle | On success, a handle to the key. |
PSA_SUCCESS | Success. The application can now use the value of *handle to access the key. |
PSA_ERROR_INSUFFICIENT_MEMORY | The implementation does not have sufficient resources to open the key. This can be due to reaching an implementation limit on the number of open keys, the number of open key handles, or available memory. |
PSA_ERROR_DOES_NOT_EXIST | There is no persistent key with key identifier id . |
PSA_ERROR_INVALID_ARGUMENT | id is not a valid persistent key identifier. |
PSA_ERROR_NOT_PERMITTED | The specified key exists, but the application does not have the permission to access it. Note that this specification does not define any way to create such a key, but it may be possible through implementation-specific means. |
PSA_ERROR_COMMUNICATION_FAILURE | |
PSA_ERROR_CORRUPTION_DETECTED | |
PSA_ERROR_STORAGE_FAILURE | |
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. |
psa_status_t psa_close_key | ( | psa_key_handle_t | handle | ) |
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.
handle | The key handle to close. If this is 0 , do nothing and return PSA_SUCCESS . |
PSA_SUCCESS | handle was a valid handle or 0 . It is now closed. |
PSA_ERROR_INVALID_HANDLE | handle is not a valid handle nor 0 . |
PSA_ERROR_COMMUNICATION_FAILURE | |
PSA_ERROR_CORRUPTION_DETECTED | |
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. |