Skip to content

Commit 8e5aec2

Browse files
committed
Fixed regressions in CI tests
1 parent e88e76e commit 8e5aec2

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/update_flash.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ int WP11_Library_Init(void);
4545

4646
#ifdef EXT_ENCRYPTED
4747
#include "encrypt.h"
48+
49+
static void wolfBoot_zeroize(void *ptr, size_t len)
50+
{
51+
volatile uint8_t *p = (volatile uint8_t *)ptr;
52+
53+
while (len-- > 0) {
54+
*p++ = 0;
55+
}
56+
}
4857
#endif /* EXT_ENCRYPTED */
4958

5059
#ifdef MMU
@@ -307,8 +316,8 @@ static int RAMFUNCTION wolfBoot_copy_sector(struct wolfBoot_image *src,
307316
out:
308317
#endif
309318
#ifdef EXT_ENCRYPTED
310-
ForceZero(key, sizeof(key));
311-
ForceZero(nonce, sizeof(nonce));
319+
wolfBoot_zeroize(key, sizeof(key));
320+
wolfBoot_zeroize(nonce, sizeof(nonce));
312321
#endif
313322
return ret;
314323
}
@@ -365,8 +374,8 @@ static int RAMFUNCTION wolfBoot_backup_last_boot_sector(uint32_t sector)
365374
ret = wolfBoot_copy_sector(src, dst, sector);
366375
}
367376
out:
368-
ForceZero(key, sizeof(key));
369-
ForceZero(nonce, sizeof(nonce));
377+
wolfBoot_zeroize(key, sizeof(key));
378+
wolfBoot_zeroize(nonce, sizeof(nonce));
370379
return ret;
371380
}
372381
#else
@@ -722,8 +731,8 @@ static int wolfBoot_delta_update(struct wolfBoot_image *boot,
722731
}
723732
out:
724733
#ifdef EXT_ENCRYPTED
725-
ForceZero(key, sizeof(key));
726-
ForceZero(nonce, sizeof(nonce));
734+
wolfBoot_zeroize(key, sizeof(key));
735+
wolfBoot_zeroize(nonce, sizeof(nonce));
727736
#endif
728737
#ifdef EXT_FLASH
729738
ext_flash_lock();

tools/unit-tests/unit-extflash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ uint8_t flash[FLASH_SIZE];
9494

9595
/* Mocks for ext_flash_read, ext_flash_write, and ext_flash_erase functions */
9696
int ext_flash_read(uintptr_t address, uint8_t *data, int len) {
97-
printf("Called ext_flash_read %p %p %d\n", address, data, len);
97+
printf("Called ext_flash_read %p %p %d\n", (void *)address, (void *)data, len);
9898

9999
/* Check that the read address and size are within the bounds of the flash memory */
100100
ck_assert_int_le(address + len, FLASH_SIZE);
@@ -106,7 +106,7 @@ int ext_flash_read(uintptr_t address, uint8_t *data, int len) {
106106
}
107107

108108
int ext_flash_write(uintptr_t address, const uint8_t *data, int len) {
109-
printf("Called ext_flash_write %p %p %d\n", address, data, len);
109+
printf("Called ext_flash_write %p %p %d\n", (void *)address, (const void *)data, len);
110110

111111

112112
/* Check that the write address and size are within the bounds of the flash memory */

0 commit comments

Comments
 (0)