blob: 033f1cb122ff7fca3214ddb787dfa1fc12826003 [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
22 * \param[in] asset_uuid Asset UUID
23 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010024 * \return Returns TFM_SST_ERR_SUCCESS if the asset has been created correctly.
25 * If SST area is not prepared, it returns
Ashutosh Singhf4d88672017-11-29 13:35:43 +000026 * TFM_SST_ERR_ASSET_NOT_PREPARED. If SST area is full, it returns
27 * TFM_SST_ERR_STORAGE_SYSTEM_FULL. If application id doesn't have the
28 * write rights, it returns TFM_SST_ERR_PERMS_NOT_ALLOWED.
29 */
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010030enum tfm_sst_err_t tfm_sst_veneer_create(uint32_t app_id, uint32_t asset_uuid);
Ashutosh Singhf4d88672017-11-29 13:35:43 +000031
32/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010033 * \brief Gets asset's information referenced by asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +000034 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010035 * \param[in] app_id Application ID
36 * \param[in] asset_uuid Asset UUID
37 * \param[out] info Pointer to store the asset's information
38 * \ref tfm_sst_asset_info_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +000039 *
40 * \return Returns error code as specified in \ref tfm_sst_err_t
41 */
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010042enum tfm_sst_err_t tfm_sst_veneer_get_info(uint32_t app_id, uint32_t asset_uuid,
43 struct tfm_sst_asset_info_t *info);
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010044
Ashutosh Singhf4d88672017-11-29 13:35:43 +000045/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010046 * \brief Gets asset's attributes referenced by asset UUID.
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010047 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010048 * \param[in] app_id Application ID
49 * \param[in] asset_uuid Asset UUID
50 * \param[out] attrs Pointer to store the asset's attributes
51 * \ref tfm_sst_asset_attrs_t
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010052 *
53 * \return Returns error code as specified in \ref tfm_sst_err_t
54 */
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010055enum tfm_sst_err_t tfm_sst_veneer_get_attributes(uint32_t app_id,
56 uint32_t asset_uuid,
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010057 struct tfm_sst_asset_attrs_t *attrs);
58
59/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010060 * \brief Sets asset's attributes referenced by asset UUID.
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010061 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010062 * \param[in] app_id Application ID
63 * \param[in] asset_uuid Asset UUID
64 * \param[in] attrs Pointer to new the asset's attributes
65 * \ref tfm_sst_asset_attrs_t
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010066 *
67 * \return Returns error code as specified in \ref tfm_sst_err_t
68 */
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010069enum tfm_sst_err_t tfm_sst_veneer_set_attributes(uint32_t app_id,
70 uint32_t asset_uuid,
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010071 const struct tfm_sst_asset_attrs_t *attrs);
72
73/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010074 * \brief Reads asset's data from asset referenced by asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +000075 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010076 * \param[in] app_id Application ID
77 * \param[in] asset_uuid Asset UUID
78 * \param[in/out] data Pointer to data vector \ref tfm_sst_buf_t to
79 * store data, size and offset
Ashutosh Singhf4d88672017-11-29 13:35:43 +000080 *
81 * \return Returns the number of bytes written or a castable \ref tfm_sst_err_t
82 * value
83 */
84enum tfm_sst_err_t tfm_sst_veneer_read(uint32_t app_id,
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010085 uint32_t asset_uuid,
Antonio de Angeliseba14e12018-03-27 11:03:20 +010086 struct tfm_sst_buf_t *data);
Ashutosh Singhf4d88672017-11-29 13:35:43 +000087/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010088 * \brief Writes data into an asset referenced by asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +000089 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010090 * \param[in] app_id Application ID
91 * \param[in] asset_uuid Asset UUID
92 * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which
93 * contains the data to write
Ashutosh Singhf4d88672017-11-29 13:35:43 +000094 *
95 * \return Returns the number of bytes written or a castable \ref tfm_sst_err_t
96 * value
97 */
98enum tfm_sst_err_t tfm_sst_veneer_write(uint32_t app_id,
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010099 uint32_t asset_uuid,
Antonio de Angeliseba14e12018-03-27 11:03:20 +0100100 struct tfm_sst_buf_t *data);
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000101/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100102 * \brief Deletes the asset referenced by the asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000103 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100104 * \param[in] app_id Application ID
105 * \param[in] asset_uuid Asset UUID
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000106 *
107 * \return Returns TFM_SST_ERR_PERMS_NOT_ALLOWED if the asset can't be deleted
108 * to by this app ID. Returns TFM_SST_ERR_ASSET_REF_INVALID, if asset
109 * no longer exists. Otherwise, TFM_SST_ERR_SUCCESS.
110 */
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100111enum tfm_sst_err_t tfm_sst_veneer_delete(uint32_t app_id, uint32_t asset_uuid);
112
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000113#ifdef __cplusplus
114}
115#endif
116
117#endif /* __TFM_SST_VENEERS_H__ */