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 | * |
Marc Moreno Berengue | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 21 | * \param[in] client_id Client ID which calls the service |
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 | 7d053a3 | 2018-06-27 18:22:14 +0100 | [diff] [blame] | 25 | * \return Returns PSA_SST_ERR_SUCCESS if the asset has been created correctly. |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 26 | * If SST area is not prepared, it returns |
Marc Moreno Berengue | 7d053a3 | 2018-06-27 18:22:14 +0100 | [diff] [blame] | 27 | * PSA_SST_ERR_ASSET_NOT_PREPARED. If SST area is full, it returns |
| 28 | * PSA_SST_ERR_STORAGE_SYSTEM_FULL. If application id doesn't have the |
| 29 | * write rights, it returns PSA_SST_ERR_PERMS_NOT_ALLOWED. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 30 | */ |
Marc Moreno Berengue | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 31 | enum psa_sst_err_t tfm_sst_veneer_create(int32_t client_id, |
| 32 | uint32_t asset_uuid, |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 33 | const struct tfm_sst_token_t *s_token); |
| 34 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 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 | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 38 | * \param[in] client_id Client ID which calls the service |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 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 |
Marc Moreno Berengue | 7d053a3 | 2018-06-27 18:22:14 +0100 | [diff] [blame] | 42 | * \ref psa_sst_asset_info_t |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 43 | * |
Marc Moreno Berengue | 7d053a3 | 2018-06-27 18:22:14 +0100 | [diff] [blame] | 44 | * \return Returns error code as specified in \ref psa_sst_err_t |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 45 | */ |
Marc Moreno Berengue | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 46 | enum psa_sst_err_t tfm_sst_veneer_get_info(int32_t client_id, |
| 47 | uint32_t asset_uuid, |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 48 | const struct tfm_sst_token_t *s_token, |
Marc Moreno Berengue | 7d053a3 | 2018-06-27 18:22:14 +0100 | [diff] [blame] | 49 | struct psa_sst_asset_info_t *info); |
Marc Moreno Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame] | 50 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 51 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 52 | * \brief Gets asset's attributes referenced by asset UUID. |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 53 | * |
Marc Moreno Berengue | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 54 | * \param[in] client_id Client ID which calls the service |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 55 | * \param[in] asset_uuid Asset UUID |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 56 | * \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] | 57 | * \param[out] attrs Pointer to store the asset's attributes |
| 58 | * \ref tfm_sst_asset_attrs_t |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 59 | * |
Marc Moreno Berengue | 7d053a3 | 2018-06-27 18:22:14 +0100 | [diff] [blame] | 60 | * \return Returns error code as specified in \ref psa_sst_err_t |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 61 | */ |
Marc Moreno Berengue | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 62 | enum psa_sst_err_t tfm_sst_veneer_get_attributes(int32_t client_id, |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 63 | uint32_t asset_uuid, |
| 64 | const struct tfm_sst_token_t *s_token, |
Marc Moreno Berengue | 7d053a3 | 2018-06-27 18:22:14 +0100 | [diff] [blame] | 65 | struct psa_sst_asset_attrs_t *attrs); |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 66 | |
| 67 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 68 | * \brief Sets asset's attributes referenced by asset UUID. |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 69 | * |
Marc Moreno Berengue | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 70 | * \param[in] client_id Client ID which calls the service |
| 71 | * \param[in] asset_uuid Asset UUID |
| 72 | * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t |
| 73 | * \param[in] attrs Pointer to new the asset's attributes |
| 74 | * \ref psa_sst_asset_attrs_t |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 75 | * |
Marc Moreno Berengue | 7d053a3 | 2018-06-27 18:22:14 +0100 | [diff] [blame] | 76 | * \return Returns error code as specified in \ref psa_sst_err_t |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 77 | */ |
Marc Moreno Berengue | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 78 | enum psa_sst_err_t tfm_sst_veneer_set_attributes(int32_t client_id, |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 79 | uint32_t asset_uuid, |
| 80 | const struct tfm_sst_token_t *s_token, |
Marc Moreno Berengue | 7d053a3 | 2018-06-27 18:22:14 +0100 | [diff] [blame] | 81 | const struct psa_sst_asset_attrs_t *attrs); |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 82 | |
| 83 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 84 | * \brief Reads asset's data from asset referenced by asset UUID. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 85 | * |
Marc Moreno Berengue | f398da2 | 2018-07-12 11:47:54 +0100 | [diff] [blame^] | 86 | |
| 87 | * \param[in] client_id Client ID which calls the service. |
| 88 | * In case, the caller is a secure partition, this |
| 89 | * parameter can be a non-secure or secure client ID |
| 90 | * if the read is in behalf of that client. |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 91 | * \param[in] asset_uuid Asset UUID |
Marc Moreno Berengue | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 92 | * \param[in] s_token Pointer to the asset's token |
| 93 | * \ref tfm_sst_token_t |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 94 | * \param[in/out] data Pointer to data vector \ref tfm_sst_buf_t to |
| 95 | * store data, size and offset |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 96 | * |
Marc Moreno Berengue | 7d053a3 | 2018-06-27 18:22:14 +0100 | [diff] [blame] | 97 | * \return Returns the number of bytes written or a castable \ref psa_sst_err_t |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 98 | * value |
| 99 | */ |
Marc Moreno Berengue | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 100 | enum psa_sst_err_t tfm_sst_veneer_read(int32_t client_id, |
| 101 | uint32_t asset_uuid, |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 102 | const struct tfm_sst_token_t *s_token, |
Antonio de Angelis | eba14e1 | 2018-03-27 11:03:20 +0100 | [diff] [blame] | 103 | struct tfm_sst_buf_t *data); |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 104 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 105 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 106 | * \brief Writes data into an asset referenced by asset UUID. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 107 | * |
Marc Moreno Berengue | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 108 | * \param[in] client_id Client ID which calls the service |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 109 | * \param[in] asset_uuid Asset UUID |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 110 | * \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] | 111 | * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which |
| 112 | * contains the data to write |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 113 | * |
Marc Moreno Berengue | 7d053a3 | 2018-06-27 18:22:14 +0100 | [diff] [blame] | 114 | * \return Returns the number of bytes written or a castable \ref psa_sst_err_t |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 115 | * value |
| 116 | */ |
Marc Moreno Berengue | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 117 | enum psa_sst_err_t tfm_sst_veneer_write(int32_t client_id, |
| 118 | uint32_t asset_uuid, |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 119 | const struct tfm_sst_token_t *s_token, |
Antonio de Angelis | eba14e1 | 2018-03-27 11:03:20 +0100 | [diff] [blame] | 120 | struct tfm_sst_buf_t *data); |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 121 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 122 | /** |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 123 | * \brief Deletes the asset referenced by the asset UUID. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 124 | * |
Marc Moreno Berengue | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 125 | * \param[in] client_id Client ID which calls the service |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame] | 126 | * \param[in] asset_uuid Asset UUID |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 127 | * \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] | 128 | * |
Marc Moreno Berengue | 7d053a3 | 2018-06-27 18:22:14 +0100 | [diff] [blame] | 129 | * \return Returns PSA_SST_ERR_PERMS_NOT_ALLOWED if the asset can't be deleted |
| 130 | * to by this app ID. Returns PSA_SST_ERR_ASSET_REF_INVALID, if asset |
| 131 | * no longer exists. Otherwise, PSA_SST_ERR_SUCCESS. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 132 | */ |
Marc Moreno Berengue | b391976 | 2018-07-11 14:25:42 +0100 | [diff] [blame] | 133 | enum psa_sst_err_t tfm_sst_veneer_delete(int32_t client_id, |
| 134 | uint32_t asset_uuid, |
Marc Moreno Berengue | 10d0d36 | 2018-06-18 14:15:56 +0100 | [diff] [blame] | 135 | const struct tfm_sst_token_t *s_token); |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 136 | #ifdef __cplusplus |
| 137 | } |
| 138 | #endif |
| 139 | |
| 140 | #endif /* __TFM_SST_VENEERS_H__ */ |