1 /*
2  * Copyright (c) 2019, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 /* This file includes common definitions for PSA storage
9 */
10 
11 #ifndef PSA_STORAGE_COMMON_H
12 #define PSA_STORAGE_COMMON_H
13 
14 #include <stddef.h>
15 #include <stdint.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 typedef uint32_t psa_storage_create_flags_t;
22 
23 typedef uint64_t psa_storage_uid_t;
24 
25 /* Flags */
26 
27 #define PSA_STORAGE_FLAG_NONE        0u
28 #define PSA_STORAGE_FLAG_WRITE_ONCE (1u << 0)
29 #define PSA_STORAGE_FLAG_NO_CONFIDENTIALITY (1u << 1)
30 #define PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION (1u << 2)
31 
32 /* A container for metadata associated with a specific uid */
33 
34 struct psa_storage_info_t {
35     size_t capacity;
36     size_t size;
37     psa_storage_create_flags_t flags;
38 };
39 
40 #define PSA_STORAGE_SUPPORT_SET_EXTENDED (1u << 0)
41 
42 #define PSA_ERROR_INVALID_SIGNATURE     ((psa_status_t)-149)
43 #define PSA_ERROR_DATA_CORRUPT          ((psa_status_t)-152)
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif // PSA_STORAGE_COMMON_H
50