25 #ifndef PSA_CRYPTO_STORAGE_H 26 #define PSA_CRYPTO_STORAGE_H 32 #include "psa/crypto.h" 40 #define PSA_CRYPTO_MAX_STORAGE_SIZE ( PSA_BITS_TO_BYTES( PSA_MAX_KEY_BITS ) ) 43 #if PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000 44 #error PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000 62 #define PSA_MAX_PERSISTENT_KEY_IDENTIFIER PSA_KEY_ID_VENDOR_MAX 105 const size_t data_length );
133 size_t *data_length );
170 const size_t data_length,
172 uint8_t *storage_data );
192 size_t storage_data_length,
194 size_t *key_data_length,
197 #if defined(MBEDTLS_PSA_CRYPTO_SE_C) 199 #define PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS 202 #if defined(PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS) 210 typedef uint16_t psa_crypto_transaction_type_t;
217 #define PSA_CRYPTO_TRANSACTION_NONE ( (psa_crypto_transaction_type_t) 0x0000 ) 225 #define PSA_CRYPTO_TRANSACTION_CREATE_KEY ( (psa_crypto_transaction_type_t) 0x0001 ) 233 #define PSA_CRYPTO_TRANSACTION_DESTROY_KEY ( (psa_crypto_transaction_type_t) 0x0002 ) 281 struct psa_crypto_transaction_unknown_s
283 psa_crypto_transaction_type_t type;
291 struct psa_crypto_transaction_key_s
293 psa_crypto_transaction_type_t type;
299 } psa_crypto_transaction_t;
303 extern psa_crypto_transaction_t psa_crypto_transaction;
311 static inline void psa_crypto_prepare_transaction(
312 psa_crypto_transaction_type_t type )
314 psa_crypto_transaction.unknown.type = type;
366 #define PSA_CRYPTO_ITS_TRANSACTION_UID ( (psa_key_id_t) 0xffffff74 ) 370 #if defined(MBEDTLS_PSA_INJECT_ENTROPY) 382 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.