diff options
author | Marc Moreno Berengue <marc.morenoberengue@arm.com> | 2018-11-23 09:44:21 +0000 |
---|---|---|
committer | Marc Moreno Berengue <marc.morenoberengue@arm.com> | 2018-12-03 10:13:22 +0000 |
commit | 89f232285877e40027723e4f3e23bf37013b78cd (patch) | |
tree | 9fb673926aeaf396a3ecaa87d3d3d3323de387d7 | |
parent | ce2d2e9157f9496f132d89b4b200de7e67e5c80b (diff) | |
download | trusted-firmware-m-89f232285877e40027723e4f3e23bf37013b78cd.tar.gz |
SST: Fix code logic in set_active_object_table
This patch fixies the code logic in sst_set_active_object_table when
table 0 is valid and table 1 is invalid. If both tables are valid an
extra evaluation is required to determine which table contains the
latest content based on NV counters, if SST_ROLLBACK_PROTECTION is
set, or swap counter.
Change-Id: I3a751c003b5c7b272005ecacd26f607f37978e1e
Signed-off-by: Marc Moreno <marc.morenoberengue@arm.com>
-rw-r--r-- | secure_fw/services/secure_storage/sst_object_table.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/secure_fw/services/secure_storage/sst_object_table.c b/secure_fw/services/secure_storage/sst_object_table.c index 2ec74775d9..fd8f03c351 100644 --- a/secure_fw/services/secure_storage/sst_object_table.c +++ b/secure_fw/services/secure_storage/sst_object_table.c @@ -667,11 +667,16 @@ static enum psa_sst_err_t sst_set_active_object_table( SST_OBJ_TABLE_SIZE); return PSA_SST_ERR_SUCCESS; - } else { + } else if (init_ctx->table_state[SST_OBJ_TABLE_IDX_1] == + SST_OBJ_TABLE_INVALID) { /* Table 1 is invalid, the active one is table 0 */ sst_obj_table_ctx.active_table = SST_OBJ_TABLE_IDX_0; sst_obj_table_ctx.scratch_table = SST_OBJ_TABLE_IDX_1; + /* As table 0 is already in the SST object table context, it is not + * needed to copy the table in the context. + */ + return PSA_SST_ERR_SUCCESS; } |