Skip to content

Commit 2c9e586

Browse files
bigbrettdanielinux
authored andcommitted
self-header review feedback: parameterize test header comparison, fix typo
1 parent 4d31ef5 commit 2c9e586

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

test-app/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ endif
365365
ifeq ($(WOLFBOOT_SELF_HEADER),1)
366366
CFLAGS+=-D"WOLFBOOT_SELF_HEADER"
367367
CFLAGS+=-I"$(WOLFBOOT_LIB_WOLFSSL)"
368-
# Test app needs addtional image, keystore, and crypto objects to do verification
368+
# Test app needs additional image, keystore, and crypto objects to do verification
369369
APP_OBJS+=../src/image.o ../src/keystore.o
370370
# Only add wolfcrypt objs if WOLFHSM blocks won't provide them
371371
ifeq ($(WOLFHSM_CLIENT)$(WOLFHSM_SERVER),)

tools/test.mk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ test-sim-self-update: wolfboot.bin FORCE
276276
# then verifies the persisted header matches the signing tool's --header-only
277277
# output byte-for-byte, and finally boots into the test-app which calls
278278
# open_self/verify_integrity/verify_authenticity to simulate an external entity
279-
# veriyfing the bootloader image
279+
# verifying the bootloader image
280280
#
281281
test-sim-self-header-verify: wolfboot.bin test-app/image_v1_signed.bin FORCE
282282
@echo "=== Simulator Self-Header Verification Test ==="
@@ -301,7 +301,7 @@ test-sim-self-header-verify: wolfboot.bin test-app/image_v1_signed.bin FORCE
301301
@# Extract the persisted header that the self-update wrote
302302
$(Q)dd if=internal_flash.dd bs=1 skip=$$(($(WOLFBOOT_PARTITION_SELF_HEADER_ADDRESS) - $(ARCH_FLASH_OFFSET))) count=$$(($(WOLFBOOT_SECTOR_SIZE))) of=persisted_hdr.dd 2>/dev/null
303303
@# Verify persisted header matches the signing tool's --header-only output
304-
$(Q)cmp -n 256 persisted_hdr.dd wolfboot_v2_header.bin
304+
$(Q)cmp -n $$(($(IMAGE_HEADER_SIZE))) persisted_hdr.dd wolfboot_v2_header.bin
305305
@# Reassemble flash with test-app in boot partition so the app runs after wolfboot
306306
$(Q)dd if=/dev/zero bs=$$(($(WOLFBOOT_PARTITION_SIZE))) count=1 2>/dev/null | tr '\000' '\377' > update_part_empty.dd
307307
$(Q)dd if=/dev/zero bs=$$(($(WOLFBOOT_PARTITION_SIZE))) count=1 2>/dev/null | tr '\000' '\377' > boot_with_app.dd
@@ -342,11 +342,11 @@ test-sim-self-header-ext-verify: wolfboot.bin test-app/image_v1_signed.bin FORCE
342342
@# Run simulator — triggers self-update, which persists the header to external flash
343343
$(Q)./wolfboot.elf get_version || true
344344
@# Confirm internal flash self-header location remains erased (header went to external only)
345-
$(Q)dd if=/dev/zero bs=256 count=1 2>/dev/null | tr '\000' '\377' > erased_256.dd
346-
$(Q)dd if=internal_flash.dd bs=1 skip=$$(($(WOLFBOOT_PARTITION_SELF_HEADER_ADDRESS) - $(ARCH_FLASH_OFFSET))) count=256 2>/dev/null | cmp -s erased_256.dd - && echo "=== Internal Self-Header location remains erased PASSED ==="
345+
$(Q)dd if=/dev/zero bs=$$(($(IMAGE_HEADER_SIZE))) count=1 2>/dev/null | tr '\000' '\377' > erased_hdr.dd
346+
$(Q)dd if=internal_flash.dd bs=1 skip=$$(($(WOLFBOOT_PARTITION_SELF_HEADER_ADDRESS) - $(ARCH_FLASH_OFFSET))) count=$$(($(IMAGE_HEADER_SIZE))) 2>/dev/null | cmp -s erased_hdr.dd - && echo "=== Internal Self-Header location remains erased PASSED ==="
347347
@# Extract persisted header from external flash and verify it matches the signed header
348348
$(Q)dd if=external_flash.dd bs=1 skip=$(WOLFBOOT_PARTITION_SELF_HEADER_ADDRESS) count=$$(($(WOLFBOOT_SECTOR_SIZE))) of=persisted_hdr.dd 2>/dev/null
349-
$(Q)cmp -n 256 persisted_hdr.dd wolfboot_v2_header.bin
349+
$(Q)cmp -n $$(($(IMAGE_HEADER_SIZE))) persisted_hdr.dd wolfboot_v2_header.bin
350350
@# Reassemble flash with test-app in boot and the persisted external header
351351
$(Q)dd if=/dev/zero bs=$$(($(WOLFBOOT_PARTITION_SIZE))) count=1 2>/dev/null | tr '\000' '\377' > update_part_empty.dd
352352
$(Q)dd if=/dev/zero bs=$$(($(WOLFBOOT_PARTITION_SIZE))) count=1 2>/dev/null | tr '\000' '\377' > boot_with_app.dd

0 commit comments

Comments
 (0)