blob: 95a6b17dfe3ee6029e81bd1ade6f12a6b5fba921 [file] [log] [blame]
Ashutosh Singhf4d88672017-11-29 13:35:43 +00001/*
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +01002 * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
Ashutosh Singhf4d88672017-11-29 13:35:43 +00003 *
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
12extern "C" {
13#endif
14
15#include "tfm_sst_defs.h"
16
Ashutosh Singhf4d88672017-11-29 13:35:43 +000017/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010018 * \brief Allocates space for the asset, referenced by asset UUID,
Ashutosh Singhf4d88672017-11-29 13:35:43 +000019 * without setting any data in the asset.
20 *
21 * \param[in] app_id Application ID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010022 * \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 Singhf4d88672017-11-29 13:35:43 +000024 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010025 * \return Returns TFM_SST_ERR_SUCCESS if the asset has been created correctly.
26 * If SST area is not prepared, it returns
Ashutosh Singhf4d88672017-11-29 13:35:43 +000027 * 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 Berengue10d0d362018-06-18 14:15:56 +010031enum 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 Singhf4d88672017-11-29 13:35:43 +000034
35/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010036 * \brief Gets asset's information referenced by asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +000037 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010038 * \param[in] app_id Application ID
39 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010040 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010041 * \param[out] info Pointer to store the asset's information
42 * \ref tfm_sst_asset_info_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +000043 *
44 * \return Returns error code as specified in \ref tfm_sst_err_t
45 */
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010046enum tfm_sst_err_t tfm_sst_veneer_get_info(uint32_t app_id, uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010047 const struct tfm_sst_token_t *s_token,
48 struct tfm_sst_asset_info_t *info);
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010049
Ashutosh Singhf4d88672017-11-29 13:35:43 +000050/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010051 * \brief Gets asset's attributes referenced by asset UUID.
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010052 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010053 * \param[in] app_id Application ID
54 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010055 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010056 * \param[out] attrs Pointer to store the asset's attributes
57 * \ref tfm_sst_asset_attrs_t
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010058 *
59 * \return Returns error code as specified in \ref tfm_sst_err_t
60 */
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010061enum tfm_sst_err_t tfm_sst_veneer_get_attributes(uint32_t app_id,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010062 uint32_t asset_uuid,
63 const struct tfm_sst_token_t *s_token,
64 struct tfm_sst_asset_attrs_t *attrs);
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010065
66/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010067 * \brief Sets asset's attributes referenced by asset UUID.
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010068 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010069 * \param[in] app_id Application ID
70 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010071 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010072 * \param[in] attrs Pointer to new the asset's attributes
73 * \ref tfm_sst_asset_attrs_t
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010074 *
75 * \return Returns error code as specified in \ref tfm_sst_err_t
76 */
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010077enum tfm_sst_err_t tfm_sst_veneer_set_attributes(uint32_t app_id,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010078 uint32_t asset_uuid,
79 const struct tfm_sst_token_t *s_token,
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010080 const struct tfm_sst_asset_attrs_t *attrs);
81
82/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010083 * \brief Reads asset's data from asset referenced by asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +000084 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010085 * \param[in] app_id Application ID
86 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010087 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010088 * \param[in/out] data Pointer to data vector \ref tfm_sst_buf_t to
89 * store data, size and offset
Ashutosh Singhf4d88672017-11-29 13:35:43 +000090 *
91 * \return Returns the number of bytes written or a castable \ref tfm_sst_err_t
92 * value
93 */
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010094enum 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 Angeliseba14e12018-03-27 11:03:20 +010096 struct tfm_sst_buf_t *data);
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010097
Ashutosh Singhf4d88672017-11-29 13:35:43 +000098/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010099 * \brief Writes data into an asset referenced by asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000100 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100101 * \param[in] app_id Application ID
102 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100103 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100104 * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which
105 * contains the data to write
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000106 *
107 * \return Returns the number of bytes written or a castable \ref tfm_sst_err_t
108 * value
109 */
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100110enum 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 Angeliseba14e12018-03-27 11:03:20 +0100112 struct tfm_sst_buf_t *data);
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100113
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000114/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100115 * \brief Deletes the asset referenced by the asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000116 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100117 * \param[in] app_id Application ID
118 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100119 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000120 *
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 Berengue10d0d362018-06-18 14:15:56 +0100125enum 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 Berengue4258e542018-06-18 13:55:59 +0100127
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000128#ifdef __cplusplus
129}
130#endif
131
132#endif /* __TFM_SST_VENEERS_H__ */