23#ifndef PSA_CRYPTO_STORAGE_H
24#define PSA_CRYPTO_STORAGE_H
38#define PSA_CRYPTO_MAX_STORAGE_SIZE ( PSA_BITS_TO_BYTES( PSA_MAX_KEY_BITS ) )
41#if PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000
42#error PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000
60#define PSA_MAX_PERSISTENT_KEY_IDENTIFIER PSA_KEY_ID_VENDOR_MAX
104 const size_t data_length );
132 size_t *data_length );
169 const size_t data_length,
171 uint8_t *storage_data );
191 size_t storage_data_length,
193 size_t *key_data_length,
196#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
198#define PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS
201#if defined(PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS)
209typedef uint16_t psa_crypto_transaction_type_t;
216#define PSA_CRYPTO_TRANSACTION_NONE ( (psa_crypto_transaction_type_t) 0x0000 )
224#define PSA_CRYPTO_TRANSACTION_CREATE_KEY ( (psa_crypto_transaction_type_t) 0x0001 )
232#define PSA_CRYPTO_TRANSACTION_DESTROY_KEY ( (psa_crypto_transaction_type_t) 0x0002 )
280 struct psa_crypto_transaction_unknown_s
282 psa_crypto_transaction_type_t type;
290 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;
365#define PSA_CRYPTO_ITS_TRANSACTION_UID ( (psa_key_id_t) 0xffffff74 )
369#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
381psa_status_t mbedtls_psa_storage_inject_entropy(
const unsigned char *seed,
Platform Security Architecture cryptography module.
PSA external cryptoprocessor driver module.
int32_t psa_status_t
Function return status.
uint32_t psa_key_lifetime_t
Encoding of key lifetimes.
psa_key_id_t mbedtls_svc_key_id_t
Identifier for persistent keys.
uint64_t psa_key_slot_number_t
An internal designation of a key slot between the core part of the PSA Crypto implementation and the ...
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_save_persistent_key(const psa_core_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.
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.
void psa_format_key_data_for_storage(const uint8_t *data, const size_t data_length, const psa_core_key_attributes_t *attr, uint8_t *storage_data)
Formats key data and metadata for persistent storage.
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_core_key_attributes_t *attr)
Parses persistent storage data into key data and metadata.
psa_status_t psa_load_persistent_key(psa_core_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.
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().