Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 1 | /* |
Marc Moreno Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame] | 2 | * Copyright (c) 2017-2018, Arm Limited. All rights reserved. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef __TFM_SST_VENEERS_H__ |
| 9 | #define __TFM_SST_VENEERS_H__ |
| 10 | |
| 11 | #ifdef __cplusplus |
| 12 | extern "C" { |
| 13 | #endif |
| 14 | |
| 15 | #include "tfm_sst_defs.h" |
| 16 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 17 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 18 | * \brief Allocates space for the asset, referenced by asset UUID, |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 19 | * without setting any data in the asset. |
| 20 | * |
| 21 | * \param[in] app_id Application ID |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 22 | * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t |
| 23 | * \param[in] asset_uuid Asset UUID \ref tfm_sst_asset_id_t |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 24 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 25 | * \return Returns TFM_SST_ERR_SUCCESS if the asset has been created correctly. |
| 26 | * If SST area is not prepared, it returns |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 27 | * TFM_SST_ERR_ASSET_NOT_PREPARED. If SST area is full, it returns |
| 28 | * TFM_SST_ERR_STORAGE_SYSTEM_FULL. If application id doesn't have the |
| 29 | * write rights, it returns TFM_SST_ERR_PERMS_NOT_ALLOWED. |
| 30 | */ |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 31 | enum tfm_sst_err_t tfm_sst_veneer_create(uint32_t app_id, uint32_t asset_uuid, |
| 32 | const struct tfm_sst_token_t *s_token); |
| 33 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 34 | |
| 35 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 36 | * \brief Gets asset's information referenced by asset UUID. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 37 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 38 | * \param[in] app_id Application ID |
| 39 | * \param[in] asset_uuid Asset UUID |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 40 | * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 41 | * \param[out] info Pointer to store the asset's information |
| 42 | * \ref tfm_sst_asset_info_t |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 43 | * |
| 44 | * \return Returns error code as specified in \ref tfm_sst_err_t |
| 45 | */ |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 46 | enum tfm_sst_err_t tfm_sst_veneer_get_info(uint32_t app_id, uint32_t asset_uuid, |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 47 | const struct tfm_sst_token_t *s_token, |
| 48 | struct tfm_sst_asset_info_t *info); |
Marc Moreno Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame] | 49 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 50 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 51 | * \brief Gets asset's attributes referenced by asset UUID. |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 52 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 53 | * \param[in] app_id Application ID |
| 54 | * \param[in] asset_uuid Asset UUID |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 55 | * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 56 | * \param[out] attrs Pointer to store the asset's attributes |
| 57 | * \ref tfm_sst_asset_attrs_t |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 58 | * |
| 59 | * \return Returns error code as specified in \ref tfm_sst_err_t |
| 60 | */ |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 61 | enum tfm_sst_err_t tfm_sst_veneer_get_attributes(uint32_t app_id, |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 62 | uint32_t asset_uuid, |
| 63 | const struct tfm_sst_token_t *s_token, |
| 64 | struct tfm_sst_asset_attrs_t *attrs); |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 65 | |
| 66 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 67 | * \brief Sets asset's attributes referenced by asset UUID. |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 68 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 69 | * \param[in] app_id Application ID |
| 70 | * \param[in] asset_uuid Asset UUID |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 71 | * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 72 | * \param[in] attrs Pointer to new the asset's attributes |
| 73 | * \ref tfm_sst_asset_attrs_t |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 74 | * |
| 75 | * \return Returns error code as specified in \ref tfm_sst_err_t |
| 76 | */ |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 77 | enum tfm_sst_err_t tfm_sst_veneer_set_attributes(uint32_t app_id, |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 78 | uint32_t asset_uuid, |
| 79 | const struct tfm_sst_token_t *s_token, |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 80 | const struct tfm_sst_asset_attrs_t *attrs); |
| 81 | |
| 82 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 83 | * \brief Reads asset's data from asset referenced by asset UUID. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 84 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 85 | * \param[in] app_id Application ID |
| 86 | * \param[in] asset_uuid Asset UUID |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 87 | * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 88 | * \param[in/out] data Pointer to data vector \ref tfm_sst_buf_t to |
| 89 | * store data, size and offset |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 90 | * |
| 91 | * \return Returns the number of bytes written or a castable \ref tfm_sst_err_t |
| 92 | * value |
| 93 | */ |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 94 | enum tfm_sst_err_t tfm_sst_veneer_read(uint32_t app_id, uint32_t asset_uuid, |
| 95 | const struct tfm_sst_token_t *s_token, |
Antonio de Angelis | eba14e1 | 2018-03-27 11:03:20 +0100 | [diff] [blame] | 96 | struct tfm_sst_buf_t *data); |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 97 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 98 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 99 | * \brief Writes data into an asset referenced by asset UUID. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 100 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 101 | * \param[in] app_id Application ID |
| 102 | * \param[in] asset_uuid Asset UUID |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 103 | * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 104 | * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which |
| 105 | * contains the data to write |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 106 | * |
| 107 | * \return Returns the number of bytes written or a castable \ref tfm_sst_err_t |
| 108 | * value |
| 109 | */ |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 110 | enum tfm_sst_err_t tfm_sst_veneer_write(uint32_t app_id, uint32_t asset_uuid, |
| 111 | const struct tfm_sst_token_t *s_token, |
Antonio de Angelis | eba14e1 | 2018-03-27 11:03:20 +0100 | [diff] [blame] | 112 | struct tfm_sst_buf_t *data); |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 113 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 114 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 115 | * \brief Deletes the asset referenced by the asset UUID. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 116 | * |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 117 | * \param[in] app_id Application ID |
| 118 | * \param[in] asset_uuid Asset UUID |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 119 | * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 120 | * |
| 121 | * \return Returns TFM_SST_ERR_PERMS_NOT_ALLOWED if the asset can't be deleted |
| 122 | * to by this app ID. Returns TFM_SST_ERR_ASSET_REF_INVALID, if asset |
| 123 | * no longer exists. Otherwise, TFM_SST_ERR_SUCCESS. |
| 124 | */ |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 125 | enum tfm_sst_err_t tfm_sst_veneer_delete(uint32_t app_id, uint32_t asset_uuid, |
| 126 | const struct tfm_sst_token_t *s_token); |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 127 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 128 | #ifdef __cplusplus |
| 129 | } |
| 130 | #endif |
| 131 | |
| 132 | #endif /* __TFM_SST_VENEERS_H__ */ |