blob: 80bb3ebe22861bbb3ee030422830859a5f2a4f50 [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 Berengue7d053a32018-06-27 18:22:14 +010025 * \return Returns PSA_SST_ERR_SUCCESS if the asset has been created correctly.
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010026 * If SST area is not prepared, it returns
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010027 * 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 Singhf4d88672017-11-29 13:35:43 +000030 */
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010031enum psa_sst_err_t tfm_sst_veneer_create(uint32_t app_id, uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010032 const struct tfm_sst_token_t *s_token);
33
Ashutosh Singhf4d88672017-11-29 13:35:43 +000034/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010035 * \brief Gets asset's information referenced by asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +000036 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010037 * \param[in] app_id Application ID
38 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010039 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010040 * \param[out] info Pointer to store the asset's information
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010041 * \ref psa_sst_asset_info_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +000042 *
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010043 * \return Returns error code as specified in \ref psa_sst_err_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +000044 */
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010045enum psa_sst_err_t tfm_sst_veneer_get_info(uint32_t app_id, uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010046 const struct tfm_sst_token_t *s_token,
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010047 struct psa_sst_asset_info_t *info);
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010048
Ashutosh Singhf4d88672017-11-29 13:35:43 +000049/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010050 * \brief Gets asset's attributes referenced by asset UUID.
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010051 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010052 * \param[in] app_id Application ID
53 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010054 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010055 * \param[out] attrs Pointer to store the asset's attributes
56 * \ref tfm_sst_asset_attrs_t
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010057 *
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010058 * \return Returns error code as specified in \ref psa_sst_err_t
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010059 */
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010060enum psa_sst_err_t tfm_sst_veneer_get_attributes(uint32_t app_id,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010061 uint32_t asset_uuid,
62 const struct tfm_sst_token_t *s_token,
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010063 struct psa_sst_asset_attrs_t *attrs);
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010064
65/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010066 * \brief Sets asset's attributes referenced by asset UUID.
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010067 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010068 * \param[in] app_id Application ID
69 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010070 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010071 * \param[in] attrs Pointer to new the asset's attributes
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010072 * \ref psa_sst_asset_attrs_t
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010073 *
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010074 * \return Returns error code as specified in \ref psa_sst_err_t
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010075 */
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010076enum psa_sst_err_t tfm_sst_veneer_set_attributes(uint32_t app_id,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010077 uint32_t asset_uuid,
78 const struct tfm_sst_token_t *s_token,
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010079 const struct psa_sst_asset_attrs_t *attrs);
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010080
81/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010082 * \brief Reads asset's data from asset referenced by asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +000083 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010084 * \param[in] app_id Application ID
85 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010086 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010087 * \param[in/out] data Pointer to data vector \ref tfm_sst_buf_t to
88 * store data, size and offset
Ashutosh Singhf4d88672017-11-29 13:35:43 +000089 *
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010090 * \return Returns the number of bytes written or a castable \ref psa_sst_err_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +000091 * value
92 */
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010093enum psa_sst_err_t tfm_sst_veneer_read(uint32_t app_id, uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010094 const struct tfm_sst_token_t *s_token,
Antonio de Angeliseba14e12018-03-27 11:03:20 +010095 struct tfm_sst_buf_t *data);
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010096
Ashutosh Singhf4d88672017-11-29 13:35:43 +000097/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010098 * \brief Writes data into an asset referenced by asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +000099 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100100 * \param[in] app_id Application ID
101 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100102 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100103 * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which
104 * contains the data to write
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000105 *
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +0100106 * \return Returns the number of bytes written or a castable \ref psa_sst_err_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000107 * value
108 */
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +0100109enum psa_sst_err_t tfm_sst_veneer_write(uint32_t app_id, uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100110 const struct tfm_sst_token_t *s_token,
Antonio de Angeliseba14e12018-03-27 11:03:20 +0100111 struct tfm_sst_buf_t *data);
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100112
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000113/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100114 * \brief Deletes the asset referenced by the asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000115 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100116 * \param[in] app_id Application ID
117 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100118 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000119 *
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +0100120 * \return Returns PSA_SST_ERR_PERMS_NOT_ALLOWED if the asset can't be deleted
121 * to by this app ID. Returns PSA_SST_ERR_ASSET_REF_INVALID, if asset
122 * no longer exists. Otherwise, PSA_SST_ERR_SUCCESS.
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000123 */
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +0100124enum psa_sst_err_t tfm_sst_veneer_delete(uint32_t app_id, uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100125 const struct tfm_sst_token_t *s_token);
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000126#ifdef __cplusplus
127}
128#endif
129
130#endif /* __TFM_SST_VENEERS_H__ */