wolfBoot/tools/unit-tests
Daniele Lacamera 32e41f0f40 F-6399: fix imx_rt DCACHE invalidation to include down-alignment offset
hal_flash_write() and hal_flash_erase() aligned the invalidation start
address down to a 32-byte cache line but rounded the length up from
"len" alone, omitting the (address - aligned_address) offset. Whenever
(address % 32) + (len % 32) > 32, the invalidated range fell short of
address + len, leaving the last cache line stale after a write/erase.

Extract the range computation into hal_flash_cache_align_range()
(hal/imx_rt.h, dependency-free so it's unit-testable without the
NXP SDK) and include the down-alignment offset before rounding the
length up, so the invalidated range always covers [address, address+len).
2026-07-02 15:13:28 +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-6399: fix imx_rt DCACHE invalidation to include down-alignment offset 2026-07-02 15:13:28 +02:00
README.md
…
arm_cmse.h Fix two regressions after the fenrir changes 2026-06-11 19:54:52 +02:00
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 Fix two regressions after the fenrir changes 2026-06-11 19:54:52 +02:00
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 F-4258: reject GPT partitions whose LBA extent overflows uint64_t 2026-06-10 21:01:16 +02:00
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 Add wolfBoot FIT support for loading bitstream 2026-06-09 15:30:27 +02:00
unit-fit-gzip.c Peer review fixes (copilot) 2026-05-05 10:16:16 +02:00
unit-flash-erase-c0.c F-3963: fix hal_flash_erase loop bound in stm32c0.c skipping final partial page 2026-06-11 18:16:48 +02:00
unit-flash-erase-g0.c F-3964: fix hal_flash_erase loop bound in stm32g0.c skipping final partial page 2026-06-11 18:13:30 +02:00
unit-flash-erase-h7.c F-5745: fix off-by-one in hal_flash_erase skipping last page when len%PAGE_SIZE!=0 2026-06-10 21:01:16 +02:00
unit-flash-erase-l0.c F-3965: fix hal_flash_erase loop bound in stm32l0.c skipping final partial page 2026-06-11 18:08:22 +02:00
unit-flash-erase-u3.c F-3962: fix hal_flash_erase loop bound in stm32u3.c skipping final partial page 2026-06-11 18:23:51 +02:00
unit-flash-erase-wb.c F-3966: fix hal_flash_erase loop bound in stm32wb.c skipping final partial page 2026-06-11 18:02:03 +02:00
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 F-5092: fix off-by-one in fwtpm_nv_read/write/erase offset guard 2026-06-10 21:01:16 +02:00
unit-fwtpm-stub.c
…
unit-gzip.c Peer review fixes (copilot) 2026-05-05 10:16:16 +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 Fix XMSS keygen param fallback 2026-04-29 12:30:23 +02:00
unit-keystore.c
…
unit-linux-loader-e820.c F-4711: bound e820 entries to prevent boot_params stack overflow 2026-06-05 19:19:05 +02:00
unit-linux-loader-syssize.c Fix test regression, addressed copilot comments 2026-06-05 20:55:52 +02:00
unit-loader-tpm-init.c
…
unit-max-space.c
…
unit-mock-flash.c
…
unit-mock-state.c
…
unit-mpusize.c F-5132: complete mpusize() table so MPU stays enabled for >64KB wolfBoot 2026-06-09 15:52:07 +02:00
unit-multiboot.c F-4651: bound multiboot2 header_length to prevent OOB tag walk 2026-06-10 21:01:16 +02:00
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 F-3734: add unit tests for magic check and item_count boundary in flash_otp_keystore 2026-06-11 19:13:49 +02:00
unit-parser.c
…
unit-pci.c F-4717: reject PCI BARs whose region overruns the pool to prevent cursor wrap 2026-06-10 21:01:16 +02:00
unit-pkcs11_store.c F-4649: erase pkcs11_store object sectors on write-mode open to clear residual key material 2026-06-10 21:01:16 +02:00
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 F-4973: clamp TPM-supplied nvPublic.dataSize before NV read-back in rot.c 2026-06-09 15:52:07 +02:00
unit-sdhci-disk-unaligned.c F-4716: reject SDHCI block addresses that overflow 32-bit SD command argument 2026-06-10 21:01:16 +02:00
unit-sdhci-response-bits.c
…
unit-sectorflags.c
…
unit-sign-custom-tlv-le.py F-3970: serialise custom TLV integer values through header_store_u64_le 2026-06-11 17:53:25 +02:00
unit-sign-delta-cert-inv-off.py Address Copilot review comments 2026-06-09 15:52:07 +02:00
unit-sign-delta-tlv.py F-5352: emit 4-byte delta size TLVs from Python signer 2026-06-09 15:50:48 +02:00
unit-sign-encrypted-output.c
…
unit-sign-encrypted-output.mkfrag Update wolfssl submodule to latest master 2026-05-18 23:02:54 -07:00
unit-spi-flash.c
…
unit-store-sbrk.c
…
unit-string.c
…
unit-tpm-api-names.c
…
unit-tpm-blob.c F-3738: fix policySz uint16_t underflow in wolfBoot_unseal_blob for short policy 2026-06-11 18:30:49 +02:00
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 Addressed copilot's comments 2026-04-29 13:15:52 +02:00
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-3736: fix pA_ver/pB_ver int/uint32_t mismatch in update_disk wolfBoot_start 2026-06-11 18:32:50 +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 F-4412: add equal-version emergency rollback test to pin >= operator 2026-06-10 21:01:17 +02:00
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 F-3972: add direction-sensitive unit tests for wolfBoot_dualboot_candidate_addr 2026-06-11 17:44:52 +02:00
unit-update-ram-noramboot.c F-4410: fix uint32_t->int cast bypassing anti-rollback in update_ram wolfBoot_start 2026-06-11 17:31:35 +02:00
unit-update-ram.c (tests) ensure update status turns into TESTING after update 2026-06-11 15:36:04 +02:00
unit-va416x0-fram.c Fix two regressions after the fenrir changes 2026-06-11 19:54:52 +02:00
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 F-5093: fix OOB memset in x86_paging_setup_ptp and non-looping panic 2026-06-10 21:01:16 +02:00

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