1 /* Copyright (c) 2024 Nordic Semiconductor
2  * SPDX-License-Identifier: Apache-2.0
3  */
4 #ifndef SECURE_STORAGE_ITS_STORE_H
5 #define SECURE_STORAGE_ITS_STORE_H
6 
7 /** @file zephyr/secure_storage/its/store.h The secure storage ITS store module.
8  *
9  * The functions declared in this header implement the ITS store module.
10  * They are meant to be called only by the ITS implementation.
11  * This header may be included when providing a custom implementation of the
12  * ITS store module (@kconfig{CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_CUSTOM}).
13  */
14 #include <zephyr/secure_storage/its/common.h>
15 
16 /** @brief Writes the data of an ITS entry to the storage medium.
17  *
18  * @param uid         The entry's UID.
19  * @param data_length The number of bytes in `data`.
20  * @param data        The data to store.
21  *
22  * @return One of the return values of `psa_its_set()`.
23  */
24 psa_status_t secure_storage_its_store_set(secure_storage_its_uid_t uid,
25 					  size_t data_length, const void *data);
26 
27 /** @brief Retrieves the data of an ITS entry from the storage medium.
28  *
29  * @param[in]  uid         The entry's UID.
30  * @param[in]  data_size   The size of `data` in bytes.
31  * @param[out] data        The buffer to which the entry's stored data is written.
32  * @param[out] data_length On success, the number of bytes written to `data`.
33  *                         May be less than `data_size`.
34  *
35  * @return One of the return values of `psa_its_get()`.
36  */
37 psa_status_t secure_storage_its_store_get(secure_storage_its_uid_t uid, size_t data_size,
38 					  void *data, size_t *data_length);
39 
40 /** @brief Removes an ITS entry from the storage medium.
41  *
42  * @param uid The entry's UID.
43  *
44  * @return `PSA_SUCCESS` on success, anything else on failure.
45  */
46 psa_status_t secure_storage_its_store_remove(secure_storage_its_uid_t uid);
47 
48 #endif
49