blob: 809fd722494a5baf581bb6bfda8de8aa5de3cb80 [file] [log] [blame]
Darryl Greendb2b8db2018-06-15 13:06:04 +01001/**
2 * \file psa_crypto_storage.h
3 *
4 * \brief PSA cryptography module: Mbed TLS key storage
5 */
6/*
Bence Szépkúti1e148272020-08-07 13:07:28 +02007 * Copyright The Mbed TLS Contributors
Dave Rodgman16799db2023-11-02 19:47:20 +00008 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Darryl Greendb2b8db2018-06-15 13:06:04 +01009 */
10
11#ifndef PSA_CRYPTO_STORAGE_H
12#define PSA_CRYPTO_STORAGE_H
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
Darryl Greendb2b8db2018-06-15 13:06:04 +010018#include "psa/crypto.h"
Gilles Peskinefc762652019-07-22 19:30:34 +020019#include "psa/crypto_se_driver.h"
Valerio Setti1980bb72024-08-13 14:35:30 +020020#include "psa_crypto_core.h"
Gilles Peskinefc762652019-07-22 19:30:34 +020021
Darryl Greendb2b8db2018-06-15 13:06:04 +010022#include <stdint.h>
Gilles Peskinec8336cb2019-07-22 19:26:12 +020023#include <string.h>
Darryl Greendb2b8db2018-06-15 13:06:04 +010024
Valerio Setti1980bb72024-08-13 14:35:30 +020025/* Limit the maximum key size in storage. */
26#if defined(MBEDTLS_PSA_STATIC_KEY_SLOTS)
27/* Reflect the maximum size for the key buffer. */
28#define PSA_CRYPTO_MAX_STORAGE_SIZE (MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE)
29#else
30/* Just set an upper boundary but it should have no effect since the key size
31 * is limited in memory. */
Gilles Peskine449bd832023-01-11 14:50:10 +010032#define PSA_CRYPTO_MAX_STORAGE_SIZE (PSA_BITS_TO_BYTES(PSA_MAX_KEY_BITS))
Valerio Setti1980bb72024-08-13 14:35:30 +020033#endif
34
Gilles Peskinec744d992019-07-30 17:26:54 +020035/* Sanity check: a file size must fit in 32 bits. Allow a generous
36 * 64kB of metadata. */
37#if PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000
Antonio de Angelis1ee4d122023-08-16 12:26:37 +010038#error "PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000"
Gilles Peskinec744d992019-07-30 17:26:54 +020039#endif
Darryl Greendb2b8db2018-06-15 13:06:04 +010040
Gilles Peskine48868122018-12-10 17:30:29 +010041/** The maximum permitted persistent slot number.
42 *
43 * In Mbed Crypto 0.1.0b:
44 * - Using the file backend, all key ids are ok except 0.
45 * - Using the ITS backend, all key ids are ok except 0xFFFFFF52
46 * (#PSA_CRYPTO_ITS_RANDOM_SEED_UID) for which the file contains the
47 * device's random seed (if this feature is enabled).
Steven Cooreman863470a2021-02-15 14:03:19 +010048 * - Only key ids from 1 to #MBEDTLS_PSA_KEY_SLOT_COUNT are actually used.
Gilles Peskine48868122018-12-10 17:30:29 +010049 *
50 * Since we need to preserve the random seed, avoid using that key slot.
51 * Reserve a whole range of key slots just in case something else comes up.
52 *
53 * This limitation will probably become moot when we implement client
54 * separation for key storage.
55 */
Gilles Peskinef9666592019-05-06 18:56:30 +020056#define PSA_MAX_PERSISTENT_KEY_IDENTIFIER PSA_KEY_ID_VENDOR_MAX
Gilles Peskine48868122018-12-10 17:30:29 +010057
Darryl Greendb2b8db2018-06-15 13:06:04 +010058/**
Gilles Peskine5e80d912019-02-24 17:10:18 +010059 * \brief Checks if persistent data is stored for the given key slot number
60 *
61 * This function checks if any key data or metadata exists for the key slot in
62 * the persistent storage.
63 *
64 * \param key Persistent identifier to check.
65 *
66 * \retval 0
67 * No persistent data present for slot number
68 * \retval 1
69 * Persistent data present for slot number
70 */
Gilles Peskine449bd832023-01-11 14:50:10 +010071int psa_is_key_present_in_storage(const mbedtls_svc_key_id_t key);
Gilles Peskine5e80d912019-02-24 17:10:18 +010072
73/**
Darryl Greendb2b8db2018-06-15 13:06:04 +010074 * \brief Format key data and metadata and save to a location for given key
75 * slot.
76 *
77 * This function formats the key data and metadata and saves it to a
78 * persistent storage backend. The storage location corresponding to the
79 * key slot must be empty, otherwise this function will fail. This function
Steven Cooreman40120f62020-10-29 11:42:22 +010080 * should be called after loading the key into an internal slot to ensure the
Darryl Greendb2b8db2018-06-15 13:06:04 +010081 * persistent key is not saved into a storage location corresponding to an
Steven Cooreman40120f62020-10-29 11:42:22 +010082 * already occupied non-persistent key, as well as ensuring the key data is
83 * validated.
Darryl Greendb2b8db2018-06-15 13:06:04 +010084 *
Steven Cooremand80e8a42021-01-26 12:45:39 +010085 * Note: This function will only succeed for key buffers which are not
86 * empty. If passed a NULL pointer or zero-length, the function will fail
87 * with #PSA_ERROR_INVALID_ARGUMENT.
Darryl Greendb2b8db2018-06-15 13:06:04 +010088 *
Gilles Peskine4ed0e6f2019-07-30 20:22:33 +020089 * \param[in] attr The attributes of the key to save.
Gilles Peskinebfd322f2019-07-23 11:58:03 +020090 * The key identifier field in the attributes
91 * determines the key's location.
92 * \param[in] data Buffer containing the key data.
93 * \param data_length The number of bytes that make up the key data.
Darryl Greendb2b8db2018-06-15 13:06:04 +010094 *
Gilles Peskineed733552023-02-14 19:21:09 +010095 * \retval #PSA_SUCCESS \emptydescription
96 * \retval #PSA_ERROR_INVALID_ARGUMENT \emptydescription
97 * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
98 * \retval #PSA_ERROR_INSUFFICIENT_STORAGE \emptydescription
99 * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription
100 * \retval #PSA_ERROR_ALREADY_EXISTS \emptydescription
101 * \retval #PSA_ERROR_DATA_INVALID \emptydescription
102 * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription
Darryl Greendb2b8db2018-06-15 13:06:04 +0100103 */
Gilles Peskine7fad3ef2024-02-28 01:08:27 +0100104psa_status_t psa_save_persistent_key(const psa_key_attributes_t *attr,
Gilles Peskine449bd832023-01-11 14:50:10 +0100105 const uint8_t *data,
106 const size_t data_length);
Darryl Greendb2b8db2018-06-15 13:06:04 +0100107
108/**
109 * \brief Parses key data and metadata and load persistent key for given
110 * key slot number.
111 *
112 * This function reads from a storage backend, parses the key data and
113 * metadata and writes them to the appropriate output parameters.
114 *
115 * Note: This function allocates a buffer and returns a pointer to it through
Steven Cooreman7dadf142021-01-28 19:46:52 +0100116 * the data parameter. On successful return, the pointer is guaranteed to be
117 * valid and the buffer contains at least one byte of data.
Steven Cooremand80e8a42021-01-26 12:45:39 +0100118 * psa_free_persistent_key_data() must be called on the data buffer
119 * afterwards to zeroize and free this buffer.
Darryl Greendb2b8db2018-06-15 13:06:04 +0100120 *
Gilles Peskine4ed0e6f2019-07-30 20:22:33 +0200121 * \param[in,out] attr On input, the key identifier field identifies
Gilles Peskinebfd322f2019-07-23 11:58:03 +0200122 * the key to load. Other fields are ignored.
123 * On success, the attribute structure contains
124 * the key metadata that was loaded from storage.
Darryl Greendb2b8db2018-06-15 13:06:04 +0100125 * \param[out] data Pointer to an allocated key data buffer on return.
126 * \param[out] data_length The number of bytes that make up the key data.
127 *
Gilles Peskineed733552023-02-14 19:21:09 +0100128 * \retval #PSA_SUCCESS \emptydescription
129 * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
130 * \retval #PSA_ERROR_DATA_INVALID \emptydescription
131 * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription
132 * \retval #PSA_ERROR_DOES_NOT_EXIST \emptydescription
Darryl Greendb2b8db2018-06-15 13:06:04 +0100133 */
Gilles Peskine7fad3ef2024-02-28 01:08:27 +0100134psa_status_t psa_load_persistent_key(psa_key_attributes_t *attr,
Gilles Peskine449bd832023-01-11 14:50:10 +0100135 uint8_t **data,
136 size_t *data_length);
Darryl Greendb2b8db2018-06-15 13:06:04 +0100137
138/**
139 * \brief Remove persistent data for the given key slot number.
140 *
Gilles Peskine8d4919b2018-12-03 16:48:09 +0100141 * \param key Persistent identifier of the key to remove
Darryl Greendb2b8db2018-06-15 13:06:04 +0100142 * from persistent storage.
143 *
Ronald Cron96783552020-10-19 12:06:30 +0200144 * \retval #PSA_SUCCESS
Gilles Peskine8d4919b2018-12-03 16:48:09 +0100145 * The key was successfully removed,
146 * or the key did not exist.
Gilles Peskineed733552023-02-14 19:21:09 +0100147 * \retval #PSA_ERROR_DATA_INVALID \emptydescription
Darryl Greendb2b8db2018-06-15 13:06:04 +0100148 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100149psa_status_t psa_destroy_persistent_key(const mbedtls_svc_key_id_t key);
Darryl Greendb2b8db2018-06-15 13:06:04 +0100150
151/**
Gilles Peskine8d4919b2018-12-03 16:48:09 +0100152 * \brief Free the temporary buffer allocated by psa_load_persistent_key().
Darryl Greendb2b8db2018-06-15 13:06:04 +0100153 *
154 * This function must be called at some point after psa_load_persistent_key()
155 * to zeroize and free the memory allocated to the buffer in that function.
156 *
157 * \param key_data Buffer for the key data.
158 * \param key_data_length Size of the key data buffer.
159 *
160 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100161void psa_free_persistent_key_data(uint8_t *key_data, size_t key_data_length);
Darryl Greendb2b8db2018-06-15 13:06:04 +0100162
163/**
164 * \brief Formats key data and metadata for persistent storage
165 *
Gilles Peskinebfd322f2019-07-23 11:58:03 +0200166 * \param[in] data Buffer containing the key data.
Darryl Greendb2b8db2018-06-15 13:06:04 +0100167 * \param data_length Length of the key data buffer.
Gilles Peskine4ed0e6f2019-07-30 20:22:33 +0200168 * \param[in] attr The core attributes of the key.
Darryl Greendb2b8db2018-06-15 13:06:04 +0100169 * \param[out] storage_data Output buffer for the formatted data.
170 *
171 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100172void psa_format_key_data_for_storage(const uint8_t *data,
173 const size_t data_length,
Gilles Peskine7fad3ef2024-02-28 01:08:27 +0100174 const psa_key_attributes_t *attr,
Gilles Peskine449bd832023-01-11 14:50:10 +0100175 uint8_t *storage_data);
Darryl Greendb2b8db2018-06-15 13:06:04 +0100176
177/**
178 * \brief Parses persistent storage data into key data and metadata
179 *
180 * \param[in] storage_data Buffer for the storage data.
181 * \param storage_data_length Length of the storage data buffer
182 * \param[out] key_data On output, pointer to a newly allocated buffer
183 * containing the key data. This must be freed
184 * using psa_free_persistent_key_data()
185 * \param[out] key_data_length Length of the key data buffer
Gilles Peskine4ed0e6f2019-07-30 20:22:33 +0200186 * \param[out] attr On success, the attribute structure is filled
Gilles Peskinebfd322f2019-07-23 11:58:03 +0200187 * with the loaded key metadata.
Darryl Greendb2b8db2018-06-15 13:06:04 +0100188 *
Gilles Peskineed733552023-02-14 19:21:09 +0100189 * \retval #PSA_SUCCESS \emptydescription
190 * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
191 * \retval #PSA_ERROR_DATA_INVALID \emptydescription
Darryl Greendb2b8db2018-06-15 13:06:04 +0100192 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100193psa_status_t psa_parse_key_data_from_storage(const uint8_t *storage_data,
194 size_t storage_data_length,
195 uint8_t **key_data,
196 size_t *key_data_length,
Gilles Peskine7fad3ef2024-02-28 01:08:27 +0100197 psa_key_attributes_t *attr);
Darryl Greendb2b8db2018-06-15 13:06:04 +0100198
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200199#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
200/** This symbol is defined if transaction support is required. */
Tom Cosgrovec43c3aa2023-08-31 17:06:58 +0100201#define PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS 1
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200202#endif
203
204#if defined(PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS)
205
206/** The type of transaction that is in progress.
207 */
208/* This is an integer type rather than an enum for two reasons: to support
209 * unknown values when loading a transaction file, and to ensure that the
210 * type has a known size.
211 */
212typedef uint16_t psa_crypto_transaction_type_t;
213
214/** No transaction is in progress.
Gilles Peskine2ea06fd2019-07-25 17:53:16 +0200215 *
216 * This has the value 0, so zero-initialization sets a transaction's type to
217 * this value.
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200218 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100219#define PSA_CRYPTO_TRANSACTION_NONE ((psa_crypto_transaction_type_t) 0x0000)
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200220
Gilles Peskinefc762652019-07-22 19:30:34 +0200221/** A key creation transaction.
222 *
223 * This is only used for keys in an external cryptoprocessor (secure element).
224 * Keys in RAM or in internal storage are created atomically in storage
225 * (simple file creation), so they do not need a transaction mechanism.
226 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100227#define PSA_CRYPTO_TRANSACTION_CREATE_KEY ((psa_crypto_transaction_type_t) 0x0001)
Gilles Peskinefc762652019-07-22 19:30:34 +0200228
229/** A key destruction transaction.
230 *
231 * This is only used for keys in an external cryptoprocessor (secure element).
232 * Keys in RAM or in internal storage are destroyed atomically in storage
233 * (simple file deletion), so they do not need a transaction mechanism.
234 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100235#define PSA_CRYPTO_TRANSACTION_DESTROY_KEY ((psa_crypto_transaction_type_t) 0x0002)
Gilles Peskinefc762652019-07-22 19:30:34 +0200236
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200237/** Transaction data.
238 *
239 * This type is designed to be serialized by writing the memory representation
240 * and reading it back on the same device.
241 *
Ryan0b14d142024-03-05 13:55:33 +0000242 * \note The transaction mechanism is not thread-safe. There can only be one
243 * single active transaction at a time.
244 * The transaction object is #psa_crypto_transaction.
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200245 *
246 * \note If an API call starts a transaction, it must complete this transaction
247 * before returning to the application.
248 *
249 * The lifetime of a transaction is the following (note that only one
250 * transaction may be active at a time):
251 *
252 * -# Call psa_crypto_prepare_transaction() to initialize the transaction
253 * object in memory and declare the type of transaction that is starting.
254 * -# Fill in the type-specific fields of #psa_crypto_transaction.
255 * -# Call psa_crypto_save_transaction() to start the transaction. This
256 * saves the transaction data to internal storage.
Gilles Peskine2ea06fd2019-07-25 17:53:16 +0200257 * -# Perform the work of the transaction by modifying files, contacting
258 * external entities, or whatever needs doing. Note that the transaction
259 * may be interrupted by a power failure, so you need to have a way
260 * recover from interruptions either by undoing what has been done
261 * so far or by resuming where you left off.
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200262 * -# If there are intermediate stages in the transaction, update
263 * the fields of #psa_crypto_transaction and call
264 * psa_crypto_save_transaction() again when each stage is reached.
Gilles Peskine2ea06fd2019-07-25 17:53:16 +0200265 * -# When the transaction is over, call psa_crypto_stop_transaction() to
266 * remove the transaction data in storage and in memory.
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200267 *
268 * If the system crashes while a transaction is in progress, psa_crypto_init()
269 * calls psa_crypto_load_transaction() and takes care of completing or
Gilles Peskine2ea06fd2019-07-25 17:53:16 +0200270 * rewinding the transaction. This is done in psa_crypto_recover_transaction()
271 * in psa_crypto.c. If you add a new type of transaction, be
272 * sure to add code for it in psa_crypto_recover_transaction().
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200273 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100274typedef union {
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200275 /* Each element of this union must have the following properties
276 * to facilitate serialization and deserialization:
277 *
278 * - The element is a struct.
279 * - The first field of the struct is `psa_crypto_transaction_type_t type`.
280 * - Elements of the struct are arranged such a way that there is
281 * no padding.
282 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100283 struct psa_crypto_transaction_unknown_s {
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200284 psa_crypto_transaction_type_t type;
Gilles Peskinefc762652019-07-22 19:30:34 +0200285 uint16_t unused1;
286 uint32_t unused2;
287 uint64_t unused3;
288 uint64_t unused4;
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200289 } unknown;
Gilles Peskinefc762652019-07-22 19:30:34 +0200290 /* ::type is #PSA_CRYPTO_TRANSACTION_CREATE_KEY or
291 * #PSA_CRYPTO_TRANSACTION_DESTROY_KEY. */
Gilles Peskine449bd832023-01-11 14:50:10 +0100292 struct psa_crypto_transaction_key_s {
Gilles Peskinefc762652019-07-22 19:30:34 +0200293 psa_crypto_transaction_type_t type;
294 uint16_t unused1;
295 psa_key_lifetime_t lifetime;
296 psa_key_slot_number_t slot;
Ronald Cron71016a92020-08-28 19:01:50 +0200297 mbedtls_svc_key_id_t id;
Gilles Peskinefc762652019-07-22 19:30:34 +0200298 } key;
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200299} psa_crypto_transaction_t;
300
301/** The single active transaction.
302 */
303extern psa_crypto_transaction_t psa_crypto_transaction;
304
305/** Prepare for a transaction.
306 *
307 * There must not be an ongoing transaction.
308 *
309 * \param type The type of transaction to start.
310 */
311static inline void psa_crypto_prepare_transaction(
Gilles Peskine449bd832023-01-11 14:50:10 +0100312 psa_crypto_transaction_type_t type)
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200313{
314 psa_crypto_transaction.unknown.type = type;
315}
316
317/** Save the transaction data to storage.
318 *
319 * You may call this function multiple times during a transaction to
320 * atomically update the transaction state.
321 *
Gilles Peskineed733552023-02-14 19:21:09 +0100322 * \retval #PSA_SUCCESS \emptydescription
323 * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription
324 * \retval #PSA_ERROR_INSUFFICIENT_STORAGE \emptydescription
325 * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200326 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100327psa_status_t psa_crypto_save_transaction(void);
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200328
329/** Load the transaction data from storage, if any.
330 *
331 * This function is meant to be called from psa_crypto_init() to recover
332 * in case a transaction was interrupted by a system crash.
333 *
334 * \retval #PSA_SUCCESS
335 * The data about the ongoing transaction has been loaded to
336 * #psa_crypto_transaction.
337 * \retval #PSA_ERROR_DOES_NOT_EXIST
338 * There is no ongoing transaction.
Gilles Peskineed733552023-02-14 19:21:09 +0100339 * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription
340 * \retval #PSA_ERROR_DATA_INVALID \emptydescription
341 * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200342 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100343psa_status_t psa_crypto_load_transaction(void);
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200344
345/** Indicate that the current transaction is finished.
346 *
Gilles Peskine2ea06fd2019-07-25 17:53:16 +0200347 * Call this function at the very end of transaction processing.
348 * This function does not "commit" or "abort" the transaction: the storage
349 * subsystem has no concept of "commit" and "abort", just saving and
350 * removing the transaction information in storage.
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200351 *
352 * This function erases the transaction data in storage (if any) and
353 * resets the transaction data in memory.
354 *
355 * \retval #PSA_SUCCESS
356 * There was transaction data in storage.
357 * \retval #PSA_ERROR_DOES_NOT_EXIST
358 * There was no transaction data in storage.
359 * \retval #PSA_ERROR_STORAGE_FAILURE
360 * It was impossible to determine whether there was transaction data
361 * in storage, or the transaction data could not be erased.
362 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100363psa_status_t psa_crypto_stop_transaction(void);
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200364
365/** The ITS file identifier for the transaction data.
366 *
367 * 0xffffffNN = special file; 0x74 = 't' for transaction.
368 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100369#define PSA_CRYPTO_ITS_TRANSACTION_UID ((psa_key_id_t) 0xffffff74)
Gilles Peskinec8336cb2019-07-22 19:26:12 +0200370
371#endif /* PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS */
372
Gilles Peskinee3dbdd82019-02-25 11:04:06 +0100373#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
374/** Backend side of mbedtls_psa_inject_entropy().
375 *
376 * This function stores the supplied data into the entropy seed file.
377 *
378 * \retval #PSA_SUCCESS
379 * Success
Gilles Peskineed733552023-02-14 19:21:09 +0100380 * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription
381 * \retval #PSA_ERROR_INSUFFICIENT_STORAGE \emptydescription
Gilles Peskinee3dbdd82019-02-25 11:04:06 +0100382 * \retval #PSA_ERROR_NOT_PERMITTED
383 * The entropy seed file already exists.
384 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100385psa_status_t mbedtls_psa_storage_inject_entropy(const unsigned char *seed,
386 size_t seed_size);
Gilles Peskinee3dbdd82019-02-25 11:04:06 +0100387#endif /* MBEDTLS_PSA_INJECT_ENTROPY */
388
Darryl Greendb2b8db2018-06-15 13:06:04 +0100389#ifdef __cplusplus
390}
391#endif
392
393#endif /* PSA_CRYPTO_STORAGE_H */