xref: /optee_os/lib/libmbedtls/mbedtls/library/psa_crypto_slot_management.h (revision cb03400251f98aed22a2664509e3ed9e183800b0)
1b0563631STom Van Eyck /*
2b0563631STom Van Eyck  *  PSA crypto layer on top of Mbed TLS crypto
3b0563631STom Van Eyck  */
4b0563631STom Van Eyck /*
5b0563631STom Van Eyck  *  Copyright The Mbed TLS Contributors
6b0563631STom Van Eyck  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
7b0563631STom Van Eyck  */
8b0563631STom Van Eyck 
9b0563631STom Van Eyck #ifndef PSA_CRYPTO_SLOT_MANAGEMENT_H
10b0563631STom Van Eyck #define PSA_CRYPTO_SLOT_MANAGEMENT_H
11b0563631STom Van Eyck 
12b0563631STom Van Eyck #include "psa/crypto.h"
13b0563631STom Van Eyck #include "psa_crypto_core.h"
14b0563631STom Van Eyck #include "psa_crypto_se.h"
15b0563631STom Van Eyck 
16b0563631STom Van Eyck /** Range of volatile key identifiers.
17b0563631STom Van Eyck  *
18*cb034002SJerome Forissier  *  The first #MBEDTLS_PSA_KEY_SLOT_COUNT identifiers of the implementation
19b0563631STom Van Eyck  *  range of key identifiers are reserved for volatile key identifiers.
20*cb034002SJerome Forissier  *
21*cb034002SJerome Forissier  *  If \c id is a a volatile key identifier, #PSA_KEY_ID_VOLATILE_MIN - \c id
22*cb034002SJerome Forissier  *  indicates the key slot containing the volatile key definition. See
23*cb034002SJerome Forissier  *  psa_crypto_slot_management.c for details.
24b0563631STom Van Eyck  */
25b0563631STom Van Eyck 
26b0563631STom Van Eyck /** The minimum value for a volatile key identifier.
27b0563631STom Van Eyck  */
28*cb034002SJerome Forissier #define PSA_KEY_ID_VOLATILE_MIN  PSA_KEY_ID_VENDOR_MIN
29b0563631STom Van Eyck 
30b0563631STom Van Eyck /** The maximum value for a volatile key identifier.
31b0563631STom Van Eyck  */
32*cb034002SJerome Forissier #if defined(MBEDTLS_PSA_KEY_STORE_DYNAMIC)
33*cb034002SJerome Forissier #define PSA_KEY_ID_VOLATILE_MAX (MBEDTLS_PSA_KEY_ID_BUILTIN_MIN - 1)
34*cb034002SJerome Forissier #else /* MBEDTLS_PSA_KEY_STORE_DYNAMIC */
35*cb034002SJerome Forissier #define PSA_KEY_ID_VOLATILE_MAX                                 \
36*cb034002SJerome Forissier     (PSA_KEY_ID_VOLATILE_MIN + MBEDTLS_PSA_KEY_SLOT_COUNT - 1)
37*cb034002SJerome Forissier #endif /* MBEDTLS_PSA_KEY_STORE_DYNAMIC */
38b0563631STom Van Eyck 
39b0563631STom Van Eyck /** Test whether a key identifier is a volatile key identifier.
40b0563631STom Van Eyck  *
41b0563631STom Van Eyck  * \param key_id  Key identifier to test.
42b0563631STom Van Eyck  *
43b0563631STom Van Eyck  * \retval 1
44b0563631STom Van Eyck  *         The key identifier is a volatile key identifier.
45b0563631STom Van Eyck  * \retval 0
46b0563631STom Van Eyck  *         The key identifier is not a volatile key identifier.
47b0563631STom Van Eyck  */
psa_key_id_is_volatile(psa_key_id_t key_id)48b0563631STom Van Eyck static inline int psa_key_id_is_volatile(psa_key_id_t key_id)
49b0563631STom Van Eyck {
50b0563631STom Van Eyck     return (key_id >= PSA_KEY_ID_VOLATILE_MIN) &&
51b0563631STom Van Eyck            (key_id <= PSA_KEY_ID_VOLATILE_MAX);
52b0563631STom Van Eyck }
53b0563631STom Van Eyck 
54b0563631STom Van Eyck /** Get the description of a key given its identifier and lock it.
55b0563631STom Van Eyck  *
56b0563631STom Van Eyck  * The descriptions of volatile keys and loaded persistent keys are stored in
57b0563631STom Van Eyck  * key slots. This function returns a pointer to the key slot containing the
58b0563631STom Van Eyck  * description of a key given its identifier.
59b0563631STom Van Eyck  *
60b0563631STom Van Eyck  * In case of a persistent key, the function loads the description of the key
61b0563631STom Van Eyck  * into a key slot if not already done.
62b0563631STom Van Eyck  *
63b0563631STom Van Eyck  * On success, the returned key slot has been registered for reading.
64b0563631STom Van Eyck  * It is the responsibility of the caller to call psa_unregister_read(slot)
65b0563631STom Van Eyck  * when they have finished reading the contents of the slot.
66b0563631STom Van Eyck  *
67*cb034002SJerome Forissier  * On failure, `*p_slot` is set to NULL. This ensures that it is always valid
68*cb034002SJerome Forissier  * to call psa_unregister_read on the returned slot.
69*cb034002SJerome Forissier  *
70b0563631STom Van Eyck  * \param key           Key identifier to query.
71b0563631STom Van Eyck  * \param[out] p_slot   On success, `*p_slot` contains a pointer to the
72b0563631STom Van Eyck  *                      key slot containing the description of the key
73b0563631STom Van Eyck  *                      identified by \p key.
74b0563631STom Van Eyck  *
75b0563631STom Van Eyck  * \retval #PSA_SUCCESS
76b0563631STom Van Eyck  *         \p *p_slot contains a pointer to the key slot containing the
77b0563631STom Van Eyck  *         description of the key identified by \p key.
78b0563631STom Van Eyck  *         The key slot counter has been incremented.
79b0563631STom Van Eyck  * \retval #PSA_ERROR_BAD_STATE
80b0563631STom Van Eyck  *         The library has not been initialized.
81b0563631STom Van Eyck  * \retval #PSA_ERROR_INVALID_HANDLE
82b0563631STom Van Eyck  *         \p key is not a valid key identifier.
83b0563631STom Van Eyck  * \retval #PSA_ERROR_INSUFFICIENT_MEMORY
84b0563631STom Van Eyck  *         \p key is a persistent key identifier. The implementation does not
85b0563631STom Van Eyck  *         have sufficient resources to load the persistent key. This can be
86b0563631STom Van Eyck  *         due to a lack of empty key slot, or available memory.
87b0563631STom Van Eyck  * \retval #PSA_ERROR_DOES_NOT_EXIST
88b0563631STom Van Eyck  *         There is no key with key identifier \p key.
89b0563631STom Van Eyck  * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
90b0563631STom Van Eyck  * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription
91b0563631STom Van Eyck  * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription
92b0563631STom Van Eyck  */
93b0563631STom Van Eyck psa_status_t psa_get_and_lock_key_slot(mbedtls_svc_key_id_t key,
94b0563631STom Van Eyck                                        psa_key_slot_t **p_slot);
95b0563631STom Van Eyck 
96b0563631STom Van Eyck /** Initialize the key slot structures.
97b0563631STom Van Eyck  *
98b0563631STom Van Eyck  * \retval #PSA_SUCCESS
99b0563631STom Van Eyck  *         Currently this function always succeeds.
100b0563631STom Van Eyck  */
101b0563631STom Van Eyck psa_status_t psa_initialize_key_slots(void);
102b0563631STom Van Eyck 
103*cb034002SJerome Forissier #if defined(MBEDTLS_TEST_HOOKS) && defined(MBEDTLS_PSA_KEY_STORE_DYNAMIC)
104*cb034002SJerome Forissier /* Allow test code to customize the key slice length. We use this in tests
105*cb034002SJerome Forissier  * that exhaust the key store to reach a full key store in reasonable time
106*cb034002SJerome Forissier  * and memory.
107*cb034002SJerome Forissier  *
108*cb034002SJerome Forissier  * The length of each slice must be between 1 and
109*cb034002SJerome Forissier  * (1 << KEY_ID_SLOT_INDEX_WIDTH) inclusive.
110*cb034002SJerome Forissier  *
111*cb034002SJerome Forissier  * The length for a given slice index must not change while
112*cb034002SJerome Forissier  * the key store is initialized.
113*cb034002SJerome Forissier  */
114*cb034002SJerome Forissier extern size_t (*mbedtls_test_hook_psa_volatile_key_slice_length)(
115*cb034002SJerome Forissier     size_t slice_idx);
116*cb034002SJerome Forissier 
117*cb034002SJerome Forissier /* The number of volatile key slices. */
118*cb034002SJerome Forissier size_t psa_key_slot_volatile_slice_count(void);
119*cb034002SJerome Forissier #endif
120*cb034002SJerome Forissier 
121b0563631STom Van Eyck /** Delete all data from key slots in memory.
122b0563631STom Van Eyck  * This function is not thread safe, it wipes every key slot regardless of
123b0563631STom Van Eyck  * state and reader count. It should only be called when no slot is in use.
124b0563631STom Van Eyck  *
125b0563631STom Van Eyck  * This does not affect persistent storage. */
126b0563631STom Van Eyck void psa_wipe_all_key_slots(void);
127b0563631STom Van Eyck 
128b0563631STom Van Eyck /** Find a free key slot and reserve it to be filled with a key.
129b0563631STom Van Eyck  *
130b0563631STom Van Eyck  * This function finds a key slot that is free,
131b0563631STom Van Eyck  * sets its state to PSA_SLOT_FILLING and then returns the slot.
132b0563631STom Van Eyck  *
133b0563631STom Van Eyck  * On success, the key slot's state is PSA_SLOT_FILLING.
134b0563631STom Van Eyck  * It is the responsibility of the caller to change the slot's state to
135b0563631STom Van Eyck  * PSA_SLOT_EMPTY/FULL once key creation has finished.
136b0563631STom Van Eyck  *
137b0563631STom Van Eyck  * If multi-threading is enabled, the caller must hold the
138b0563631STom Van Eyck  * global key slot mutex.
139b0563631STom Van Eyck  *
140*cb034002SJerome Forissier  * \param[out] volatile_key_id   - If null, reserve a cache slot for
141*cb034002SJerome Forissier  *                                 a persistent or built-in key.
142*cb034002SJerome Forissier  *                               - If non-null, allocate a slot for
143*cb034002SJerome Forissier  *                                 a volatile key. On success,
144*cb034002SJerome Forissier  *                                 \p *volatile_key_id is the
145*cb034002SJerome Forissier  *                                 identifier corresponding to the
146*cb034002SJerome Forissier  *                                 returned slot. It is the caller's
147*cb034002SJerome Forissier  *                                 responsibility to set this key identifier
148*cb034002SJerome Forissier  *                                 in the attributes.
149b0563631STom Van Eyck  * \param[out] p_slot            On success, a pointer to the slot.
150b0563631STom Van Eyck  *
151b0563631STom Van Eyck  * \retval #PSA_SUCCESS \emptydescription
152b0563631STom Van Eyck  * \retval #PSA_ERROR_INSUFFICIENT_MEMORY
153b0563631STom Van Eyck  *         There were no free key slots.
154*cb034002SJerome Forissier  *         When #MBEDTLS_PSA_KEY_STORE_DYNAMIC is enabled, there was not
155*cb034002SJerome Forissier  *         enough memory to allocate more slots.
156b0563631STom Van Eyck  * \retval #PSA_ERROR_BAD_STATE \emptydescription
157b0563631STom Van Eyck  * \retval #PSA_ERROR_CORRUPTION_DETECTED
158b0563631STom Van Eyck  *         This function attempted to operate on a key slot which was in an
159b0563631STom Van Eyck  *         unexpected state.
160b0563631STom Van Eyck  */
161b0563631STom Van Eyck psa_status_t psa_reserve_free_key_slot(psa_key_id_t *volatile_key_id,
162b0563631STom Van Eyck                                        psa_key_slot_t **p_slot);
163b0563631STom Van Eyck 
164*cb034002SJerome Forissier #if defined(MBEDTLS_PSA_KEY_STORE_DYNAMIC)
165*cb034002SJerome Forissier /** Return a key slot to the free list.
166*cb034002SJerome Forissier  *
167*cb034002SJerome Forissier  * Call this function when a slot obtained from psa_reserve_free_key_slot()
168*cb034002SJerome Forissier  * is no longer in use.
169*cb034002SJerome Forissier  *
170*cb034002SJerome Forissier  * If multi-threading is enabled, the caller must hold the
171*cb034002SJerome Forissier  * global key slot mutex.
172*cb034002SJerome Forissier  *
173*cb034002SJerome Forissier  * \param slice_idx             The slice containing the slot.
174*cb034002SJerome Forissier  *                              This is `slot->slice_index` when the slot
175*cb034002SJerome Forissier  *                              is obtained from psa_reserve_free_key_slot().
176*cb034002SJerome Forissier  * \param slot                  The key slot.
177*cb034002SJerome Forissier  *
178*cb034002SJerome Forissier  * \retval #PSA_SUCCESS \emptydescription
179*cb034002SJerome Forissier  * \retval #PSA_ERROR_CORRUPTION_DETECTED
180*cb034002SJerome Forissier  *         This function attempted to operate on a key slot which was in an
181*cb034002SJerome Forissier  *         unexpected state.
182*cb034002SJerome Forissier  */
183*cb034002SJerome Forissier psa_status_t psa_free_key_slot(size_t slice_idx,
184*cb034002SJerome Forissier                                psa_key_slot_t *slot);
185*cb034002SJerome Forissier #endif /* MBEDTLS_PSA_KEY_STORE_DYNAMIC */
186*cb034002SJerome Forissier 
187b0563631STom Van Eyck /** Change the state of a key slot.
188b0563631STom Van Eyck  *
189b0563631STom Van Eyck  * This function changes the state of the key slot from expected_state to
190b0563631STom Van Eyck  * new state. If the state of the slot was not expected_state, the state is
191b0563631STom Van Eyck  * unchanged.
192b0563631STom Van Eyck  *
193b0563631STom Van Eyck  * If multi-threading is enabled, the caller must hold the
194b0563631STom Van Eyck  * global key slot mutex.
195b0563631STom Van Eyck  *
196b0563631STom Van Eyck  * \param[in] slot            The key slot.
197b0563631STom Van Eyck  * \param[in] expected_state  The current state of the slot.
198b0563631STom Van Eyck  * \param[in] new_state       The new state of the slot.
199b0563631STom Van Eyck  *
200b0563631STom Van Eyck  * \retval #PSA_SUCCESS
201b0563631STom Van Eyck                The key slot's state variable is new_state.
202b0563631STom Van Eyck  * \retval #PSA_ERROR_CORRUPTION_DETECTED
203b0563631STom Van Eyck  *             The slot's state was not expected_state.
204b0563631STom Van Eyck  */
psa_key_slot_state_transition(psa_key_slot_t * slot,psa_key_slot_state_t expected_state,psa_key_slot_state_t new_state)205b0563631STom Van Eyck static inline psa_status_t psa_key_slot_state_transition(
206b0563631STom Van Eyck     psa_key_slot_t *slot, psa_key_slot_state_t expected_state,
207b0563631STom Van Eyck     psa_key_slot_state_t new_state)
208b0563631STom Van Eyck {
209b0563631STom Van Eyck     if (slot->state != expected_state) {
210b0563631STom Van Eyck         return PSA_ERROR_CORRUPTION_DETECTED;
211b0563631STom Van Eyck     }
212b0563631STom Van Eyck     slot->state = new_state;
213b0563631STom Van Eyck     return PSA_SUCCESS;
214b0563631STom Van Eyck }
215b0563631STom Van Eyck 
216b0563631STom Van Eyck /** Register as a reader of a key slot.
217b0563631STom Van Eyck  *
218b0563631STom Van Eyck  * This function increments the key slot registered reader counter by one.
219b0563631STom Van Eyck  * If multi-threading is enabled, the caller must hold the
220b0563631STom Van Eyck  * global key slot mutex.
221b0563631STom Van Eyck  *
222b0563631STom Van Eyck  * \param[in] slot  The key slot.
223b0563631STom Van Eyck  *
224b0563631STom Van Eyck  * \retval #PSA_SUCCESS
225b0563631STom Van Eyck                The key slot registered reader counter was incremented.
226b0563631STom Van Eyck  * \retval #PSA_ERROR_CORRUPTION_DETECTED
227b0563631STom Van Eyck  *             The reader counter already reached its maximum value and was not
228b0563631STom Van Eyck  *             increased, or the slot's state was not PSA_SLOT_FULL.
229b0563631STom Van Eyck  */
psa_register_read(psa_key_slot_t * slot)230b0563631STom Van Eyck static inline psa_status_t psa_register_read(psa_key_slot_t *slot)
231b0563631STom Van Eyck {
232b0563631STom Van Eyck     if ((slot->state != PSA_SLOT_FULL) ||
233*cb034002SJerome Forissier         (slot->var.occupied.registered_readers >= SIZE_MAX)) {
234b0563631STom Van Eyck         return PSA_ERROR_CORRUPTION_DETECTED;
235b0563631STom Van Eyck     }
236*cb034002SJerome Forissier     slot->var.occupied.registered_readers++;
237b0563631STom Van Eyck 
238b0563631STom Van Eyck     return PSA_SUCCESS;
239b0563631STom Van Eyck }
240b0563631STom Van Eyck 
241b0563631STom Van Eyck /** Unregister from reading a key slot.
242b0563631STom Van Eyck  *
243b0563631STom Van Eyck  * This function decrements the key slot registered reader counter by one.
244b0563631STom Van Eyck  * If the state of the slot is PSA_SLOT_PENDING_DELETION,
245b0563631STom Van Eyck  * and there is only one registered reader (the caller),
246b0563631STom Van Eyck  * this function will call psa_wipe_key_slot().
247b0563631STom Van Eyck  * If multi-threading is enabled, the caller must hold the
248b0563631STom Van Eyck  * global key slot mutex.
249b0563631STom Van Eyck  *
250b0563631STom Van Eyck  * \note To ease the handling of errors in retrieving a key slot
251b0563631STom Van Eyck  *       a NULL input pointer is valid, and the function returns
252b0563631STom Van Eyck  *       successfully without doing anything in that case.
253b0563631STom Van Eyck  *
254b0563631STom Van Eyck  * \param[in] slot  The key slot.
255b0563631STom Van Eyck  * \retval #PSA_SUCCESS
256b0563631STom Van Eyck  *             \p slot is NULL or the key slot reader counter has been
257b0563631STom Van Eyck  *             decremented (and potentially wiped) successfully.
258b0563631STom Van Eyck  * \retval #PSA_ERROR_CORRUPTION_DETECTED
259b0563631STom Van Eyck  *             The slot's state was neither PSA_SLOT_FULL nor
260b0563631STom Van Eyck  *             PSA_SLOT_PENDING_DELETION.
261b0563631STom Van Eyck  *             Or a wipe was attempted and the slot's state was not
262b0563631STom Van Eyck  *             PSA_SLOT_PENDING_DELETION.
263b0563631STom Van Eyck  *             Or registered_readers was equal to 0.
264b0563631STom Van Eyck  */
265b0563631STom Van Eyck psa_status_t psa_unregister_read(psa_key_slot_t *slot);
266b0563631STom Van Eyck 
267b0563631STom Van Eyck /** Wrap a call to psa_unregister_read in the global key slot mutex.
268b0563631STom Van Eyck  *
269b0563631STom Van Eyck  * If threading is disabled, this simply calls psa_unregister_read.
270b0563631STom Van Eyck  *
271b0563631STom Van Eyck  * \note To ease the handling of errors in retrieving a key slot
272b0563631STom Van Eyck  *       a NULL input pointer is valid, and the function returns
273b0563631STom Van Eyck  *       successfully without doing anything in that case.
274b0563631STom Van Eyck  *
275b0563631STom Van Eyck  * \param[in] slot  The key slot.
276b0563631STom Van Eyck  * \retval #PSA_SUCCESS
277b0563631STom Van Eyck  *             \p slot is NULL or the key slot reader counter has been
278b0563631STom Van Eyck  *             decremented (and potentially wiped) successfully.
279b0563631STom Van Eyck  * \retval #PSA_ERROR_CORRUPTION_DETECTED
280b0563631STom Van Eyck  *             The slot's state was neither PSA_SLOT_FULL nor
281b0563631STom Van Eyck  *             PSA_SLOT_PENDING_DELETION.
282b0563631STom Van Eyck  *             Or a wipe was attempted and the slot's state was not
283b0563631STom Van Eyck  *             PSA_SLOT_PENDING_DELETION.
284b0563631STom Van Eyck  *             Or registered_readers was equal to 0.
285b0563631STom Van Eyck  */
286b0563631STom Van Eyck psa_status_t psa_unregister_read_under_mutex(psa_key_slot_t *slot);
287b0563631STom Van Eyck 
288b0563631STom Van Eyck /** Test whether a lifetime designates a key in an external cryptoprocessor.
289b0563631STom Van Eyck  *
290b0563631STom Van Eyck  * \param lifetime      The lifetime to test.
291b0563631STom Van Eyck  *
292b0563631STom Van Eyck  * \retval 1
293b0563631STom Van Eyck  *         The lifetime designates an external key. There should be a
294b0563631STom Van Eyck  *         registered driver for this lifetime, otherwise the key cannot
295b0563631STom Van Eyck  *         be created or manipulated.
296b0563631STom Van Eyck  * \retval 0
297b0563631STom Van Eyck  *         The lifetime designates a key that is volatile or in internal
298b0563631STom Van Eyck  *         storage.
299b0563631STom Van Eyck  */
psa_key_lifetime_is_external(psa_key_lifetime_t lifetime)300b0563631STom Van Eyck static inline int psa_key_lifetime_is_external(psa_key_lifetime_t lifetime)
301b0563631STom Van Eyck {
302b0563631STom Van Eyck     return PSA_KEY_LIFETIME_GET_LOCATION(lifetime)
303b0563631STom Van Eyck            != PSA_KEY_LOCATION_LOCAL_STORAGE;
304b0563631STom Van Eyck }
305b0563631STom Van Eyck 
306b0563631STom Van Eyck /** Validate a key's location.
307b0563631STom Van Eyck  *
308b0563631STom Van Eyck  * This function checks whether the key's attributes point to a location that
309b0563631STom Van Eyck  * is known to the PSA Core, and returns the driver function table if the key
310b0563631STom Van Eyck  * is to be found in an external location.
311b0563631STom Van Eyck  *
312b0563631STom Van Eyck  * \param[in] lifetime      The key lifetime attribute.
313b0563631STom Van Eyck  * \param[out] p_drv        On success, when a key is located in external
314b0563631STom Van Eyck  *                          storage, returns a pointer to the driver table
315b0563631STom Van Eyck  *                          associated with the key's storage location.
316b0563631STom Van Eyck  *
317b0563631STom Van Eyck  * \retval #PSA_SUCCESS \emptydescription
318b0563631STom Van Eyck  * \retval #PSA_ERROR_INVALID_ARGUMENT \emptydescription
319b0563631STom Van Eyck  */
320b0563631STom Van Eyck psa_status_t psa_validate_key_location(psa_key_lifetime_t lifetime,
321b0563631STom Van Eyck                                        psa_se_drv_table_entry_t **p_drv);
322b0563631STom Van Eyck 
323b0563631STom Van Eyck /** Validate the persistence of a key.
324b0563631STom Van Eyck  *
325b0563631STom Van Eyck  * \param[in] lifetime  The key lifetime attribute.
326b0563631STom Van Eyck  *
327b0563631STom Van Eyck  * \retval #PSA_SUCCESS \emptydescription
328b0563631STom Van Eyck  * \retval #PSA_ERROR_NOT_SUPPORTED The key is persistent but persistent keys
329b0563631STom Van Eyck  *             are not supported.
330b0563631STom Van Eyck  */
331b0563631STom Van Eyck psa_status_t psa_validate_key_persistence(psa_key_lifetime_t lifetime);
332b0563631STom Van Eyck 
333b0563631STom Van Eyck /** Validate a key identifier.
334b0563631STom Van Eyck  *
335b0563631STom Van Eyck  * \param[in] key           The key identifier.
336b0563631STom Van Eyck  * \param[in] vendor_ok     Non-zero to indicate that key identifiers in the
337b0563631STom Van Eyck  *                          vendor range are allowed, volatile key identifiers
338b0563631STom Van Eyck  *                          excepted \c 0 otherwise.
339b0563631STom Van Eyck  *
340b0563631STom Van Eyck  * \retval <> 0 if the key identifier is valid, 0 otherwise.
341b0563631STom Van Eyck  */
342b0563631STom Van Eyck int psa_is_valid_key_id(mbedtls_svc_key_id_t key, int vendor_ok);
343b0563631STom Van Eyck 
344b0563631STom Van Eyck #endif /* PSA_CRYPTO_SLOT_MANAGEMENT_H */
345