1 /* 2 * Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef PSA_INTERNAL_TRUSTED_STORAGE_H 8 #define PSA_INTERNAL_TRUSTED_STORAGE_H 9 10 #include <psa/error.h> 11 #include <psa/storage_common.h> 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 #ifdef EXPORT_PUBLIC_INTERFACE_PSA_ITS 18 #define PSA_ITS_EXPORTED __attribute__((__visibility__("default"))) 19 #else 20 #define PSA_ITS_EXPORTED 21 #endif 22 23 /** 24 * The major version number of the PSA ITS API. It will be incremented on 25 * significant updates that may include breaking changes. 26 */ 27 #define PSA_ITS_API_VERSION_MAJOR 1 28 29 /** 30 * The minor version number of the PSA ITS API. It will be incremented in 31 * small updates that are unlikely to include breaking changes. 32 */ 33 #define PSA_ITS_API_VERSION_MINOR 0 34 35 /** 36 * @brief Create a new, or modify an existing, uid /value pair. 37 * 38 * @param[in] uid The identifier for the data 39 * @param[in] data_length The size in bytes of the data in p_data 40 * @param[in] p_data A buffer containing the data 41 * @param[in] create_flags The flags that the data will be stored with 42 * 43 * @return A status indicating the success/failure of the operation 44 */ 45 PSA_ITS_EXPORTED psa_status_t psa_its_set(psa_storage_uid_t uid, size_t data_length, 46 const void *p_data, 47 psa_storage_create_flags_t create_flags); 48 49 /** 50 * @brief Retrieve data associated with a provided UID. 51 * 52 * @param[in] uid The identifier for the data 53 * @param[in] data_offset The starting offset of the data requested 54 * @param[in] data_size The amount of data requested 55 * @param p_data On success, the buffer where the data will be 56 * placed 57 * @param p_data_length On success, this will contain size of the data 58 * placed in p_data 59 * 60 * @return A status indicating the success/failure of the operation 61 */ 62 PSA_ITS_EXPORTED psa_status_t psa_its_get(psa_storage_uid_t uid, size_t data_offset, 63 size_t data_size, void *p_data, size_t *p_data_length); 64 65 /** 66 * @brief Retrieve the metadata about the provided uid. 67 * 68 * @param[in] uid The identifier for the data 69 * @param p_info A pointer to the psa_storage_info_t struct that will 70 * be populated with the metadata 71 * 72 * @return A status indicating the success/failure of the operation 73 */ 74 PSA_ITS_EXPORTED psa_status_t psa_its_get_info(psa_storage_uid_t uid, 75 struct psa_storage_info_t *p_info); 76 77 /** 78 * @brief Remove the provided key and its associated data from the storage 79 * 80 * @param[in] uid The identifier for the data 81 * 82 * @return A status indicating the success/failure of the operation 83 */ 84 PSA_ITS_EXPORTED psa_status_t psa_its_remove(psa_storage_uid_t uid); 85 86 #ifdef __cplusplus 87 } 88 #endif 89 90 #endif /* PSA_INTERNAL_TRUSTED_STORAGE_H */ 91