Commit Graph

3091 Commits (8fe46bb40fbb095324d71b1f86e5703affe88ec1)

Author SHA1 Message Date
David Garske 8fe46bb40f Peer review fixes (thanks Copilot)
hal/stm32g4.c:
- hal_flash_write unaligned path: rebase the aligned doubleword on
  (address + i), not the initial address; index as dst[0]/dst[1].
  The old form skipped to the wrong DW once i advanced past 8 with
  an unaligned starting address.
- hal_flash_erase: end_address was address + len - 1 paired with a
  strict less-than, which dropped the last page when len straddled a
  page boundary by one byte. Use address + len.
- flash_clear_errors / EOP clear at end of hal_flash_write: FLASH_SR
  bits are W1C. Read-modify-write via |= can clear unrelated W1C
  bits that happen to be set. Write the mask directly.
- uart_write: cast through uint8_t before promoting to uint32_t so
  high-bit chars do not sign-extend into TDR.

hal/stm32g4.h:
- DMB/ISB/DSB: add the "memory" clobber so the compiler also treats
  them as scheduling barriers, not just hardware-level fences.

hal/stm32g4.ld:
- Rename the output section .edidx to .ARM.exidx to match the
  input-section pattern and standard Cortex-M linker scripts.
2026-05-29 13:10:15 +02:00
David Garske c075549ea2 Add wolfBoot support for STM32G4 2026-05-29 13:10:15 +02:00
David Garske 0cb6bd42ac Vorago VA416x0: simplify iram_write/iram_fill (single RMW path) 2026-05-29 13:09:19 +02:00
David Garske 9786f5608b Add wolfBoot port for STM32N6 (NUCLEO-N657X0-Q)
Co-authored-by: Aidan Garske <aidan@wolfssl.com>
2026-05-28 16:49:57 +02:00
Brett Nicholas a1f86fa1c2 expose root CA list as makefile var 2026-05-26 17:37:50 +02:00
Brett Nicholas b8bc0a75e5 Add support for wolfHSM multi-root certificate verification 2026-05-26 17:37:50 +02:00
Alex Lanzano a41a98551b Fix mcxn build by providing the RNG for TZ_PSA builds 2026-05-26 17:13:17 +02:00
Yosuke Shimizu f4d5340641 Add hardware-based DICE on mcxn 2026-05-21 20:49:20 +02:00
David Garske b983fa7717
Merge pull request #783 from Frauschi/mldsa_rename
Continue the ML-DSA renaming
2026-05-19 12:03:28 -07:00
Tobias Frauenschläger 6e60abd034 Continue the ML-DSA renaming 2026-05-19 11:21:20 -07:00
David Garske 6e3c43e44e
Merge pull request #781 from Frauschi/mldsa_rename
ML-DSA rename part 1
2026-05-19 06:47:22 -07:00
Tobias Frauenschläger cab04ad789 Update wolfssl submodule to latest master
* file level rename for ML-DSA
* Add missing source file to build system
* Update some macros
* Other minor fixes
* Update size limitations for some slight increases
2026-05-18 23:02:54 -07:00
David Garske c3d255d8ed Vorago VA416x0: harden iram_write/iram_fill per review
Two follow-ups to the IRAM shadow update fix (da96f5a2):

1. Mark the bulk-copy destination as volatile uint32_t * so the compiler
   cannot lower a 32-bit assignment into byte/halfword stores. Sub-word
   stores are silently dropped by the IRAM ECC, so a future codegen
   change could have broken the workaround.

2. Use (uintptr_t)3u / ~(uintptr_t)3u for alignment masking. On targets
   where uintptr_t is wider than unsigned int the bare ~3u would zero
   the high half of the address; harmless on Cortex-M4 today, but the
   helper pattern is easy to copy elsewhere.

The int len type is kept to match the wolfBoot ext_flash_* HAL signature
convention across all ports.

Verified with arm-none-eabi-objdump: aligned bulk path emits only 32-bit
str instructions (no strb/strh).
2026-05-13 18:35:30 +02:00
David Garske 08c6673407 Fix Vorago VA416x0 IRAM shadow update (use word-aligned stores)
The VA416xx code RAM (IRAM at 0x00000000-0x0003FFFF) silently drops 8-bit
and 16-bit stores when ROM_PROT.WREN=1 - only word-aligned 32-bit stores
are honored, because the ECC machinery computes parity per 32-bit word
and rejects sub-word writes (no fault is raised). wolfBoot's local
memcpy()/memset() are byte-wise (ldrb/strb), so the IRAM shadow update
in ext_flash_write/read/erase appeared to succeed but actually left
the destination unchanged. The FRAM content was updated correctly, but
after the swap wolfBoot branched into the partition at 0xB800 in IRAM
where the stale image still lived, so the running app was the OLD
version even though the partition header (read from FRAM) reported the
new version.

Add iram_write/iram_fill helpers that use 32-bit stores for the bulk
of an aligned region and read-modify-write the containing word for any
unaligned head/tail, and use them in ext_flash_write/read/erase in
place of memcpy/memset for the shadow update. Partition addresses are
sector-aligned so in practice the path is always pure 32-bit stores.

Verified end-to-end on VA41630-EVK with build_test.sh update: app v1
boots, trigger sets, swap runs sector-by-sector, post-swap boot prints
"Booting version: 0x2" and the running app prints v2-specific output
in TESTING state. After wolfBoot_success() and a manual reset the
second boot reports state CONFIRMED.
2026-05-13 18:35:30 +02:00
David Garske b94954eab4 Add Xilinx Zynq-7000 (ZC702) wolfBoot port 2026-05-12 12:06:05 +02:00
David Garske 7b0bee50de
Merge pull request #773 from twcook86/lpc55s69_crypto_2
Fix lingering lpc55s69 issues
2026-05-08 15:59:20 -07:00
Thomas Cook 6093b68f15 Fix lingering lpc55s69 issues 2026-05-07 17:06:35 -04:00
Mattia Moffa 1ce8234e49 Add kinetis LMS small config 2026-05-07 21:39:34 +02:00
Mattia Moffa 8a70a83039 Change ECC partitioning 2026-05-07 21:39:34 +02:00
Mattia Moffa fda8668cc3 Address Copilot comments 2026-05-07 21:39:34 +02:00
Mattia Moffa dc6cfaaf83 Kinetis KL26 port 2026-05-07 21:39:34 +02:00
Mattia Moffa 6ff19bf492 Address Copilot suggestions 2026-05-06 19:03:12 +02:00
Mattia Moffa 26981e0da5 update_flash_hwswap: remove dead code
F#3538
2026-05-06 19:03:12 +02:00
Mattia Moffa b6235ce079 OTP keystore getters: check id < 0
F#3543
2026-05-06 19:03:12 +02:00
Mattia Moffa f8bc66d825 arm_tee_psa_ipc: validate in_vec/out_vec base and length before dereferencing in crypto dispatcher
F#3541, F#3542
2026-05-06 19:03:12 +02:00
Mattia Moffa e8212dd2ec Check TLV fields' size is correct in image headers
F#3540
2026-05-06 19:03:12 +02:00
Mattia Moffa 1ec402ea18 Unit tests: check hal_flash_protect actually gets called
F#3539
2026-05-06 19:03:12 +02:00
Mattia Moffa f2b95c2563 STM32H5, STM32U5, STM32L5: fix off-by-one error in hal_flash_erase
F#3537
2026-05-06 19:03:12 +02:00
Mattia Moffa 871dd854ff Flash test: fix off-by-one error
F#3536
2026-05-06 19:03:12 +02:00
Mattia Moffa 481ff1ffdb trailer_write: exit on error
F#3535
2026-05-06 19:03:12 +02:00
Mattia Moffa 172ecdc975 Sign tool: fix wrong fread/fwrite API usage when HAVE_MMAP==0
(F#3534)
2026-05-06 19:03:12 +02:00
David Garske af40ae1471 Add STM32C5 target (NUCLEO-C5A3ZG) 2026-05-06 19:02:58 +02:00
Mattia Moffa d69086c39a
Merge pull request #772 from danielinux/otp-fix-string
Fix initialization of string in otp_keystore tag
2026-05-06 13:59:25 +02:00
Daniele Lacamera d1df8b2df0 Fix initialization of string in otp_keystore tag (fix build error)
Emerged in newer gcc15, due to -Wunterminated-string-initialization
added to -Wall
2026-05-06 10:22:59 +02:00
Brett Nicholas 9a667f2a75 set TC3 ARCH_FLASH_OFFSET with ?= 2026-05-05 16:37:54 +02:00
Brett Nicholas dd8accdc87 increase size 2026-05-05 16:37:54 +02:00
Brett Nicholas 8f191b9f3a enable WOLFBOOT_IMG_HASH_ONESHOT for all AURIX configs 2026-05-05 16:37:54 +02:00
Brett Nicholas 24841a0eb8 support AURIX hw accel 2026-05-05 16:37:54 +02:00
Brett Nicholas 8ac4838b92 tc3: disable/capture bus errors for lifetime of bootloader 2026-05-05 16:37:54 +02:00
Brett Nicholas 149db43612 tc3: add echo test to test-app when wolfHSM is enabled 2026-05-05 16:37:54 +02:00
Brett Nicholas f5a8efeb25 tc3: fix for latest wolfHSM, remove devId from cryptoCtx as it no longer exists 2026-05-05 16:37:54 +02:00
Brett Nicholas 2ca5ae3894 add self-header to tricore config 2026-05-05 16:37:54 +02:00
Brett Nicholas e43e012e98 review feedback 2026-05-05 16:37:54 +02:00
Brett Nicholas dc2664a701 update unit tests to use new APIs 2026-05-05 16:37:54 +02:00
Brett Nicholas 627e0664a2 fix include order for unit tests 2026-05-05 16:37:54 +02:00
Brett Nicholas a2e9267529 Adds generic cryptocb support for PK, hash, and symmetric crypto 2026-05-05 16:37:54 +02:00
Thomas Cook 8d96afb7e2 Fix lms/xmss header includes. 2026-05-05 14:08:35 +02:00
David Garske 9ca1d435b9 Peer review fixes (copilot)
src/fdt.c, include/fdt.h
  - Propagate fdt_fixup_initrd error in fit_load_ramdisk so a /chosen
    patch failure no longer silently boots a kernel with no initrd.
  - Add fit_load_image_to(): decompress (or memcpy) directly to a
    caller-supplied destination buffer instead of going through the
    FIT-declared `load` address. fit_load_ramdisk now uses this when
    WOLFBOOT_LOAD_RAMDISK_ADDRESS is set, so the override is a real
    safety bound for compressed ramdisks (previously the gzip stream
    was still inflated to the FIT `load` and only memcpy'd afterward).
  - Refactor fit_load_image_ex into a shared inner helper.
  - Reword the WOLFBOOT_FIT_MAX_DECOMP comment: the cap is a sanity
    ceiling, not a per-destination memory-safety bound. Authenticity
    is provided by the outer wolfBoot signature; tighter bounds need
    fit_load_image_ex / _to with an explicit out_max / dst_max.
  - Add WOLFBOOT_FIT_MAX_RAMDISK (defaults to WOLFBOOT_FIT_MAX_DECOMP)
    so targets can pin a tighter ramdisk decompression bound.

src/update_ram.c, src/update_disk.c
  - Panic when fit_load_image() returns NULL for the kernel subimage
    instead of letting load_address=NULL propagate into do_boot().

tools/unit-tests/unit-gzip.c
  - Add deterministic stored / fixed-Huffman / dynamic-Huffman gzip
    fixtures so the inflater's BTYPE 00/01/10 paths are exercised
    independent of host gzip(1) heuristics.
  - Add FEXTRA / FNAME / FCOMMENT / FHCRC and combined-flag fixtures
    plus a truncated-FEXTRA negative case to cover the optional gzip
    header parser.

tools/unit-tests/unit-fit-gzip.c (new), tools/unit-tests/Makefile
  - New libcheck binary covering the FIT loader's compression
    branches: gzip success, gzip stream corruption, unknown
    compression, compression="none" baseline, and the no-load
    fail-closed path. Built twice from the same source - once with
    WOLFBOOT_GZIP for the success / runtime-failure paths, and once
    without it so the compile-time fail-closed branch is also tested.
2026-05-05 10:16:16 +02:00
David Garske d92053037c Fixes from peer review (Thank you Daniele and Marco) 2026-05-05 10:16:16 +02:00
David Garske 85fb32b1dd Fixes from peer review. Thank you Alex 2026-05-05 10:16:16 +02:00