Mbed OS Reference
Loading...
Searching...
No Matches
storage_common.h
Go to the documentation of this file.
1/* 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#include "psa/error.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/** \brief Flags used when creating a data entry
33 */
35
36#define PSA_STORAGE_FLAG_NONE 0 /**< No flags to pass */
37#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`*/
38#define PSA_STORAGE_FLAG_NO_CONFIDENTIALITY (1 << 1) /**< The data associated with the uid is public and therefore does not require confidentiality. It therefore only needs to be integrity protected */
39#define PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION (1 << 2) /**< The data associated with the uid does not require replay protection. This may permit faster storage - but it permits an attecker with physical access to revert to an earlier version of the data. */
40
41/** \brief A type for UIDs used for identifying data
42 */
43typedef uint64_t psa_storage_uid_t;
44
45/**
46 * \brief A container for metadata associated with a specific uid
47 */
49 size_t capacity; /**< The allocated capacity of the storage associated with a UID **/
50 size_t size; /**< The size of the data associated with a uid **/
51 psa_storage_create_flags_t flags; /**< The flags set when the uid was created **/
52};
53
54/** Flag indicating that \ref psa_ps_create and \ref psa_ps_set_extended are supported */
55#define PSA_STORAGE_SUPPORT_SET_EXTENDED (1 << 0)
56
57/** \brief PSA storage specific error codes */
58#define PSA_ERROR_DATA_CORRUPT ((psa_status_t)-152)
59
60#ifdef __cplusplus
61}
62#endif
63
64#endif // __PSA_STORAGE_COMMON_H__
uint32_t psa_storage_create_flags_t
Flags used when creating a data entry.
uint32_t psa_storage_create_flags_t
Flags used when creating a data entry.
uint64_t psa_storage_uid_t
A type for UIDs used for identifying data.
A container for metadata associated with a specific uid.
psa_storage_create_flags_t flags
The flags set when the uid was created.
size_t size
The size of the data associated with a uid.
size_t capacity
The allocated capacity of the storage associated with a UID.