23 #ifndef PSA_CRYPTO_STORAGE_H 24 #define PSA_CRYPTO_STORAGE_H 30 #include "psa/crypto.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 103 const size_t data_length );
131 size_t *data_length );
168 const size_t data_length,
170 uint8_t *storage_data );
190 size_t storage_data_length,
192 size_t *key_data_length,
195 #if defined(MBEDTLS_PSA_CRYPTO_SE_C) 197 #define PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS 200 #if defined(PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS) 208 typedef uint16_t psa_crypto_transaction_type_t;
215 #define PSA_CRYPTO_TRANSACTION_NONE ( (psa_crypto_transaction_type_t) 0x0000 ) 223 #define PSA_CRYPTO_TRANSACTION_CREATE_KEY ( (psa_crypto_transaction_type_t) 0x0001 ) 231 #define PSA_CRYPTO_TRANSACTION_DESTROY_KEY ( (psa_crypto_transaction_type_t) 0x0002 ) 279 struct psa_crypto_transaction_unknown_s
281 psa_crypto_transaction_type_t type;
289 struct psa_crypto_transaction_key_s
291 psa_crypto_transaction_type_t type;
297 } psa_crypto_transaction_t;
301 extern psa_crypto_transaction_t psa_crypto_transaction;
309 static inline void psa_crypto_prepare_transaction(
310 psa_crypto_transaction_type_t type )
312 psa_crypto_transaction.unknown.type = type;
364 #define PSA_CRYPTO_ITS_TRANSACTION_UID ( (psa_key_id_t) 0xffffff74 ) 368 #if defined(MBEDTLS_PSA_INJECT_ENTROPY) 380 psa_status_t mbedtls_psa_storage_inject_entropy(
const unsigned char *seed,
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.
uint32_t psa_key_id_t
Encoding of identifiers of 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 ...
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_destroy_persistent_key(const psa_key_file_id_t key)
Remove persistent data for the 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().
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.
PSA external cryptoprocessor driver module.
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.
uint32_t psa_key_lifetime_t
Encoding of key lifetimes.
int32_t psa_status_t
Function return status.
int psa_is_key_present_in_storage(const psa_key_file_id_t key)
Checks if persistent data is stored for the given key slot number.