SST: Rename get_attributes APIs to get_info
This patch renames get_attributes functions to get_info, and updates
the SST code as follows:
- rename tfm_sst_attribs_t to tfm_sst_asset_info_t
- rename sst_asset_infoi_t to sst_asset_policy_t in
sst_asset_management
- add sst_core_obj_info_t in sst_core
- update sst service APIs and code to accomodate it to the new types
and type names
- update dependant tests to accomodate them to the new names
Change-Id: Ifa0e56c3c15c7de40d6af4aa3f96c8bd7eae85f2
Signed-off-by: Marc Moreno <marc.morenoberengue@arm.com>
diff --git a/interface/include/tfm_ns_svc.h b/interface/include/tfm_ns_svc.h
index 178e75c..28c7589 100644
--- a/interface/include/tfm_ns_svc.h
+++ b/interface/include/tfm_ns_svc.h
@@ -43,7 +43,7 @@
#define LIST_SVC_DISPATCHERS \
X(SVC_TFM_SST_GET_HANDLE, tfm_sst_svc_get_handle) \
X(SVC_TFM_SST_CREATE, tfm_sst_svc_create) \
- X(SVC_TFM_SST_GET_ATTRIBUTES, tfm_sst_svc_get_attributes) \
+ X(SVC_TFM_SST_GET_INFO, tfm_sst_svc_get_info) \
X(SVC_TFM_SST_READ, tfm_sst_svc_read) \
X(SVC_TFM_SST_WRITE, tfm_sst_svc_write) \
X(SVC_TFM_SST_DELETE, tfm_sst_svc_delete) \
diff --git a/interface/include/tfm_sst_api.h b/interface/include/tfm_sst_api.h
index 66865ac..d22653c 100644
--- a/interface/include/tfm_sst_api.h
+++ b/interface/include/tfm_sst_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 - 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -40,16 +40,16 @@
enum tfm_sst_err_t tfm_sst_create(uint16_t asset_uuid);
/**
- * \brief Gets asset's attributes referenced by asset handler.
- * Uses cached metadata to return the size and write offset of an asset.
+ * \brief Gets asset's information referenced by asset handler.
*
* \param[in] asset_handle Asset handler
- * \param[out] attrib_struct Pointer to store the asset's attribute
+ * \param[out] info Pointer to store the asset's information
+ * \ref tfm_sst_asset_info_t
*
* \return Returns error code as specified in \ref tfm_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_get_attributes(uint32_t asset_handle,
- struct tfm_sst_attribs_t* attrib_struct);
+enum tfm_sst_err_t tfm_sst_get_info(uint32_t asset_handle,
+ struct tfm_sst_asset_info_t *info);
/**
* \brief Reads asset's data from asset referenced by asset handler.
diff --git a/interface/include/tfm_sst_defs.h b/interface/include/tfm_sst_defs.h
index e3b3112..83ac62d 100644
--- a/interface/include/tfm_sst_defs.h
+++ b/interface/include/tfm_sst_defs.h
@@ -52,18 +52,32 @@
TFM_SST_ERR_FORCE_INT_SIZE = INT_MAX
};
-struct tfm_sst_attribs_t {
- uint32_t size_current; /*!< The current size of the asset */
- uint32_t size_max; /*!< The maximum size of the asset in bytes */
+/*!
+ * \struct tfm_sst_asset_info_t
+ *
+ * \brief Structure to store the asset information concerning the content
+ * information.
+ *
+ */
+struct tfm_sst_asset_info_t {
+ uint32_t size_current; /*!< The current size of the asset data */
+ uint32_t size_max; /*!< The maximum size of the asset data in bytes */
};
-/* Structure to store data information to read/write from/to asset */
+/*!
+ * \struct tfm_sst_buf_t
+ *
+ * \brief Structure to store data information to read/write from/to asset.
+ *
+ */
struct tfm_sst_buf_t {
- uint8_t* data; /*!< Address of input/output data */
+ uint8_t *data; /*!< Address of input/output data */
uint32_t size; /*!< Size of input/output data */
uint32_t offset; /*!< Offset within asset */
};
+#define TFM_SST_ASSET_INFO_SIZE sizeof(struct tfm_sst_asset_info_t)
+
#ifdef __cplusplus
}
#endif
diff --git a/interface/include/tfm_sst_svc_handler.h b/interface/include/tfm_sst_svc_handler.h
index 808c0ea..b983869 100644
--- a/interface/include/tfm_sst_svc_handler.h
+++ b/interface/include/tfm_sst_svc_handler.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -40,16 +40,16 @@
enum tfm_sst_err_t tfm_sst_svc_create(uint16_t asset_uuid);
/**
- * \brief SVC funtion to get asset's attributes referenced by asset handler.
- * Uses cached metadata to return the size and write offset of an asset.
+ * \brief SVC funtion to get asset's information referenced by asset handler.
*
* \param[in] asset_handle Asset handler
- * \param[out] attrib_struct Pointer to store asset's attribute
+ * \param[out] info Pointer to store the asset's information
+ * \ref tfm_sst_asset_info_t
*
* \return Returns error code as specified in \ref tfm_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_svc_get_attributes(uint32_t asset_handle,
- struct tfm_sst_attribs_t* attrib_struct);
+enum tfm_sst_err_t tfm_sst_svc_get_info(uint32_t asset_handle,
+ struct tfm_sst_asset_info_t *info);
/**
* \brief SVC funtion to read asset's data from asset referenced by asset
diff --git a/interface/include/tfm_sst_veneers.h b/interface/include/tfm_sst_veneers.h
index db11d4e..b76abbf 100644
--- a/interface/include/tfm_sst_veneers.h
+++ b/interface/include/tfm_sst_veneers.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 - 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -45,19 +45,19 @@
enum tfm_sst_err_t tfm_sst_veneer_create(uint32_t app_id, uint16_t asset_uuid);
/**
- * \brief Gets asset's attributes referenced by asset handler.
- * Uses cached metadata to return the size and write offset of an asset.
+ * \brief Gets asset's information referenced by asset handler.
*
- * \param[in] app_id Application ID
- * \param[in] asset_handle Asset handler
- * \param[out] attrib_struct Pointer to asset attribute struct
+ * \param[in] app_id Application ID
+ * \param[in] asset_handle Asset handler
+ * \param[out] info Pointer to store the asset's information
+ * \ref tfm_sst_asset_info_t
*
* \return Returns error code as specified in \ref tfm_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_veneer_get_attributes(
- uint32_t app_id,
- uint32_t asset_handle,
- struct tfm_sst_attribs_t *attrib_struct);
+enum tfm_sst_err_t tfm_sst_veneer_get_info(uint32_t app_id,
+ uint32_t asset_handle,
+ struct tfm_sst_asset_info_t *info);
+
/**
* \brief Reads asset's data from asset referenced by asset handler.
*
diff --git a/interface/src/tfm_sst_api.c b/interface/src/tfm_sst_api.c
index fb13ed0..99d9d38 100644
--- a/interface/src/tfm_sst_api.c
+++ b/interface/src/tfm_sst_api.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -26,12 +26,12 @@
0);
}
-enum tfm_sst_err_t tfm_sst_get_attributes(uint32_t asset_handle,
- struct tfm_sst_attribs_t* attrib_struct)
+enum tfm_sst_err_t tfm_sst_get_info(uint32_t asset_handle,
+ struct tfm_sst_asset_info_t *info)
{
- return tfm_ns_lock_svc_dispatch(SVC_TFM_SST_GET_ATTRIBUTES,
- (uint32_t)asset_handle,
- (uint32_t)attrib_struct,
+ return tfm_ns_lock_svc_dispatch(SVC_TFM_SST_GET_INFO,
+ asset_handle,
+ (uint32_t)info,
0,
0);
}
diff --git a/interface/src/tfm_sst_svc_handler.c b/interface/src/tfm_sst_svc_handler.c
index c10432e..31ca9bd 100644
--- a/interface/src/tfm_sst_svc_handler.c
+++ b/interface/src/tfm_sst_svc_handler.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -30,14 +30,14 @@
return tfm_sst_veneer_create(app_id, asset_uuid);
}
-enum tfm_sst_err_t tfm_sst_svc_get_attributes(uint32_t asset_handle,
- struct tfm_sst_attribs_t* attrib_struct)
+enum tfm_sst_err_t tfm_sst_svc_get_info(uint32_t asset_handle,
+ struct tfm_sst_asset_info_t *info)
{
uint32_t app_id;
app_id = tfm_sst_get_cur_id();
- return tfm_sst_veneer_get_attributes(app_id, asset_handle, attrib_struct);
+ return tfm_sst_veneer_get_info(app_id, asset_handle, info);
}
enum tfm_sst_err_t tfm_sst_svc_read(uint32_t asset_handle,
diff --git a/secure_fw/ns_callable/tfm_sst_veneers.c b/secure_fw/ns_callable/tfm_sst_veneers.c
index 76fa9a7..6907eec 100644
--- a/secure_fw/ns_callable/tfm_sst_veneers.c
+++ b/secure_fw/ns_callable/tfm_sst_veneers.c
@@ -28,13 +28,12 @@
}
__tfm_secure_gateway_attributes__
-enum tfm_sst_err_t tfm_sst_veneer_get_attributes(
- uint32_t app_id,
- uint32_t asset_handle,
- struct tfm_sst_attribs_t *attrib)
+enum tfm_sst_err_t tfm_sst_veneer_get_info(uint32_t app_id,
+ uint32_t asset_handle,
+ struct tfm_sst_asset_info_t *info)
{
- TFM_CORE_SFN_REQUEST(TFM_SP_STORAGE_ID, sst_am_get_attributes,
- app_id, asset_handle, attrib, 0);
+ TFM_CORE_SFN_REQUEST(TFM_SP_STORAGE_ID, sst_am_get_info,
+ app_id, asset_handle, info, 0);
}
__tfm_secure_gateway_attributes__
@@ -59,4 +58,3 @@
TFM_CORE_SFN_REQUEST(TFM_SP_STORAGE_ID, sst_am_delete, app_id,
asset_handle, 0, 0);
}
-
diff --git a/secure_fw/services/secure_storage/assets/sst_asset_defs.c b/secure_fw/services/secure_storage/assets/sst_asset_defs.c
index a2d143e..ed1f781 100644
--- a/secure_fw/services/secure_storage/assets/sst_asset_defs.c
+++ b/secure_fw/services/secure_storage/assets/sst_asset_defs.c
@@ -8,7 +8,7 @@
#include "sst_asset_defs.h"
#include "secure_fw/services/secure_storage/sst_asset_management.h"
-struct sst_asset_info_t asset_perms[] = {
+struct sst_asset_policy_t asset_perms[] = {
{
.asset_uuid = SST_ASSET_ID_AES_KEY_128,
.max_size = SST_ASSET_MAX_SIZE_AES_KEY_128,
diff --git a/secure_fw/services/secure_storage/manifest.yaml b/secure_fw/services/secure_storage/manifest.yaml
index e4db1d0..de893f1 100644
--- a/secure_fw/services/secure_storage/manifest.yaml
+++ b/secure_fw/services/secure_storage/manifest.yaml
@@ -34,9 +34,9 @@
"minor_policy": "strict"
},
{
- "sfid": "SST_AM_GET_ATTRIBUTES_SFID",
- "signal": "SST_AM_GET_ATTRIBUTES",
- "tfm_symbol": "sst_am_get_attributes",
+ "sfid": "SST_AM_GET_INFO_SFID",
+ "signal": "SST_AM_GET_INFO",
+ "tfm_symbol": "sst_am_get_info",
"non_secure_clients": true,
"minor_version": 1,
"minor_policy": "strict"
diff --git a/secure_fw/services/secure_storage/sst_asset_management.c b/secure_fw/services/secure_storage/sst_asset_management.c
index bf3a984..30174bd 100644
--- a/secure_fw/services/secure_storage/sst_asset_management.c
+++ b/secure_fw/services/secure_storage/sst_asset_management.c
@@ -20,7 +20,7 @@
/******************************/
/* Policy database */
-extern struct sst_asset_info_t asset_perms[];
+extern struct sst_asset_policy_t asset_perms[];
extern struct sst_asset_perm_t asset_perms_modes[];
/**
@@ -32,8 +32,8 @@
* \return Returns the perms entry on successful lookup
*/
static struct sst_asset_perm_t *sst_am_lookup_app_perms(
- const struct sst_asset_info_t *db_entry,
- uint32_t app_id)
+ const struct sst_asset_policy_t *db_entry,
+ uint32_t app_id)
{
struct sst_asset_perm_t *perm_entry;
uint32_t i;
@@ -55,7 +55,7 @@
*
* \return Returns the pointer for entry for specified asset
*/
-static struct sst_asset_info_t *sst_am_lookup_db_entry(uint16_t uuid)
+static struct sst_asset_policy_t *sst_am_lookup_db_entry(uint16_t uuid)
{
uint32_t i;
@@ -73,7 +73,7 @@
* \brief Checks the compile time policy for secure/non-secure separation
*
* \param[in] app_id caller's application ID
- * \param[in] request_type requested action to perform(
+ * \param[in] request_type requested action to perform
*
* \return Returns the sanitized request_type
*/
@@ -138,12 +138,12 @@
*
* \return Returns the entry pointer for specified asset
*/
-static struct sst_asset_info_t *sst_am_get_db_entry(uint32_t app_id,
- uint16_t uuid,
- uint8_t request_type)
+static struct sst_asset_policy_t *sst_am_get_db_entry(uint32_t app_id,
+ uint16_t uuid,
+ uint8_t request_type)
{
- struct sst_asset_perm_t *perm_entry;
- struct sst_asset_info_t *db_entry;
+ struct sst_asset_perm_t *perm_entry;
+ struct sst_asset_policy_t *db_entry;
request_type = sst_am_check_s_ns_policy(app_id, request_type);
@@ -191,7 +191,8 @@
*
* \return Returns the pointer for entry for specified asset
*/
-static struct sst_asset_info_t *sst_am_get_db_entry_by_hdl(uint32_t app_id,
+static struct sst_asset_policy_t *sst_am_get_db_entry_by_hdl(
+ uint32_t app_id,
uint32_t asset_handle,
uint8_t request_type)
{
@@ -291,7 +292,7 @@
enum tfm_sst_err_t sst_am_get_handle(uint32_t app_id, uint16_t asset_uuid,
uint32_t *hdl)
{
- struct sst_asset_info_t *db_entry;
+ struct sst_asset_policy_t *db_entry;
uint8_t all_perms = SST_PERM_REFERENCE | SST_PERM_READ | SST_PERM_WRITE;
enum tfm_sst_err_t err;
/* Lower layers trust the incoming request, use a local pointer */
@@ -336,18 +337,18 @@
return TFM_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_am_get_attributes(uint32_t app_id,
- uint32_t asset_handle,
- struct tfm_sst_attribs_t *attrib)
+enum tfm_sst_err_t sst_am_get_info(uint32_t app_id,
+ uint32_t asset_handle,
+ struct tfm_sst_asset_info_t *info)
{
enum tfm_sst_err_t bound_check;
- struct sst_asset_info_t *db_entry;
- struct tfm_sst_attribs_t tmp_attrib;
+ struct sst_asset_policy_t *db_entry;
+ struct tfm_sst_asset_info_t tmp_info;
enum tfm_sst_err_t err;
uint8_t all_perms = SST_PERM_REFERENCE | SST_PERM_READ | SST_PERM_WRITE;
- bound_check = sst_utils_memory_bound_check(attrib,
- sizeof(struct tfm_sst_attribs_t),
+ bound_check = sst_utils_memory_bound_check(info,
+ TFM_SST_ASSET_INFO_SIZE,
app_id, TFM_MEMORY_ACCESS_RW);
if (bound_check != TFM_SST_ERR_SUCCESS) {
return TFM_SST_ERR_PARAM_ERROR;
@@ -358,13 +359,14 @@
return TFM_SST_ERR_ASSET_NOT_FOUND;
}
- err = sst_object_get_attributes(asset_handle, &tmp_attrib);
+ err = sst_object_get_info(asset_handle, &tmp_info);
if (err == TFM_SST_ERR_SUCCESS) {
- /* memcpy instead of direct *hdl = temp_hdl.
- * ensures malicious entities can't trigger
- * a misaligned access fault.
+ /* Use tmp_info to not leak information in case the previous function
+ * returns and error. It avoids to leak information in case of error.
+ * So, copy the tmp_info content into the info only if that tmp_info
+ * data is valid.
*/
- sst_utils_memcpy(attrib, &tmp_attrib, sizeof(struct tfm_sst_attribs_t));
+ sst_utils_memcpy(info, &tmp_info, TFM_SST_ASSET_INFO_SIZE);
}
return err;
@@ -373,7 +375,7 @@
enum tfm_sst_err_t sst_am_create(uint32_t app_id, uint16_t asset_uuid)
{
enum tfm_sst_err_t err;
- struct sst_asset_info_t *db_entry;
+ struct sst_asset_policy_t *db_entry;
db_entry = sst_am_get_db_entry(app_id, asset_uuid, SST_PERM_WRITE);
if (db_entry == NULL) {
@@ -390,7 +392,7 @@
{
struct tfm_sst_buf_t local_data;
enum tfm_sst_err_t err;
- struct sst_asset_info_t *db_entry;
+ struct sst_asset_policy_t *db_entry;
/* Check application ID permissions */
db_entry = sst_am_get_db_entry_by_hdl(app_id, asset_handle, SST_PERM_READ);
@@ -422,7 +424,7 @@
{
struct tfm_sst_buf_t local_data;
enum tfm_sst_err_t err;
- struct sst_asset_info_t *db_entry;
+ struct sst_asset_policy_t *db_entry;
/* Check application ID permissions */
db_entry = sst_am_get_db_entry_by_hdl(app_id, asset_handle, SST_PERM_WRITE);
@@ -460,7 +462,7 @@
enum tfm_sst_err_t sst_am_delete(uint32_t app_id, uint32_t asset_handle)
{
enum tfm_sst_err_t err;
- struct sst_asset_info_t *db_entry;
+ struct sst_asset_policy_t *db_entry;
db_entry = sst_am_get_db_entry_by_hdl(app_id, asset_handle, SST_PERM_WRITE);
if (db_entry == NULL) {
diff --git a/secure_fw/services/secure_storage/sst_asset_management.h b/secure_fw/services/secure_storage/sst_asset_management.h
index cbf7a6c..8153c50 100644
--- a/secure_fw/services/secure_storage/sst_asset_management.h
+++ b/secure_fw/services/secure_storage/sst_asset_management.h
@@ -31,7 +31,7 @@
uint8_t perm; /*!< Permissions bitfield */
};
-struct sst_asset_info_t {
+struct sst_asset_policy_t {
uint16_t asset_uuid; /*!< Asset's unique ID */
uint16_t perms_count; /*!< Number of permissions owned by this asset */
uint16_t max_size; /*!< Policy maximum size fo this asset */
@@ -71,18 +71,18 @@
enum tfm_sst_err_t sst_am_create(uint32_t app_id, uint16_t asset_uuid);
/**
- * \brief Gets the asset's attributes referenced by asset handle.
- * Uses cached metadata to return the size and write offset of
- * the asset.
+ * \brief Gets the asset's info referenced by asset handle.
*
- * \param[in] app_id Application ID
- * \param[in] asset_handle Asset handle
- * \param[out] attrib_struct Pointer to asset attribute struct
+ * \param[in] app_id Application ID
+ * \param[in] asset_handle Asset handle
+ * \param[out] info Pointer to store the asset's information
+ * \ref tfm_sst_asset_info_t
*
* \return Returns error code as specified in \ref tfm_sst_err_t
*/
-enum tfm_sst_err_t sst_am_get_attributes(uint32_t app_id, uint32_t asset_handle,
- struct tfm_sst_attribs_t *attrib_struct);
+enum tfm_sst_err_t sst_am_get_info(uint32_t app_id,
+ uint32_t asset_handle,
+ struct tfm_sst_asset_info_t *info);
/**
* \brief Reads asset's data referenced by asset handle.
diff --git a/secure_fw/services/secure_storage/sst_core.c b/secure_fw/services/secure_storage/sst_core.c
index 6fa01ef..056974f 100644
--- a/secure_fw/services/secure_storage/sst_core.c
+++ b/secure_fw/services/secure_storage/sst_core.c
@@ -1260,8 +1260,8 @@
return TFM_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_core_object_get_attributes(uint32_t asset_handle,
- struct tfm_sst_attribs_t *attributes)
+enum tfm_sst_err_t sst_core_object_get_info(uint32_t asset_handle,
+ struct sst_core_obj_info_t *info)
{
enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
struct sst_assetmeta tmp_metadata;
@@ -1281,8 +1281,8 @@
*/
err = TFM_SST_ERR_INVALID_HANDLE;
} else {
- attributes->size_max = tmp_metadata.max_size;
- attributes->size_current = tmp_metadata.cur_size;
+ info->size_max = tmp_metadata.max_size;
+ info->size_current = tmp_metadata.cur_size;
}
}
diff --git a/secure_fw/services/secure_storage/sst_core.h b/secure_fw/services/secure_storage/sst_core.h
index 867cc44..e16fd30 100644
--- a/secure_fw/services/secure_storage/sst_core.h
+++ b/secure_fw/services/secure_storage/sst_core.h
@@ -89,6 +89,15 @@
uint8_t sst_key[SST_KEY_LEN_BYTES]; /*!< Secure storage system key */
};
+/* Structure to store the core object information concerning the content
+ * information.
+ */
+struct sst_core_obj_info_t {
+ uint32_t size_current; /*!< The current size of the flash object data */
+ uint32_t size_max; /*!< The maximum size of the flash object data in
+ * bytes.
+ */
+};
/**
* \brief Converts an asset uuid into an assethandle, looking up the index in
@@ -117,16 +126,16 @@
enum tfm_sst_err_t sst_core_object_create(uint16_t uuid, uint32_t size);
/**
- * \brief Gets the object attributes referenced by object handler.
+ * \brief Gets the object information referenced by object handler.
*
* \param[in] asset_handle Handle of the object
- * \param[out] attributes Pointer to the attributes structure to store the
- * attributes values
+ * \param[out] info Pointer to the information structure to store the
+ * object information values \ref sst_core_obj_info_t
*
* \return Returns error code specified in \ref tfm_sst_err_t
*/
-enum tfm_sst_err_t sst_core_object_get_attributes(uint32_t asset_handle,
- struct tfm_sst_attribs_t *attributes);
+enum tfm_sst_err_t sst_core_object_get_info(uint32_t asset_handle,
+ struct sst_core_obj_info_t *info);
/**
* \brief Writes data to an existing object
diff --git a/secure_fw/services/secure_storage/sst_encrypted_object.c b/secure_fw/services/secure_storage/sst_encrypted_object.c
index a4323f9..bdc2fb0 100644
--- a/secure_fw/services/secure_storage/sst_encrypted_object.c
+++ b/secure_fw/services/secure_storage/sst_encrypted_object.c
@@ -92,7 +92,8 @@
}
sst_utils_memcpy(obj->data, sst_plaintext_buf,
- cur_size);
+ obj->header.info.size_current);
+
return TFM_SST_ERR_SUCCESS;
}
@@ -179,17 +180,17 @@
struct sst_object_t *obj)
{
enum tfm_sst_err_t err;
- struct tfm_sst_attribs_t attribs;
+ struct sst_core_obj_info_t obj_info;
uint32_t plaintext_size;
/* Get the current size of the encrypted object in the object system */
- err = sst_core_object_get_attributes(object_handle, &attribs);
+ err = sst_core_object_get_info(object_handle, &obj_info);
if (err != TFM_SST_ERR_SUCCESS) {
return err;
}
/* Get the current plaintext size of the object data */
- plaintext_size = SST_PLAINTEXT_SIZE(attribs.size_current);
+ plaintext_size = SST_PLAINTEXT_SIZE(obj_info.size_current);
/* Clear the object buffer of any previous data */
sst_utils_memset(obj, SST_CRYPTO_CLEAR_BUF_VALUE, SST_MAX_OBJECT_SIZE);
@@ -197,7 +198,7 @@
/* Read the encrypted object from the object system */
err = sst_core_object_read(object_handle, (uint8_t *)obj,
SST_OBJECT_START_POSITION,
- attribs.size_current);
+ obj_info.size_current);
if (err != TFM_SST_ERR_SUCCESS) {
return err;
}
diff --git a/secure_fw/services/secure_storage/sst_object_defs.h b/secure_fw/services/secure_storage/sst_object_defs.h
index 9ddb900..2d327e2 100644
--- a/secure_fw/services/secure_storage/sst_object_defs.h
+++ b/secure_fw/services/secure_storage/sst_object_defs.h
@@ -25,9 +25,9 @@
/* Metadata attached as a header to encrypted object data before storage */
union sst_crypto_t crypto; /*!< Crypto metadata */
#endif
- uint32_t uuid; /*!< Asset ID */
- uint32_t version; /*!< Asset version */
- struct tfm_sst_attribs_t info; /*!< Asset information */
+ uint32_t uuid; /*!< Asset ID */
+ uint32_t version; /*!< Asset version */
+ struct tfm_sst_asset_info_t info; /*!< Asset information */
};
/* The object to be written to the file system below. Made up of the
diff --git a/secure_fw/services/secure_storage/sst_object_system.c b/secure_fw/services/secure_storage/sst_object_system.c
index 2aa7af5..645813f 100644
--- a/secure_fw/services/secure_storage/sst_object_system.c
+++ b/secure_fw/services/secure_storage/sst_object_system.c
@@ -254,8 +254,8 @@
return err;
}
-enum tfm_sst_err_t sst_object_get_attributes(uint32_t object_handle,
- struct tfm_sst_attribs_t *attributes)
+enum tfm_sst_err_t sst_object_get_info(uint32_t object_handle,
+ struct tfm_sst_asset_info_t *info)
{
enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
@@ -274,8 +274,8 @@
return err;
}
- sst_utils_memcpy(attributes, &g_sst_object.header.info,
- sizeof(struct tfm_sst_attribs_t));
+ sst_utils_memcpy(info, &g_sst_object.header.info,
+ TFM_SST_ASSET_INFO_SIZE);
sst_global_unlock();
}
diff --git a/secure_fw/services/secure_storage/sst_object_system.h b/secure_fw/services/secure_storage/sst_object_system.h
index 7139bf6..daa120a 100644
--- a/secure_fw/services/secure_storage/sst_object_system.h
+++ b/secure_fw/services/secure_storage/sst_object_system.h
@@ -46,7 +46,8 @@
*
* \return Returns error code specified in \ref tfm_sst_err_t
*/
-enum tfm_sst_err_t sst_object_create(uint16_t object_uuid, uint32_t size);
+enum tfm_sst_err_t sst_object_create(uint16_t object_uuid,
+ uint32_t size);
/**
* \brief Gets object's data referenced by object handle, and stores it
@@ -83,16 +84,16 @@
enum tfm_sst_err_t sst_object_delete(uint32_t object_handle);
/**
- * \brief Gets the object attributes referenced by object handler.
+ * \brief Gets the object information referenced by object handler.
*
* \param[in] object_handle Object handler
- * \param[out] attributes Pointer to the attributes structure to store the
- * attributes values
+ * \param[out] info Pointer to store the object's information
+ * \ref struct tfm_sst_asset_info_t
*
* \return Returns error code specified in \ref tfm_sst_err_t
*/
-enum tfm_sst_err_t sst_object_get_attributes(uint32_t object_handle,
- struct tfm_sst_attribs_t *attributes);
+enum tfm_sst_err_t sst_object_get_info(uint32_t object_handle,
+ struct tfm_sst_asset_info_t *info);
/**
* \brief Wipes secure storage system and all object data.
diff --git a/secure_fw/services/tfm_sfid_list.inc b/secure_fw/services/tfm_sfid_list.inc
index 83928d7..f630a6c 100644
--- a/secure_fw/services/tfm_sfid_list.inc
+++ b/secure_fw/services/tfm_sfid_list.inc
@@ -13,7 +13,7 @@
/******** TFM_SP_STORAGE ********/
{sst_am_get_handle, SST_AM_GET_HANDLE_SFID},
{sst_am_create, SST_AM_CREATE_SFID},
- {sst_am_get_attributes, SST_AM_GET_ATTRIBUTES_SFID},
+ {sst_am_get_info, SST_AM_GET_INFO_SFID},
{sst_am_read, SST_AM_READ_SFID},
{sst_am_write, SST_AM_WRITE_SFID},
{sst_am_delete, SST_AM_DELETE_SFID},
diff --git a/test/suites/sst/non_secure/sst_ns_interface_testsuite.c b/test/suites/sst/non_secure/sst_ns_interface_testsuite.c
index b56526a..cd21a39 100644
--- a/test/suites/sst/non_secure/sst_ns_interface_testsuite.c
+++ b/test/suites/sst/non_secure/sst_ns_interface_testsuite.c
@@ -430,7 +430,7 @@
TFM_SST_NS_TEST(1006, "Thread_C")
{
const uint16_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_attribs_t asset_attrs;
+ struct tfm_sst_asset_info_t asset_info;
enum tfm_sst_err_t err;
uint32_t hdl;
@@ -451,27 +451,27 @@
/* Calls get_attributes with valid application ID, asset handle and
* attributes struct pointer
*/
- err = tfm_sst_get_attributes(hdl, &asset_attrs);
+ err = tfm_sst_get_info(hdl, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Thread_C should read the attributes of this asset");
+ TEST_FAIL("Thread_C should read the information of this asset");
return;
}
/* Checks attributes */
- if (asset_attrs.size_current != 0) {
+ if (asset_info.size_current != 0) {
TEST_FAIL("Asset current size should be 0 as it is only created");
return;
}
- if (asset_attrs.size_max != SST_ASSET_MAX_SIZE_AES_KEY_192) {
+ if (asset_info.size_max != SST_ASSET_MAX_SIZE_AES_KEY_192) {
TEST_FAIL("Max size of the asset is incorrect");
return;
}
/* Calls get_attributes with invalid asset handle */
- err = tfm_sst_get_attributes(0, &asset_attrs);
+ err = tfm_sst_get_info(0, &asset_info);
if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
- TEST_FAIL("Get attributes function should fail for an invalid "
+ TEST_FAIL("Get info function should fail for an invalid "
"asset handle");
return;
}
@@ -514,12 +514,12 @@
*/
static void tfm_sst_test_1007_task_2(struct test_result_t *ret)
{
- struct tfm_sst_attribs_t asset_attrs;
+ struct tfm_sst_asset_info_t asset_info;
enum tfm_sst_err_t err;
- err = tfm_sst_get_attributes(tfm_sst_test_1007_handle, &asset_attrs);
+ err = tfm_sst_get_info(tfm_sst_test_1007_handle, &asset_info);
if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
- TEST_FAIL("Get attributes should not succeed with invalid thread name");
+ TEST_FAIL("Get info should not succeed with invalid thread name");
return;
}
@@ -587,9 +587,9 @@
}
/* Calls get_attributes with a null struct attributes pointer */
- err = tfm_sst_get_attributes(hdl, NULL);
+ err = tfm_sst_get_info(hdl, NULL);
if (err != TFM_SST_ERR_PARAM_ERROR) {
- TEST_FAIL("Get attributes function should fail for a null "
+ TEST_FAIL("Get info function should fail for a null "
"struct attributes pointer");
return;
}
@@ -612,7 +612,7 @@
TFM_SST_NS_TEST(1009, "Thread_C")
{
const uint16_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_attribs_t asset_attrs;
+ struct tfm_sst_asset_info_t asset_info;
enum tfm_sst_err_t err;
struct tfm_sst_buf_t io_data;
uint32_t hdl;
@@ -647,14 +647,14 @@
/* Calls get_attributes with valid application ID, asset handle and
* attributes struct pointer
*/
- err = tfm_sst_get_attributes(hdl, &asset_attrs);
+ err = tfm_sst_get_info(hdl, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Thread_C should read the attributes of this asset");
+ TEST_FAIL("Thread_C should read the information of this asset");
return;
}
/* Checks attributes */
- if (asset_attrs.size_current != WRITE_BUF_SIZE) {
+ if (asset_info.size_current != WRITE_BUF_SIZE) {
TEST_FAIL("Asset current size should be size of the write data");
return;
}
@@ -1097,7 +1097,7 @@
const uint16_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
enum tfm_sst_err_t err;
struct tfm_sst_buf_t io_data;
- struct tfm_sst_attribs_t asset_attrs;
+ struct tfm_sst_asset_info_t asset_info;
uint32_t hdl;
uint8_t wrt_data[WRITE_BUF_SIZE] = "DATA";
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
@@ -1129,14 +1129,14 @@
}
/* Gets current asset attributes */
- err = tfm_sst_get_attributes(hdl, &asset_attrs);
+ err = tfm_sst_get_info(hdl, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Thread_C should read the attributes of this asset");
+ TEST_FAIL("Thread_C should read the information of this asset");
return;
}
/* Checks attributes */
- if (asset_attrs.size_current == 0) {
+ if (asset_info.size_current == 0) {
TEST_FAIL("Asset current size should be bigger than 0");
return;
}
@@ -1154,7 +1154,7 @@
/* Attempts to read from an offset beyond the current size of the asset */
io_data.size = 1;
- io_data.offset = asset_attrs.size_current;
+ io_data.offset = asset_info.size_current;
err = tfm_sst_read(hdl, &io_data);
if (err != TFM_SST_ERR_PARAM_ERROR) {
@@ -2257,7 +2257,7 @@
*/
TFM_SST_NS_TEST(1029, "Thread_C")
{
- struct tfm_sst_attribs_t asset_attrs;
+ struct tfm_sst_asset_info_t asset_info;
const uint16_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
enum tfm_sst_err_t err;
struct tfm_sst_buf_t io_data;
@@ -2292,14 +2292,14 @@
return;
}
- err = tfm_sst_get_attributes(hdl, &asset_attrs);
+ err = tfm_sst_get_info(hdl, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Thread_C should read the attributes of this asset");
+ TEST_FAIL("Thread_C should read the information of this asset");
return;
}
/* Checks attributes */
- if (asset_attrs.size_current != (WRITE_BUF_SIZE - 1)) {
+ if (asset_info.size_current != (WRITE_BUF_SIZE - 1)) {
TEST_FAIL("Current size should be equal to write size");
return;
}
@@ -2316,14 +2316,14 @@
return;
}
- err = tfm_sst_get_attributes(hdl, &asset_attrs);
+ err = tfm_sst_get_info(hdl, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Thread_C should read the attributes of this asset");
+ TEST_FAIL("Thread_C should read the information of this asset");
return;
}
/* Checks that the asset's current size has not changed */
- if (asset_attrs.size_current != (WRITE_BUF_SIZE - 1)) {
+ if (asset_info.size_current != (WRITE_BUF_SIZE - 1)) {
TEST_FAIL("Current size should not have changed");
return;
}
@@ -2350,7 +2350,7 @@
/* Checks that offset can not be bigger than current asset's size */
io_data.data = wrt_data_2;
io_data.size = 1;
- io_data.offset = (asset_attrs.size_current + 1);
+ io_data.offset = (asset_info.size_current + 1);
err = tfm_sst_write(hdl, &io_data);
if (err != TFM_SST_ERR_PARAM_ERROR) {
diff --git a/test/suites/sst/non_secure/sst_policy_testsuite.c b/test/suites/sst/non_secure/sst_policy_testsuite.c
index 936c0c7..53254dc 100644
--- a/test/suites/sst/non_secure/sst_policy_testsuite.c
+++ b/test/suites/sst/non_secure/sst_policy_testsuite.c
@@ -131,7 +131,7 @@
TFM_SST_NS_TEST(4001, "Thread_C")
{
const uint16_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_attribs_t attribs;
+ struct tfm_sst_asset_info_t asset_info;
struct tfm_sst_buf_t buf;
enum tfm_sst_err_t err;
uint32_t hdl;
@@ -182,20 +182,20 @@
return;
}
- /* The get attributes function requires any permission other than NONE */
- err = tfm_sst_get_attributes(hdl, &attribs);
+ /* The get information function requires any permission other than NONE */
+ err = tfm_sst_get_info(hdl, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Get attributes should not fail for Thread_C");
+ TEST_FAIL("Get information should not fail for Thread_C");
return;
}
/* Checks attributes are correct */
- if (attribs.size_current != WRITE_BUF_SIZE) {
+ if (asset_info.size_current != WRITE_BUF_SIZE) {
TEST_FAIL("Current size of the asset is incorrect");
return;
}
- if (attribs.size_max != SST_ASSET_MAX_SIZE_AES_KEY_192) {
+ if (asset_info.size_max != SST_ASSET_MAX_SIZE_AES_KEY_192) {
TEST_FAIL("Max size of the asset is incorrect");
return;
}
@@ -213,7 +213,7 @@
TFM_SST_NS_TEST(4002, "Thread_A")
{
const uint16_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_attribs_t attribs;
+ struct tfm_sst_asset_info_t asset_info;
struct tfm_sst_buf_t buf;
enum tfm_sst_err_t err;
uint32_t hdl;
@@ -265,20 +265,20 @@
return;
}
- /* Get attributes should succeed as Thread_A has at least one permission */
- err = tfm_sst_get_attributes(hdl, &attribs);
+ /* Get information should succeed as Thread_A has at least one permission */
+ err = tfm_sst_get_info(hdl, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Get attributes should not fail for Thread_A");
+ TEST_FAIL("Get information should not fail for Thread_A");
return;
}
/* Checks attributes are correct */
- if (attribs.size_current != WRITE_BUF_SIZE) {
+ if (asset_info.size_current != WRITE_BUF_SIZE) {
TEST_FAIL("Current size of the asset is incorrect");
return;
}
- if (attribs.size_max != SST_ASSET_MAX_SIZE_AES_KEY_192) {
+ if (asset_info.size_max != SST_ASSET_MAX_SIZE_AES_KEY_192) {
TEST_FAIL("Max size of the asset is incorrect");
return;
}
@@ -303,7 +303,7 @@
TFM_SST_NS_TEST(4003, "Thread_B")
{
const uint16_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_attribs_t attribs;
+ struct tfm_sst_asset_info_t asset_info;
struct tfm_sst_buf_t buf;
enum tfm_sst_err_t err;
uint32_t hdl;
@@ -357,20 +357,20 @@
return;
}
- /* Get attributes should succeed as Thread_B has at least one permission */
- err = tfm_sst_get_attributes(hdl, &attribs);
+ /* Get information should succeed as Thread_B has at least one permission */
+ err = tfm_sst_get_info(hdl, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Get attributes should not fail for Thread_B");
+ TEST_FAIL("Get information should not fail for Thread_B");
return;
}
/* Checks attributes are correct */
- if (attribs.size_current != WRITE_BUF_SIZE) {
+ if (asset_info.size_current != WRITE_BUF_SIZE) {
TEST_FAIL("Current size of the asset is incorrect");
return;
}
- if (attribs.size_max != SST_ASSET_MAX_SIZE_AES_KEY_192) {
+ if (asset_info.size_max != SST_ASSET_MAX_SIZE_AES_KEY_192) {
TEST_FAIL("Max size of the asset is incorrect");
return;
}
@@ -427,7 +427,7 @@
TFM_SST_NS_TEST(4005, "Thread_B")
{
const uint16_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- struct tfm_sst_attribs_t attribs;
+ struct tfm_sst_asset_info_t asset_info;
struct tfm_sst_buf_t buf;
enum tfm_sst_err_t err;
uint8_t write_data[WRITE_BUF_SIZE] = WRITE_DATA_B;
@@ -480,20 +480,20 @@
return;
}
- /* Get attributes should succeed as Thread_B has at least one permission */
- err = tfm_sst_get_attributes(shared_handle, &attribs);
+ /* Get information should succeed as Thread_B has at least one permission */
+ err = tfm_sst_get_info(shared_handle, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Get attributes should not fail for Thread_B");
+ TEST_FAIL("Get information should not fail for Thread_B");
return;
}
/* Checks attributes are correct */
- if (attribs.size_current != WRITE_BUF_SIZE) {
+ if (asset_info.size_current != WRITE_BUF_SIZE) {
TEST_FAIL("Current size of the asset is incorrect");
return;
}
- if (attribs.size_max != SST_ASSET_MAX_SIZE_SHA224_HASH) {
+ if (asset_info.size_max != SST_ASSET_MAX_SIZE_SHA224_HASH) {
TEST_FAIL("Max size of the asset is incorrect");
return;
}
@@ -511,7 +511,7 @@
TFM_SST_NS_TEST(4006, "Thread_A")
{
const uint16_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- struct tfm_sst_attribs_t attribs = { 0 };
+ struct tfm_sst_asset_info_t asset_info = { 0 };
struct tfm_sst_buf_t buf;
enum tfm_sst_err_t err;
uint32_t hdl = 0;
@@ -572,20 +572,20 @@
return;
}
- /* Get attributes should fail as Thread_A has no permissions */
- err = tfm_sst_get_attributes(shared_handle, &attribs);
+ /* Get information should fail as Thread_A has no permissions */
+ err = tfm_sst_get_info(shared_handle, &asset_info);
if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
- TEST_FAIL("Get attributes should not succeed for Thread_A");
+ TEST_FAIL("Get information should not succeed for Thread_A");
return;
}
/* Checks attributes have not been changed by the call to get attributes */
- if (attribs.size_current != 0) {
+ if (asset_info.size_current != 0) {
TEST_FAIL("Current size of the asset should not have changed");
return;
}
- if (attribs.size_max != 0) {
+ if (asset_info.size_max != 0) {
TEST_FAIL("Max size of the asset should not have changed");
return;
}
@@ -634,7 +634,7 @@
TFM_SST_NS_TEST(4008, "Thread_C")
{
const uint16_t asset_uuid = SST_ASSET_ID_SHA384_HASH;
- struct tfm_sst_attribs_t attribs;
+ struct tfm_sst_asset_info_t asset_info;
struct tfm_sst_buf_t buf;
enum tfm_sst_err_t err;
uint8_t write_data[WRITE_BUF_SIZE] = WRITE_DATA_C;
@@ -687,20 +687,20 @@
return;
}
- /* Get attributes should succeed as Thread_C has at least one permission */
- err = tfm_sst_get_attributes(shared_handle, &attribs);
+ /* Get information should succeed as Thread_C has at least one permission */
+ err = tfm_sst_get_info(shared_handle, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Get attributes should not fail for Thread_C");
+ TEST_FAIL("Get information should not fail for Thread_C");
return;
}
/* Checks attributes are correct */
- if (attribs.size_current != WRITE_BUF_SIZE) {
+ if (asset_info.size_current != WRITE_BUF_SIZE) {
TEST_FAIL("Current size of the asset is incorrect");
return;
}
- if (attribs.size_max != SST_ASSET_MAX_SIZE_SHA384_HASH) {
+ if (asset_info.size_max != SST_ASSET_MAX_SIZE_SHA384_HASH) {
TEST_FAIL("Max size of the asset is incorrect");
return;
}
@@ -719,7 +719,7 @@
TFM_SST_NS_TEST(4009, "Thread_A")
{
const uint16_t asset_uuid = SST_ASSET_ID_SHA384_HASH;
- struct tfm_sst_attribs_t attribs = { 0 };
+ struct tfm_sst_asset_info_t asset_info = { 0 };
struct tfm_sst_buf_t buf;
enum tfm_sst_err_t err;
uint32_t hdl = 0;
@@ -780,20 +780,20 @@
return;
}
- /* Get attributes should fail as Thread_A has no permissions */
- err = tfm_sst_get_attributes(shared_handle, &attribs);
+ /* Get information should fail as Thread_A has no permissions */
+ err = tfm_sst_get_info(shared_handle, &asset_info);
if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
- TEST_FAIL("Get attributes should not succeed for Thread_A");
+ TEST_FAIL("Get information should not succeed for Thread_A");
return;
}
/* Checks attributes have not been changed by the call to get attributes */
- if (attribs.size_current != 0) {
+ if (asset_info.size_current != 0) {
TEST_FAIL("Current size of the asset should not have changed");
return;
}
- if (attribs.size_max != 0) {
+ if (asset_info.size_max != 0) {
TEST_FAIL("Max size of the asset should not have changed");
return;
}
diff --git a/test/suites/sst/secure/sst_sec_interface_testsuite.c b/test/suites/sst/secure/sst_sec_interface_testsuite.c
index d4e8f61..0222a70 100644
--- a/test/suites/sst/secure/sst_sec_interface_testsuite.c
+++ b/test/suites/sst/secure/sst_sec_interface_testsuite.c
@@ -73,9 +73,9 @@
{&tfm_sst_test_2003, "TFM_SST_TEST_2003",
"Get handle with null handle pointer", {0} },
{&tfm_sst_test_2004, "TFM_SST_TEST_2004",
- "Get attributes interface", {0} },
+ "Get information interface", {0} },
{&tfm_sst_test_2005, "TFM_SST_TEST_2005",
- "Get attributes with null attributes struct pointer", {0} },
+ "Get information with null attributes struct pointer", {0} },
{&tfm_sst_test_2006, "TFM_SST_TEST_2006",
"Write interface", {0} },
{&tfm_sst_test_2007, "TFM_SST_TEST_2007",
@@ -269,7 +269,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint16_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_attribs_t asset_attrs;
+ struct tfm_sst_asset_info_t asset_info;
enum tfm_sst_err_t err;
uint32_t hdl;
@@ -296,36 +296,36 @@
/* Calls get_attributes with valid application ID, asset handle and
* attributes struct pointer
*/
- err = tfm_sst_veneer_get_attributes(app_id, hdl, &asset_attrs);
+ err = tfm_sst_veneer_get_info(app_id, hdl, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
TEST_FAIL("Application S_APP_ID should be able to read the "
- "attributes of this file");
+ "information of this asset");
return;
}
/* Checks attributes */
- if (asset_attrs.size_current != 0) {
+ if (asset_info.size_current != 0) {
TEST_FAIL("Asset current size should be 0 as it is only created");
return;
}
- if (asset_attrs.size_max != SST_ASSET_MAX_SIZE_AES_KEY_192) {
+ if (asset_info.size_max != SST_ASSET_MAX_SIZE_AES_KEY_192) {
TEST_FAIL("Max size of the asset is incorrect");
return;
}
/* Calls get_attributes with invalid application ID */
- err = tfm_sst_veneer_get_attributes(INVALID_APP_ID, hdl, &asset_attrs);
+ err = tfm_sst_veneer_get_info(INVALID_APP_ID, hdl, &asset_info);
if (err == TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Get attributes function should fail for an invalid "
+ TEST_FAIL("Get information function should fail for an invalid "
"application ID");
return;
}
/* Calls get_attributes with invalid asset handle */
- err = tfm_sst_veneer_get_attributes(app_id, 0, &asset_attrs);
+ err = tfm_sst_veneer_get_info(app_id, 0, &asset_info);
if (err == TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Get attributes function should fail for an invalid "
+ TEST_FAIL("Get information function should fail for an invalid "
"asset handle");
return;
}
@@ -365,10 +365,10 @@
}
/* Calls get_attributes with invalid struct attributes pointer */
- err = tfm_sst_veneer_get_attributes(app_id, hdl, NULL);
+ err = tfm_sst_veneer_get_info(app_id, hdl, NULL);
if (err != TFM_SST_ERR_PARAM_ERROR) {
- TEST_FAIL("Get attributes function should fail for an invalid "
- "struct attributes pointer");
+ TEST_FAIL("Get information function should fail for an invalid "
+ "struct info pointer");
return;
}
@@ -385,7 +385,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint16_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_attribs_t asset_attrs;
+ struct tfm_sst_asset_info_t asset_info;
enum tfm_sst_err_t err;
struct tfm_sst_buf_t io_data;
uint32_t hdl;
@@ -426,15 +426,15 @@
/* Calls get_attributes with valid application ID, asset handle and
* attributes struct pointer
*/
- err = tfm_sst_veneer_get_attributes(app_id, hdl, &asset_attrs);
+ err = tfm_sst_veneer_get_info(app_id, hdl, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
TEST_FAIL("Application S_APP_ID should be able to read the "
- "attributes of this file");
+ "information of this asset");
return;
}
/* Checks attributes */
- if (asset_attrs.size_current != WRITE_BUF_SIZE) {
+ if (asset_info.size_current != WRITE_BUF_SIZE) {
TEST_FAIL("Asset current size should be size of the write data");
return;
}
@@ -727,7 +727,7 @@
const uint16_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
enum tfm_sst_err_t err;
struct tfm_sst_buf_t io_data;
- struct tfm_sst_attribs_t asset_attrs;
+ struct tfm_sst_asset_info_t asset_info;
uint32_t hdl;
uint8_t data[BUFFER_SIZE_PLUS_ONE] = {0};
@@ -764,15 +764,15 @@
}
/* Gets current asset attributes */
- err = tfm_sst_veneer_get_attributes(app_id, hdl, &asset_attrs);
+ err = tfm_sst_veneer_get_info(app_id, hdl, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
TEST_FAIL("Application S_APP_ID should be able to read the "
- "attributes of this file");
+ "information of this asset");
return;
}
/* Checks attributes */
- if (asset_attrs.size_current == 0) {
+ if (asset_info.size_current == 0) {
TEST_FAIL("Asset current size should be bigger than 0");
return;
}
@@ -790,7 +790,7 @@
/* Attempts to read from an offset beyond the current size of the asset */
io_data.size = 1;
- io_data.offset = asset_attrs.size_current;
+ io_data.offset = asset_info.size_current;
err = tfm_sst_veneer_read(app_id, hdl, &io_data);
if (err == TFM_SST_ERR_SUCCESS) {
@@ -1693,7 +1693,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint16_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_attribs_t attribs;
+ struct tfm_sst_asset_info_t asset_info;
struct tfm_sst_buf_t buf;
enum tfm_sst_err_t err;
uint32_t hdl;
@@ -1729,16 +1729,16 @@
return;
}
- err = tfm_sst_veneer_get_attributes(app_id, hdl, &attribs);
+ err = tfm_sst_veneer_get_info(app_id, hdl, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Get attributes should not fail");
+ TEST_FAIL("Get information should not fail");
return;
}
/* Checks that the asset's current size is equal to the size of the write
* data.
*/
- if (attribs.size_current != WRITE_BUF_SIZE - 1) {
+ if (asset_info.size_current != WRITE_BUF_SIZE - 1) {
TEST_FAIL("Current size should be equal to write size");
return;
}
@@ -1754,14 +1754,14 @@
return;
}
- err = tfm_sst_veneer_get_attributes(app_id, hdl, &attribs);
+ err = tfm_sst_veneer_get_info(app_id, hdl, &asset_info);
if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Get attributes should not fail");
+ TEST_FAIL("Get information should not fail");
return;
}
/* Checks that the asset's current size has not changed */
- if (attribs.size_current != (WRITE_BUF_SIZE - 1)) {
+ if (asset_info.size_current != (WRITE_BUF_SIZE - 1)) {
TEST_FAIL("Current size should not have changed");
return;
}
@@ -1787,7 +1787,7 @@
/* Checks that offset can not be bigger than current asset's size */
buf.data = write_data_2;
buf.size = 1;
- buf.offset = (attribs.size_current + 1);
+ buf.offset = (asset_info.size_current + 1);
err = tfm_sst_veneer_write(app_id, hdl, &buf);
if (err != TFM_SST_ERR_PARAM_ERROR) {