Data Structures | Macros | Functions | Variables
CryptoKeyKeyStore_PSA_helpers.h File Reference

Detailed Description

CryptoKeyKeyStore driver header.


Overview

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>
Include dependency graph for CryptoKeyKeyStore_PSA_helpers.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
 

Macro Definition Documentation

§ FLETCHER_CHECKSUM_ALGORITHM

#define FLETCHER_CHECKSUM_ALGORITHM   32 /* FLETCHER-32 */

Function Documentation

§ KeyStore_PSA_getKey()

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.

Parameters
[in]keyThe key ID for the key in keystore.
[out]dataOn success, the buffer contains the plaintext key
[in]dataSizeSize of the data buffer in bytes. It must be greater than or equal to the plaintext key material
[out]dataLengthSize of the returned key material in bytes.
[in]algAlgorithm the key will be used for, it should match the orignal alg used to import the key.
[in]usageKey usage, it must match the original usage used to import the key.
Return values
KEYSTORE_PSA_STATUS_SUCCESSSuccess. 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_IDThe key identifier does not exist.
KEYSTORE_PSA_STATUS_NOT_PERMITTEDThe key does not have matching alg and usage
KEYSTORE_PSA_STATUS_BAD_STATEThe library has not been previously initialized by KeyStore_PSA_init(). It is implementation-dependent whether a failure to initialize results in this error code.

§ KeyStore_PSA_init()

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.

Return values
KEYSTORE_PSA_STATUS_SUCCESSSuccess.
KEYSTORE_PSA_STATUS_GENERIC_ERRORtfm_its_init() failed
KEYSTORE_PSA_STATUS_DOES_NOT_EXISTKeyStore_PSA_getPreProvisionedKeyIDs() failed

Variable Documentation

§ KeyStore_semaphoreObject

KeyStore_accessSemaphoreObject KeyStore_semaphoreObject
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale