diff options
author | Jamie Fox <jamie.fox@arm.com> | 2020-01-22 10:57:13 +0000 |
---|---|---|
committer | Jamie Fox <jamie.fox@arm.com> | 2020-01-27 14:28:06 +0000 |
commit | 4ef8f2f1474af6551d092fbe51a660040ddea15c (patch) | |
tree | 1e45cc01786f15d1425c007e7ef8328112ee250c | |
parent | 35ff8167956e26d2d0c054425a3b613df462720c (diff) | |
download | trusted-firmware-m-4ef8f2f1474af6551d092fbe51a660040ddea15c.tar.gz |
SST: Fix initialisation of object table entry
Changes initialisation of object table entry to a single memset of the
whole struct. Fixes an issue where the tag member was memset with a
size greater than the tag length, and makes the function more resilient
to any future changes to the struct.
Change-Id: I44721ffb9d1665355fc50a517778984708310a28
Signed-off-by: Jamie Fox <jamie.fox@arm.com>
-rw-r--r-- | secure_fw/services/secure_storage/sst_object_table.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/secure_fw/services/secure_storage/sst_object_table.c b/secure_fw/services/secure_storage/sst_object_table.c index 3c13b44518..2d07807499 100644 --- a/secure_fw/services/secure_storage/sst_object_table.c +++ b/secure_fw/services/secure_storage/sst_object_table.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited. All rights reserved. + * Copyright (c) 2018-2020, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -795,17 +795,9 @@ __STATIC_INLINE psa_ps_status_t sst_table_free_idx(uint32_t idx_num, */ static void sst_table_delete_entry(uint32_t idx) { - struct sst_obj_table_t *p_table = &sst_obj_table_ctx.obj_table; - - p_table->obj_db[idx].uid = TFM_SST_INVALID_UID; - p_table->obj_db[idx].client_id = 0; - -#ifdef SST_ENCRYPTION - (void)tfm_memset(p_table->obj_db[idx].tag, SST_DEFAULT_EMPTY_BUFF_VAL, - SST_OBJECTS_TABLE_ENTRY_SIZE); -#else - p_table->obj_db[idx].version = 0; -#endif + /* Initialise object table entry structure */ + (void)tfm_memset(&sst_obj_table_ctx.obj_table.obj_db[idx], + SST_DEFAULT_EMPTY_BUFF_VAL, SST_OBJECTS_TABLE_ENTRY_SIZE); } psa_ps_status_t sst_object_table_create(void) |