CryptoKeyKeyStore driver header.
The CryptoKeyKeyStore driver provides API to initialize keys and get plaintext keys from KeyStore. This file provides definitions that are only available to the the secure side, in both TF-M disabled and TF-M enabled environments.
#include <stddef.h>
#include <stdint.h>
#include <ti/drivers/cryptoutils/cryptokey/CryptoKeyKeyStore_PSA.h>
#include <ti/drivers/dpl/SemaphoreP.h>
#include <third_party/mbedcrypto/library/psa_crypto_core.h>
#include <third_party/mbedcrypto/library/psa_crypto_slot_management.h>
#include <third_party/mbedcrypto/library/psa_crypto_storage.h>
Go to the source code of this file.
Data Structures | |
struct | KeyStore_accessSemaphoreObject |
Macros | |
#define | FLETCHER_CHECKSUM_ALGORITHM 32 /* FLETCHER-32 */ |
Functions | |
int_fast16_t | KeyStore_PSA_getKey (KeyStore_PSA_KeyFileId key, uint8_t *data, size_t dataSize, size_t *dataLength, KeyStore_PSA_Algorithm alg, KeyStore_PSA_KeyUsage usage) |
Get the plaintext key in binary format. More... | |
int_fast16_t | KeyStore_PSA_init (void) |
Initialize the Key Store. More... | |
Variables | |
KeyStore_accessSemaphoreObject | KeyStore_semaphoreObject |
#define FLETCHER_CHECKSUM_ALGORITHM 32 /* FLETCHER-32 */ |
int_fast16_t KeyStore_PSA_getKey | ( | KeyStore_PSA_KeyFileId | key, |
uint8_t * | data, | ||
size_t | dataSize, | ||
size_t * | dataLength, | ||
KeyStore_PSA_Algorithm | alg, | ||
KeyStore_PSA_KeyUsage | usage | ||
) |
Get the plaintext key in binary format.
This function can only be called on secure side of SPM. It is used by SL crypto drivers to obtain plaintext keys, using keyIDs provided by non-secure application, which will be loaded onto crypto engine
Implementations must reject an attempt to import a certificate of size 0.
[in] | key | The key ID for the key in keystore. |
[out] | data | On success, the buffer contains the plaintext key |
[in] | dataSize | Size of the data buffer in bytes. It must be greater than or equal to the plaintext key material |
[out] | dataLength | Size of the returned key material in bytes. |
[in] | alg | Algorithm the key will be used for, it should match the orignal alg used to import the key. |
[in] | usage | Key usage, it must match the original usage used to import the key. |
KEYSTORE_PSA_STATUS_SUCCESS | Success. If the key ID exists, matches the alg and usage , and the dataSize is sufficient the key is returned in data |
KEYSTORE_PSA_STATUS_RESOURCE_UNAVAILABLE | |
KEYSTORE_PSA_STATUS_INVALID_KEY_ID | The key identifier does not exist. |
KEYSTORE_PSA_STATUS_NOT_PERMITTED | The key does not have matching alg and usage |
KEYSTORE_PSA_STATUS_BAD_STATE | The library has not been previously initialized by KeyStore_PSA_init(). It is implementation-dependent whether a failure to initialize results in this error code. |
int_fast16_t KeyStore_PSA_init | ( | void | ) |
Initialize the Key Store.
Applications must call this function before calling any other function in this module. This function will initialize key slot memory and load the key IDs of any preprovisioned keys.
KEYSTORE_PSA_STATUS_SUCCESS | Success. |
KEYSTORE_PSA_STATUS_GENERIC_ERROR | tfm_its_init() failed |
KEYSTORE_PSA_STATUS_DOES_NOT_EXIST | KeyStore_PSA_getPreProvisionedKeyIDs() failed |
KeyStore_accessSemaphoreObject KeyStore_semaphoreObject |