Skip to content

Commit 2a9aa60

Browse files
committed
Fixed test regressions
1 parent 47e1f77 commit 2a9aa60

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/arm_tee_psa_ipc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static struct wolfboot_ps_entry *wolfboot_ps_alloc(psa_storage_uid_t uid)
241241
{
242242
for (size_t i = 0; i < WOLFBOOT_PS_MAX_ENTRIES; i++) {
243243
if (!g_ps_entries[i].in_use) {
244-
ForceZero(g_ps_entries[i].data, sizeof(g_ps_entries[i].data));
244+
wc_ForceZero(g_ps_entries[i].data, sizeof(g_ps_entries[i].data));
245245
g_ps_entries[i].in_use = 1;
246246
g_ps_entries[i].uid = uid;
247247
g_ps_entries[i].size = 0;
@@ -846,7 +846,7 @@ int32_t arm_tee_psa_call(psa_handle_t handle, int32_t type,
846846
if (entry == NULL) {
847847
return PSA_ERROR_DOES_NOT_EXIST;
848848
}
849-
ForceZero(entry->data, sizeof(entry->data));
849+
wc_ForceZero(entry->data, sizeof(entry->data));
850850
entry->in_use = 0;
851851
entry->uid = 0;
852852
entry->size = 0;

src/libwolfboot.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@
6565
#ifdef EXT_ENCRYPTED
6666
static int encrypt_key_is_erased(const uint8_t *key, uint32_t len)
6767
{
68-
volatile uint8_t diff = 0;
68+
const volatile uint8_t *vkey = key;
69+
uint8_t diff = 0;
6970
uint32_t i;
7071

7172
for (i = 0; i < len; i++)
72-
diff |= key[i] ^ FLASH_BYTE_ERASED;
73+
diff |= vkey[i] ^ FLASH_BYTE_ERASED;
7374

7475
return diff == 0;
7576
}
@@ -85,13 +86,14 @@ static int fallback_iv_forced = 0;
8586

8687
static int encrypt_key_is_valid(const uint8_t *key, uint32_t len)
8788
{
88-
volatile uint8_t has_one = 0;
89-
volatile uint8_t has_zero = 0;
89+
const volatile uint8_t *vkey = key;
90+
uint8_t has_one = 0;
91+
uint8_t has_zero = 0;
9092
uint32_t i;
9193

9294
for (i = 0; i < len; i++) {
93-
has_one |= key[i];
94-
has_zero |= (uint8_t)~key[i];
95+
has_one |= vkey[i];
96+
has_zero |= (uint8_t)~vkey[i];
9597
}
9698

9799
return (has_one != 0) && (has_zero != 0);

0 commit comments

Comments
 (0)