aboutsummaryrefslogtreecommitdiff
path: root/components/service/secure_storage/client/psa/internal_trusted_storage.h
blob: da6905464aee054ffad34a01b444f0816db0b781 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef PSA_INTERNAL_TRUSTED_STORAGE_H
#define PSA_INTERNAL_TRUSTED_STORAGE_H

#include <psa/error.h>
#include <psa/storage_common.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * The major version number of the PSA ITS API. It will be incremented on
 * significant updates that may include breaking changes.
 */
#define PSA_ITS_API_VERSION_MAJOR 1

/**
 * The minor version number of the PSA ITS API. It will be incremented in
 * small updates that are unlikely to include breaking changes.
 */
#define PSA_ITS_API_VERSION_MINOR 0

/**
 * @brief      Create a new, or modify an existing, uid /value pair.
 *
 * @param[in]  uid           The identifier for the data
 * @param[in]  data_length   The size in bytes of the data in p_data
 * @param[in]  p_data        A buffer containing the data
 * @param[in]  create_flags  The flags that the data will be stored with
 *
 * @return     A status indicating the success/failure of the operation
 */
psa_status_t psa_its_set(psa_storage_uid_t uid,
			 size_t data_length,
			 const void *p_data,
			 psa_storage_create_flags_t create_flags);

/**
 * @brief      Retrieve data associated with a provided UID.
 *
 * @param[in]  uid            The identifier for the data
 * @param[in]  data_offset    The starting offset of the data requested
 * @param[in]  data_size      The amount of data requested
 * @param      p_data         On success, the buffer where the data will be
 *                            placed
 * @param      p_data_length  On success, this will contain size of the data
 *                            placed in p_data
 *
 * @return     A status indicating the success/failure of the operation
 */
psa_status_t psa_its_get(psa_storage_uid_t uid,
			 size_t data_offset,
			 size_t data_size,
			 void *p_data,
			 size_t *p_data_length);

/**
 * @brief      Retrieve the metadata about the provided uid.
 *
 * @param[in]  uid     The identifier for the data
 * @param      p_info  A pointer to the psa_storage_info_t struct that will
 *                     be populated with the metadata
 *
 * @return     A status indicating the success/failure of the operation
 */
psa_status_t psa_its_get_info(psa_storage_uid_t uid,
			      struct psa_storage_info_t *p_info);

/**
 * @brief      Remove the provided key and its associated data from the storage
 *
 * @param[in]  uid   The identifier for the data
 *
 * @return     A status indicating the success/failure of the operation
 */
psa_status_t psa_its_remove(psa_storage_uid_t uid);

#ifdef __cplusplus
}
#endif

#endif /* PSA_INTERNAL_TRUSTED_STORAGE_H */