wolfBoot/tools/unit-tests
Daniele Lacamera 72186fa8d3 F-6126: add mutation-pinning test coverage for wolfBoot_check_flash_image_elf
The scattered-ELF flash integrity check's final image_CT_compare()
rejection branch had zero unit test coverage, so a weakened comparison
(e.g. != 0 -> == 0, or a dropped return -2) would silently pass. Add a
positive case (correctly-hashed scattered image verifies OK) and a
negative case (single corrupted byte in a scattered segment's
flash-resident payload is rejected via the digest-mismatch branch).
2026-07-02 15:46:24 +02:00
..
mcxa_fsl_stub F-5963: fix over-advance of address/len in unaligned hal_flash_write (kinetis.c, mcxa.c, mcxw.c) 2026-07-02 14:47:38 +02:00
Makefile F-6126: add mutation-pinning test coverage for wolfBoot_check_flash_image_elf 2026-07-02 15:46:24 +02:00
README.md
…
arm_cmse.h
…
gpt-sfdisk-test.h
…
target.h
…
txt_filler.h
…
unit-ahci-unlock-panic.c F-6129: zeroize disk-unlock secret before the state-mismatch panic in sata_unlock_disk 2026-07-02 14:18:03 +02:00
unit-arm-tee-psa-ipc.c
…
unit-ata-security-passphrase-zeroize.c F-5968: zeroize disk-unlock passphrase from static ATA command buffer 2026-07-02 14:27:04 +02:00
unit-boot-x86_fsp.c
…
unit-common.c
…
unit-delta.c F-5965: skip wb_diff match candidates whose offset MSB collides with ESC 2026-07-02 14:35:07 +02:00
unit-disk.c
…
unit-elf-bss-guard.c fix broken unit test 2026-06-16 16:11:10 -06:00
unit-enc-nvm.c
…
unit-extflash.c
…
unit-fdt.c fdt: break loop compatibles when no NUL-terminator is found 2026-07-02 09:23:18 +02:00
unit-fit-fpga.c
…
unit-fit-gzip.c
…
unit-flash-erase-c0.c
…
unit-flash-erase-g0.c
…
unit-flash-erase-h7.c
…
unit-flash-erase-l0.c
…
unit-flash-erase-u3.c
…
unit-flash-erase-wb.c
…
unit-flash-write-mcxa.c F-5963: fix over-advance of address/len in unaligned hal_flash_write (kinetis.c, mcxa.c, mcxw.c) 2026-07-02 14:47:38 +02:00
unit-fwtpm-nv-oob.c
…
unit-fwtpm-stub.c
…
unit-gzip.c
…
unit-image-elf-scatter.c F-6126: add mutation-pinning test coverage for wolfBoot_check_flash_image_elf 2026-07-02 15:46:24 +02:00
unit-image.c image: check integrity in wolfBoot_verify_authenticity() 2026-06-25 17:35:18 +02:00
unit-imx-rt-cache-align.c F-6399: fix imx_rt DCACHE invalidation to include down-alignment offset 2026-07-02 15:13:28 +02:00
unit-keygen-xmss-params.c
…
unit-keystore.c
…
unit-linux-loader-e820.c
…
unit-linux-loader-syssize.c
…
unit-loader-tpm-init.c
…
unit-max-space.c
…
unit-mock-flash.c
…
unit-mock-state.c
…
unit-mpusize.c
…
unit-multiboot.c
…
unit-nvm.c
…
unit-otp-keystore-gen-zeroize.c F-6408: zeroize UDS from OTP keystore generator's heap and stack buffers 2026-07-02 14:56:48 +02:00
unit-otp-keystore.c
…
unit-parser.c
…
unit-pci.c
…
unit-pkcs11_store.c
…
unit-policy-create.c
…
unit-policy-sign.c
…
unit-psa_store.c F-6407: zeroize static cached_sector after each flash commit in psa_store 2026-07-02 14:03:24 +02:00
unit-qspi-flash.c
…
unit-rot-auth.c
…
unit-sdhci-disk-unaligned.c
…
unit-sdhci-response-bits.c
…
unit-sectorflags.c
…
unit-sign-custom-tlv-le.py F-6127: fix custom-TLV 8-byte value saturation in arg2num 2026-07-02 15:28:09 +02:00
unit-sign-delta-cert-inv-off.py
…
unit-sign-delta-tlv.py
…
unit-sign-encrypted-output.c
…
unit-sign-encrypted-output.mkfrag
…
unit-spi-flash.c
…
unit-store-sbrk.c
…
unit-string.c
…
unit-tpm-api-names.c
…
unit-tpm-blob.c
…
unit-tpm-check-rot-auth.c
…
unit-tpm-rsa-exp.c F-6402: add negative tests pinning wolfBoot_check_rot digest comparison 2026-07-02 14:10:44 +02:00
unit-uart-flash.c
…
unit-update-disk-oob.c update_disk.c: enforce bound over memcpy 2026-06-23 17:28:25 +02:00
unit-update-disk.c F-6130: clear disk_encrypt_key/nonce before panic paths that skip the final cleanup 2026-07-02 15:23:43 +02:00
unit-update-flash-hwswap.c F-6403: add successful-boot test coverage for HW-swap wolfBoot_start 2026-07-02 15:06:17 +02:00
unit-update-flash.c
…
unit-update-ram-enc.c test/ram-enc: add exact-max and one-block-over boundary tests 2026-06-18 11:26:15 +02:00
unit-update-ram-nofixed.c
…
unit-update-ram-noramboot.c
…
unit-update-ram.c
…
unit-va416x0-fram.c
…
unit-wolfhsm_flash_hal.c Add WOLFCRYPT_TZ_WOLFHSM TrustZone engine for STM32H5 2026-06-24 15:49:43 -07:00
unit-x86-paging-oob.c
…

README.md

Unit Test Tools

This uses the "check" unit test framework for C.

You may need to run "apt install check", "yum install check" or "brew install check".

Building

Use make to build.

Expected output

$ ./unit-parser
Running suite(s): wolfBoot
Explicit end of options reached
This field is too large (bigger than the space available in the current header)
This field is too large and would overflow the image header
Illegal address (too high)
Illegal address (too high)
100%: Checks: 2, Failures: 0, Errors: 0