blob: 6cfd5c1338702eb84db9e7d239b8acacef401a3a [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 *
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010021 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
22 * \param[in] asset_uuid Asset UUID \ref tfm_sst_asset_id_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +000023 *
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010024 * \return Returns PSA_SST_ERR_SUCCESS if the asset has been created correctly.
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010025 * If SST area is not prepared, it returns
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010026 * PSA_SST_ERR_ASSET_NOT_PREPARED. If SST area is full, it returns
27 * PSA_SST_ERR_STORAGE_SYSTEM_FULL. If application id doesn't have the
28 * write rights, it returns PSA_SST_ERR_PERMS_NOT_ALLOWED.
Ashutosh Singhf4d88672017-11-29 13:35:43 +000029 */
Mate Toth-Pal261df462018-08-07 12:02:42 +020030enum psa_sst_err_t tfm_sst_veneer_create(uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010031 const struct tfm_sst_token_t *s_token);
32
Ashutosh Singhf4d88672017-11-29 13:35:43 +000033/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010034 * \brief Gets asset's information referenced by asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +000035 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010036 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010037 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010038 * \param[out] info Pointer to store the asset's information
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010039 * \ref psa_sst_asset_info_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +000040 *
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010041 * \return Returns error code as specified in \ref psa_sst_err_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +000042 */
Mate Toth-Pal261df462018-08-07 12:02:42 +020043enum psa_sst_err_t tfm_sst_veneer_get_info(uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010044 const struct tfm_sst_token_t *s_token,
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010045 struct psa_sst_asset_info_t *info);
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010046
Ashutosh Singhf4d88672017-11-29 13:35:43 +000047/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010048 * \brief Gets asset's attributes referenced by asset UUID.
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010049 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010050 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010051 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010052 * \param[out] attrs Pointer to store the asset's attributes
53 * \ref tfm_sst_asset_attrs_t
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010054 *
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010055 * \return Returns error code as specified in \ref psa_sst_err_t
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010056 */
Mate Toth-Pal261df462018-08-07 12:02:42 +020057enum psa_sst_err_t tfm_sst_veneer_get_attributes(uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010058 const struct tfm_sst_token_t *s_token,
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010059 struct psa_sst_asset_attrs_t *attrs);
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010060
61/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010062 * \brief Sets asset's attributes referenced by asset UUID.
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010063 *
Marc Moreno Berengueb3919762018-07-11 14:25:42 +010064 * \param[in] asset_uuid Asset UUID
65 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
66 * \param[in] attrs Pointer to new the asset's attributes
67 * \ref psa_sst_asset_attrs_t
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010068 *
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010069 * \return Returns error code as specified in \ref psa_sst_err_t
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010070 */
Mate Toth-Pal261df462018-08-07 12:02:42 +020071enum psa_sst_err_t tfm_sst_veneer_set_attributes(uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010072 const struct tfm_sst_token_t *s_token,
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010073 const struct psa_sst_asset_attrs_t *attrs);
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010074
75/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010076 * \brief Reads asset's data from asset referenced by asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +000077 *
Marc Moreno Berenguef398da22018-07-12 11:47:54 +010078
79 * \param[in] client_id Client ID which calls the service.
80 * In case, the caller is a secure partition, this
81 * parameter can be a non-secure or secure client ID
82 * if the read is in behalf of that client.
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010083 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengueb3919762018-07-11 14:25:42 +010084 * \param[in] s_token Pointer to the asset's token
85 * \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010086 * \param[in/out] data Pointer to data vector \ref tfm_sst_buf_t to
87 * store data, size and offset
Ashutosh Singhf4d88672017-11-29 13:35:43 +000088 *
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +010089 * \return Returns the number of bytes written or a castable \ref psa_sst_err_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +000090 * value
91 */
Marc Moreno Berengueb3919762018-07-11 14:25:42 +010092enum psa_sst_err_t tfm_sst_veneer_read(int32_t client_id,
93 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] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100101 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100102 * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which
103 * contains the data to write
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000104 *
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +0100105 * \return Returns the number of bytes written or a castable \ref psa_sst_err_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000106 * value
107 */
Mate Toth-Pal261df462018-08-07 12:02:42 +0200108enum psa_sst_err_t tfm_sst_veneer_write(uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100109 const struct tfm_sst_token_t *s_token,
Antonio de Angeliseba14e12018-03-27 11:03:20 +0100110 struct tfm_sst_buf_t *data);
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100111
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000112/**
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100113 * \brief Deletes the asset referenced by the asset UUID.
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000114 *
Marc Moreno Berengue4258e542018-06-18 13:55:59 +0100115 * \param[in] asset_uuid Asset UUID
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100116 * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000117 *
Marc Moreno Berengue7d053a32018-06-27 18:22:14 +0100118 * \return Returns PSA_SST_ERR_PERMS_NOT_ALLOWED if the asset can't be deleted
119 * to by this app ID. Returns PSA_SST_ERR_ASSET_REF_INVALID, if asset
120 * no longer exists. Otherwise, PSA_SST_ERR_SUCCESS.
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000121 */
Mate Toth-Pal261df462018-08-07 12:02:42 +0200122enum psa_sst_err_t tfm_sst_veneer_delete(uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +0100123 const struct tfm_sst_token_t *s_token);
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000124#ifdef __cplusplus
125}
126#endif
127
128#endif /* __TFM_SST_VENEERS_H__ */