Commit Graph

3324 Commits (3df56e136ec2dac31c8dfd9a30eee0a7ec19777f)

Author SHA1 Message Date
Brett Nicholas 3df56e136e add __pycache__ to gitignore 2026-07-22 09:50:49 -06:00
Brett Nicholas 1db68ec858 remove erroneously committed pycache object 2026-07-22 09:50:35 -06:00
Brett Nicholas 95e90f2e91 revined comment 2026-07-22 09:42:45 -06:00
Brett Nicholas 8c476ae3a0 fixed aliased variable 2026-07-21 18:05:22 -06:00
Brett Nicholas 358fe03668 fix sign tool arg index error 2026-07-21 17:34:26 -06:00
Brett Nicholas 0d5eec0d6f add test coverage for large and file-backed tlvs 2026-07-21 16:33:19 -06:00
Brett Nicholas 22b2fe5dc9 add custom file-backed TLV sign option 2026-07-21 16:19:04 -06:00
Brett Nicholas 6c148b2e9e increase custom TLV size limit to UINT16_MAX 2026-07-21 15:15:10 -06:00
aidan garske 88c0f1fd55 6560 - Clear PFSWAP bit in pic32_fcw_pfswap_set read-modify-write 2026-07-21 19:33:40 +02:00
aidan garske f27d3eb2a9 6588 - Index LS1028A XSPI TX FIFO by word instead of by byte 2026-07-21 19:33:40 +02:00
Mattia Moffa 20307e47b5 Remove argc <= 14 limit in signing tool 2026-07-20 13:28:55 +02:00
David Garske a3e2bc89d2 Add wolfBoot HAL port for RealTek RTL8735B (AmebaPro2) 2026-07-16 10:16:25 +02:00
aidan garske 1ac8452c36 6589 - Use volatile accumulator in whFlashH5_Verify CT compare 2026-07-14 17:44:26 +02:00
aidan garske eb7f92770c 6562 - Emit build-time warning for WOLFBOOT_SKIP_BOOT_VERIFY 2026-07-14 17:44:26 +02:00
aidan garske 5ceb794690 6593 - Bound uncompressed FIT subimage copy by staging buffer size 2026-07-14 17:44:26 +02:00
aidan garske c88ebcc5bc 6568 - Zeroize DICE UEID digest and hash context before return 2026-07-14 17:44:26 +02:00
aidan garske 717421db4e 6561 - Restore upper 64-bit BAR register on pci_program_bar error paths 2026-07-14 17:44:26 +02:00
Mattia Moffa 4308b36cfb
Merge pull request #821 from danielinux/fix-stm32-dualbank-erased-partition
stm32u5: fix erase bank selection when SWAP_BANK is active
2026-07-09 18:54:51 +02:00
Daniele Lacamera 8609c9b23b ci: fix WOLFBOOT_ROOT resolution in dual-bank fallback test
The top-level Makefile defaults WOLFBOOT_ROOT to $(PWD), which is the
environment value of the invoking step: under the workflow's
working-directory (test-app/emu-test-apps) the keytools paths resolved
under the wrong root and keygen was never found, so src/keystore.c was
missing and the wolfboot build failed. Export the computed absolute
WOLFBOOT_ROOT so the make invocations resolve tool paths correctly
wherever the script is started from.
2026-07-09 16:43:55 +02:00
Daniele Lacamera 3744aae33d ci: add stm32u5 dual-bank swap fallback test on m33mu
Add a GitHub Actions workflow covering the DUALBANK_SWAP fallback
scenario fixed by the previous commit, running on the m33mu emulator
(wolfboot-ci-m33mu image, which models the physical-bank BKER/SWAP_BANK
semantics of the STM32U5 flash controller).

The test drives three boots in a single emulator session with the
stm32u5-nonsecure-dualbank config:

  1. wolfBoot verifies a valid v2 image in the UPDATE partition,
     activates SWAP_BANK and reboots;
  2. the v2 app, now running from physical bank 2, stages a fake v3
     image with a broken integrity record into the logical UPDATE
     partition and reboots;
  3. wolfBoot selects the v3 update, fails verification, and must erase
     the corrupt update and fall back to v2, which reports success via
     breakpoint.

Besides the success breakpoint, the script checks the emulator flash
trace: the UPDATE partition must be erased and the BOOT partition
(holding the healthy image) must never be touched, so a regression
cannot hide behind an accidentally bootable state. Verified to fail
against the pre-fix hal_flash_erase, where boot 3 erases the healthy
image and the device bricks.
2026-07-09 15:14:51 +02:00
Daniele Lacamera 7baf9e65f7 stm32u5: fix erase bank selection when SWAP_BANK is active
On STM32U5 the BKER bit in FLASH_NSCR/SECCR always selects the
physical bank: the SWAP_BANK option only changes the address mapping
of the banks (RM0456 7.5.8, and confirmed on silicon). hal_flash_erase
derived BKER from the logical address only, so with SWAP_BANK active
every page erase landed in the bank opposite to the one mapped at the
target address.

In DUALBANK_SWAP mode this broke fallback recovery: when image
verification failed while running from bank 2, wolfBoot_erase_partition
(PART_UPDATE) erased the healthy image in the active bank instead of
the failing update, leaving the device unable to boot. The same
mismatch corrupted any erase issued while swapped, including staging a
new update from the application.

Invert BKER when both DBANK and SWAP_BANK are set, mirroring the
STM32H5 HAL which already handles this (RM0481 has the same physical
bank semantics). STM32L5 is not affected: RM0438 defines NSBKER as the
page number MSB, which follows the mapped address.

Verified on the m33mu emulator with hardware-faithful BKER/SWAP_BANK
modeling: full cycle (update to bank 2, swap, stage corrupt update,
verify failure) now erases the corrupt update and falls back to the
healthy image; before this fix the healthy image was erased and the
device bricked.
2026-07-09 12:09:14 +02:00
David Garske ff7fa35781
Merge pull request #813 from danielinux/prepare-release-2.9.0
Preparing release 2.9.0
2026-07-02 15:16:32 -07:00
Daniele Lacamera 16acbe3543 docs: version-agnostic boot output example 2026-07-02 22:58:46 +02:00
Daniele Lacamera 4d67268a03 version: 2.9.0 2026-07-02 22:58:46 +02:00
Daniele Lacamera c69303ad0a docs: add 2.9.0 changelog 2026-07-02 22:58:46 +02:00
Daniele Lacamera b69f395177 stm32f1: enlarge bootloader to 14KB for ed25519 growth 2026-07-02 22:58:46 +02:00
Daniele Lacamera 781a2d620e arm: skip broken newlib stdatomic.h under clang 2026-07-02 22:58:46 +02:00
Daniele Lacamera f9798dc9bb test: bump footprint limits for wolfssl update 2026-07-02 22:58:46 +02:00
Daniele Lacamera 88640a5673 Updated submodules 2026-07-02 22:58:46 +02:00
David Garske e81761e0d9
Merge pull request #816 from danielinux/hardening-fixes
Extend mitigations against glitch injections
2026-07-02 13:56:42 -07:00
Daniele Lacamera 195610647c armored: address review on hardened compare and fw_base check 2026-07-02 20:33:07 +02:00
Daniele Lacamera 6708438024 armored: use hardened digest compare in elf and delta paths 2026-07-02 20:11:46 +02:00
Daniele Lacamera eca9a20b3b armored: harden fw_base against fault injection 2026-07-02 20:09:16 +02:00
David Garske 39f079fb61
Merge pull request #815 from danielinux/stm32u5-flash-lock-fix
Fix STM32U5 fallback erase and rollback handling
2026-07-02 11:06:02 -07:00
Daniele Lacamera 2c1b3f28da Address PR #815 review comments
- Document wolfBoot_erase_partition() lock postcondition in doxygen
- Comment the hwswap anti-rollback guard as defense-in-depth
- Clarify sim-dualbank-rollback-denied.sh purpose via header comment
- Simplify lock guards in unit-nvm partition_magic_write test
2026-07-02 19:20:34 +02:00
Daniele Lacamera 020d126b63 Fix hwswap fallback CI regressions 2026-07-02 18:57:55 +02:00
Daniele Lacamera 0a6eb658f5 Fix STM32U5 fallback erase and rollback handling 2026-07-02 18:55:23 +02:00
David Garske 277cbbe4f8
Merge pull request #814 from danielinux/fenrir-fixes-2026-07-02
Fenrir fixes 2026 07 02
2026-07-02 09:44:58 -07:00
Mattia Moffa ca2c7f6c9f Check that diagnostics sectors fit at least one record 2026-07-02 17:53:12 +02:00
Mattia Moffa d15f4cbbf2 Revert check for overlap of swap/update with bootloader
Some configs may exploit that possibility
2026-07-02 17:53:12 +02:00
Mattia Moffa ef03cf007f Fix additional findings
- Check diag_erase() return value in wolfBoot_record_failure()
- Dedicated WOLFBOOT_FAILURE_PHASE_SELF_UPDATE
- Mark the diagnostics flash write buffers XALIGNED_STACK(4) for HALs
  that access the source word by word
- Ensure diagnostics, update, or swap partitions don't overlap the
  bootloader
2026-07-02 17:53:12 +02:00
Mattia Moffa 1da9866630 Diagnostics: record additional events
- Failed boot after emergency update (WOLFBOOT_FAILURE_PHASE_RECOVERY)
- Failed verification of self-update image
2026-07-02 17:53:12 +02:00
Mattia Moffa 67f8ed1194 Diagnostics: support hal_flash_write/erase that return size 2026-07-02 17:53:12 +02:00
Mattia Moffa 55295b705c Diagnostics: move to next sector when last record is broken 2026-07-02 17:53:12 +02:00
Mattia Moffa 00e228d8d7 Check diagnostics partition is aligned and doesn't overlap
Also updates docs to specify the requirement of the HAL flash driver by
wolfBoot_clear_failures().
2026-07-02 17:53:12 +02:00
Mattia Moffa ceaed58782 Allow configuration of diagnostics record size on flash 2026-07-02 17:53:12 +02:00
Mattia Moffa 69e8e044c9 Add unit tests 2026-07-02 17:53:12 +02:00
Mattia Moffa 539852e8ac Address Copilot comments 2026-07-02 17:53:12 +02:00
Mattia Moffa 7cc4990907 Add option to persist boot/update failure info to flash
When boot/update partition verification fails during boot or update,
with this option the event is logged to flash in an ad-hoc partition.
Information about logged failures is made available to the application
through an API.
2026-07-02 17:53:12 +02:00
Daniele Lacamera d383fc1009 unit-tests: build otp-keystore-gen test without generated keystore.c
src/keystore.c is generated and gitignored, so the test failed to build
on a clean tree. Use the checked-in unit-keystore.c stub instead.
2026-07-02 17:01:28 +02:00