11#ifndef PSA_CRYPTO_STORAGE_H
12#define PSA_CRYPTO_STORAGE_H
25#if defined(MBEDTLS_PSA_STATIC_KEY_SLOTS)
27#define PSA_CRYPTO_MAX_STORAGE_SIZE (MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE)
31#define PSA_CRYPTO_MAX_STORAGE_SIZE (PSA_BITS_TO_BYTES(PSA_MAX_KEY_BITS))
36#if PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000
37#error "PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000"
55#define PSA_MAX_PERSISTENT_KEY_IDENTIFIER PSA_KEY_ID_VENDOR_MAX
105 const size_t data_length);
135 size_t *data_length);
172 const size_t data_length,
193 size_t storage_data_length,
195 size_t *key_data_length,
198#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
200#define PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS 1
203#if defined(PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS)
211typedef uint16_t psa_crypto_transaction_type_t;
218#define PSA_CRYPTO_TRANSACTION_NONE ((psa_crypto_transaction_type_t) 0x0000)
226#define PSA_CRYPTO_TRANSACTION_CREATE_KEY ((psa_crypto_transaction_type_t) 0x0001)
234#define PSA_CRYPTO_TRANSACTION_DESTROY_KEY ((psa_crypto_transaction_type_t) 0x0002)
282 struct psa_crypto_transaction_unknown_s {
283 psa_crypto_transaction_type_t type;
291 struct psa_crypto_transaction_key_s {
292 psa_crypto_transaction_type_t type;
298} psa_crypto_transaction_t;
302extern psa_crypto_transaction_t psa_crypto_transaction;
310static inline void psa_crypto_prepare_transaction(
311 psa_crypto_transaction_type_t type)
313 psa_crypto_transaction.unknown.type = type;
368#define PSA_CRYPTO_ITS_TRANSACTION_UID ((psa_key_id_t) 0xffffff74)
372#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
384psa_status_t mbedtls_psa_storage_inject_entropy(
const unsigned char *seed,
Platform Security Architecture cryptography module.
unsigned int uint32_t
Definition acefiex.h:163
unsigned char uint8_t
Definition acefiex.h:161
COMPILER_DEPENDENT_UINT64 uint64_t
Definition acefiex.h:165
unsigned short int uint16_t
Definition acefiex.h:162
PSA external cryptoprocessor driver module.
int32_t psa_status_t
Function return status.
Definition crypto_types.h:59
uint32_t psa_key_lifetime_t
Definition crypto_types.h:183
psa_key_id_t mbedtls_svc_key_id_t
Definition crypto_types.h:292
uint64_t psa_key_slot_number_t
Definition crypto_se_driver.h:137
void * data
Definition kthread.h:30
psa_status_t psa_destroy_persistent_key(const mbedtls_svc_key_id_t key)
Remove persistent data for the given key slot number.
psa_status_t psa_load_persistent_key(psa_key_attributes_t *attr, uint8_t **data, size_t *data_length)
Parses key data and metadata and load persistent key for given key slot number.
psa_status_t psa_save_persistent_key(const psa_key_attributes_t *attr, const uint8_t *data, const size_t data_length)
Format key data and metadata and save to a location for given key slot.
void psa_format_key_data_for_storage(const uint8_t *data, const size_t data_length, const psa_key_attributes_t *attr, uint8_t *storage_data)
Formats key data and metadata for persistent storage.
int psa_is_key_present_in_storage(const mbedtls_svc_key_id_t key)
Checks if persistent data is stored for the given key slot number.
psa_status_t psa_parse_key_data_from_storage(const uint8_t *storage_data, size_t storage_data_length, uint8_t **key_data, size_t *key_data_length, psa_key_attributes_t *attr)
Parses persistent storage data into key data and metadata.
void psa_free_persistent_key_data(uint8_t *key_data, size_t key_data_length)
Free the temporary buffer allocated by psa_load_persistent_key().
Definition crypto_struct.h:295