blob: 07cb6e9c6a80754c280dc872340c8717d1555fac [file] [log] [blame]
Gilles Peskine5f544972019-02-24 11:26:36 +01001/* Copyright (C) 2019, ARM Limited, All Rights Reserved
2 * SPDX-License-Identifier: Apache-2.0
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 * not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/** @file
18@brief This file includes common definitions for PSA storage
19*/
20
21#ifndef __PSA_STORAGE_COMMON_H__
22#define __PSA_STORAGE_COMMON_H__
23
24#include <stddef.h>
25#include <stdint.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/** \brief Flags used when creating a data entry
32 */
33typedef uint32_t psa_storage_create_flags_t;
34
35/** \brief A type for UIDs used for identifying data
36 */
37typedef uint64_t psa_storage_uid_t;
38
39#define PSA_STORAGE_FLAG_NONE 0 /**< No flags to pass */
40#define PSA_STORAGE_FLAG_WRITE_ONCE (1 << 0) /**< The data associated with the uid will not be able to be modified or deleted. Intended to be used to set bits in `psa_storage_create_flags_t`*/
41
42/**
43 * \brief A container for metadata associated with a specific uid
44 */
45struct psa_storage_info_t {
46 uint32_t size; /**< The size of the data associated with a uid **/
47 psa_storage_create_flags_t flags; /**< The flags set when the uid was created **/
48};
49
50/** Flag indicating that \ref psa_storage_create and \ref psa_storage_set_extended are supported */
51#define PSA_STORAGE_SUPPORT_SET_EXTENDED (1 << 0)
52
53/** \brief PSA storage specific error codes
54 */
55#define PSA_ERROR_INVALID_SIGNATURE ((psa_status_t)-149)
56#define PSA_ERROR_DATA_CORRUPT ((psa_status_t)-152)
57
58#endif // __PSA_STORAGE_COMMON_H__