Skip to content

Commit bdaa5ad

Browse files
committed
Addressed copilot's comments
1 parent 4e119ce commit bdaa5ad

4 files changed

Lines changed: 12 additions & 7 deletions

File tree

include/encrypt.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ int ext_flash_decrypt_read(uintptr_t address, uint8_t *data, int len);
8686

8787
#ifdef EXT_ENCRYPTED
8888
int wolfBoot_enable_fallback_iv(int enable);
89-
int wolfBoot_force_fallback_iv(int enable);
9089
void wolfBoot_crypto_set_iv(const uint8_t *nonce, uint32_t iv_counter);
9190
#endif
9291

src/update_flash.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131

3232
#include "delta.h"
3333
#include "printf.h"
34+
#ifdef EXT_ENCRYPTED
35+
int wolfBoot_force_fallback_iv(int enable);
36+
#endif
3437
#ifdef WOLFBOOT_TPM
3538
#include "tpm.h"
3639
#endif

tools/unit-tests/unit-mock-flash.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,17 @@ int ext_flash_write(uintptr_t address, const uint8_t *data, int len)
163163
int i;
164164
uint8_t *a = (uint8_t *)address;
165165
ck_assert_msg(!ext_locked, "Attempting to write to a locked FLASH");
166+
ck_assert_msg(len >= 0, "ext_flash_write invalid len %d", len);
166167
ck_assert_msg(
167168
((address >= WOLFBOOT_PARTITION_BOOT_ADDRESS) &&
168-
(address + (uintptr_t)len <=
169-
WOLFBOOT_PARTITION_BOOT_ADDRESS + WOLFBOOT_PARTITION_SIZE)) ||
169+
((uintptr_t)len <=
170+
WOLFBOOT_PARTITION_BOOT_ADDRESS + WOLFBOOT_PARTITION_SIZE - address)) ||
170171
((address >= WOLFBOOT_PARTITION_UPDATE_ADDRESS) &&
171-
(address + (uintptr_t)len <=
172-
WOLFBOOT_PARTITION_UPDATE_ADDRESS + WOLFBOOT_PARTITION_SIZE)) ||
172+
((uintptr_t)len <=
173+
WOLFBOOT_PARTITION_UPDATE_ADDRESS + WOLFBOOT_PARTITION_SIZE - address)) ||
173174
((address >= WOLFBOOT_PARTITION_SWAP_ADDRESS) &&
174-
(address + (uintptr_t)len <=
175-
WOLFBOOT_PARTITION_SWAP_ADDRESS + WOLFBOOT_SECTOR_SIZE)),
175+
((uintptr_t)len <=
176+
WOLFBOOT_PARTITION_SWAP_ADDRESS + WOLFBOOT_SECTOR_SIZE - address)),
176177
"ext_flash_write address out of range: %p len %d",
177178
(void*)address, len);
178179
for (i = 0; i < len; i++) {

tools/unit-tests/unit-update-flash.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,10 @@ Suite *wolfboot_suite(void)
700700

701701

702702
#ifdef UNIT_TEST_FALLBACK_ONLY
703+
#ifdef EXT_ENCRYPTED
703704
tcase_add_test(fallback_verify, test_fallback_image_verification_rejects_corruption);
704705
suite_add_tcase(s, fallback_verify);
706+
#endif
705707
return s;
706708
#else
707709
tcase_add_test(empty_panic, test_empty_panic);

0 commit comments

Comments
 (0)