1 /* Copyright (c) 2024 Nordic Semiconductor
2  * SPDX-License-Identifier: Apache-2.0
3  */
4 #ifndef PSA_STORAGE_COMMON_H
5 #define PSA_STORAGE_COMMON_H
6 /**
7  * @defgroup psa_secure_storage PSA Secure Storage API
8  * @ingroup os_services
9  * @details For more information on the PSA Secure Storage API, see the
10  * [PSA Certified Secure Storage API](https://arm-software.github.io/psa-api/storage/1.0/)
11  * specification.
12  */
13 /**
14  * @file psa/storage_common.h
15  * @ingroup psa_secure_storage
16  * @brief Common definitions of the PSA Secure Storage API.
17  * @{
18  */
19 #include <psa/error.h>
20 #include <stddef.h>
21 
22 /** UID type for identifying entries. */
23 typedef uint64_t psa_storage_uid_t;
24 
25 /** Flags used when creating an entry. */
26 typedef uint32_t psa_storage_create_flags_t;
27 
28 /** No flag to pass. */
29 #define PSA_STORAGE_FLAG_NONE                 0u
30 /** The data associated with the UID will not be able to be modified or deleted. */
31 #define PSA_STORAGE_FLAG_WRITE_ONCE           (1u << 0)
32 /** The data associated with the UID is public, requiring only integrity. */
33 #define PSA_STORAGE_FLAG_NO_CONFIDENTIALITY   (1u << 1)
34 /** The data associated with the UID does not require replay protection. */
35 #define PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION (1u << 2)
36 
37 /** Metadata associated with a specific entry. */
38 struct psa_storage_info_t {
39 	/** The allocated capacity of the storage associated with an entry. */
40 	size_t capacity;
41 	/** The size of an entry's data. */
42 	size_t size;
43 	/** The flags used when the entry was created. */
44 	psa_storage_create_flags_t flags;
45 };
46 
47 /** Flag indicating that @ref psa_ps_create() and @ref psa_ps_set_extended() are supported. */
48 #define PSA_STORAGE_SUPPORT_SET_EXTENDED (1u << 0)
49 
50 /** @} */
51 #endif
52