Skip to content

Commit 3f18028

Browse files
bigbrettdanielinux
authored andcommitted
add build option to skip verification of boot image
1 parent 4a53bd1 commit 3f18028

5 files changed

Lines changed: 23 additions & 4 deletions

File tree

options.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,10 @@ ifeq ($(ALLOW_DOWNGRADE),1)
685685
CFLAGS+= -D"ALLOW_DOWNGRADE"
686686
endif
687687

688+
ifeq ($(WOLFBOOT_SKIP_BOOT_VERIFY),1)
689+
CFLAGS+=-D"WOLFBOOT_SKIP_BOOT_VERIFY"
690+
endif
691+
688692
ifeq ($(NVM_FLASH_WRITEONCE),1)
689693
CFLAGS+= -D"NVM_FLASH_WRITEONCE"
690694
endif

src/update_disk.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ void RAMFUNCTION wolfBoot_start(void)
425425
}
426426
os_image.fw_base = (uint8_t*)load_address;
427427

428+
#ifndef WOLFBOOT_SKIP_BOOT_VERIFY
428429
wolfBoot_printf("Checking image integrity...");
429430
BENCHMARK_START();
430431
if (wolfBoot_verify_integrity(&os_image) != 0) {
@@ -446,6 +447,10 @@ void RAMFUNCTION wolfBoot_start(void)
446447
failures = 0;
447448
break; /* Success case */
448449
}
450+
#else
451+
failures = 0;
452+
break; /* Skip verification, boot directly */
453+
#endif
449454
} while (failures < MAX_FAILURES);
450455

451456
if (failures) {

src/update_flash.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,7 @@ void RAMFUNCTION wolfBoot_start(void)
13461346
wolfBoot_printf("Booting version: 0x%x\n",
13471347
wolfBoot_get_blob_version(boot.hdr));
13481348

1349+
#ifndef WOLFBOOT_SKIP_BOOT_VERIFY
13491350
if (bootRet < 0
13501351
|| (wolfBoot_verify_integrity(&boot) < 0)
13511352
|| (wolfBoot_verify_authenticity(&boot) < 0)
@@ -1377,6 +1378,11 @@ void RAMFUNCTION wolfBoot_start(void)
13771378
}
13781379
}
13791380
PART_SANITY_CHECK(&boot);
1381+
#else
1382+
if (bootRet < 0) {
1383+
wolfBoot_panic();
1384+
}
1385+
#endif
13801386

13811387
#ifdef WOLFBOOT_ELF_FLASH_SCATTER
13821388
unsigned long entry;

src/update_flash_hwswap.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ void RAMFUNCTION wolfBoot_start(void)
5151
boot_panic();
5252

5353
for (;;) {
54-
if ((wolfBoot_open_image(&fw_image, active) < 0) ||
55-
(wolfBoot_verify_integrity(&fw_image) < 0) ||
56-
(wolfBoot_verify_authenticity(&fw_image) < 0)) {
57-
54+
if ((wolfBoot_open_image(&fw_image, active) < 0)
55+
#ifndef WOLFBOOT_SKIP_BOOT_VERIFY
56+
|| (wolfBoot_verify_integrity(&fw_image) < 0)
57+
|| (wolfBoot_verify_authenticity(&fw_image) < 0)
58+
#endif
59+
) {
5860
/* panic if authentication fails and no backup */
5961
if (!wolfBoot_fallback_is_possible())
6062
boot_panic();

src/update_ram.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ void RAMFUNCTION wolfBoot_start(void)
192192
goto backup_on_failure;
193193
}
194194

195+
#ifndef WOLFBOOT_SKIP_BOOT_VERIFY
195196
/* Verify image integrity (hash check) */
196197
wolfBoot_printf("Checking integrity...");
197198
BENCHMARK_START();
@@ -211,6 +212,7 @@ void RAMFUNCTION wolfBoot_start(void)
211212
goto backup_on_failure;
212213
}
213214
BENCHMARK_END("done");
215+
#endif
214216

215217
{
216218
/* Success - integrity and signature valid */

0 commit comments

Comments
 (0)