wolfBoot/tools
Daniele Lacamera 0412238414 F-11044: stage the fwTPM command in secure memory before processing
wcs_fwtpm_transmit() verified that cmd identifies non-secure memory
and then passed that mutable buffer directly to FWTPM_ProcessCommand.
The processor parses the packet more than once (authentication, then
handler execution), so a DMA-capable non-secure attacker who rewrites
the command buffer in the window between the two parses can make the
authenticated command differ from the executed command.

Copy exactly cmdSz bytes into a secure staging buffer after the range
validation and invoke the processor only on that copy: an NS DMA
master cannot rewrite secure memory, so both parses see the same
bytes. The command and response staging are zeroed before returning
(the response may carry auth tags or unsealed data).

unit-fwtpm-cmd-toctou includes the real fwtpm_callable.c and mocks
FWTPM_ProcessCommand with two parse points (authentication,
execution). The test plays the attacker, rewriting the NS command
buffer at the window between the parses - the mock may only touch the
caller's buffer, never secure staging, mirroring the hardware
boundary. Pre-fix the processor authenticated the original bytes and
executed the rewritten ones (test fails); post-fix both parses see
the original command.

Verification:
- Built: unit tests compile the real veneer (host, poisoned fwtpm
  headers, same pattern as unit-fwtpm-nv-oob).
- Tested: unit-fwtpm-cmd-toctou 2/2 (red demonstrated against the
  pre-fix veneer via git stash of the fix); sibling
  unit-fwtpm-rsp-overrun 3/3 and unit-fwtpm-nv-oob 4/4 after the
  change.
- Pitfalls: the staging copy happens after all NS range checks and
  before any processor access; zeroing covers the full staging
  buffers regardless of the produced length.
- Style: cstyle-check.sh flag count on src/fwtpm_callable.c unchanged
  (1 pre-existing); the new test trips only the uncrustify
  pointer-alignment class the sibling unit tests trip.
- Message: F-11044: prefix, no co-author trailers.
- Unverified: no CMSE/armclang build and no m33mu emulator run here
  (lib/wolftpm is not checked out in this tree); the trustzone-emulator
  workflow covers the full build on push.
2026-08-25 08:51:09 +02:00
..
armclang Remove obvious/redundant comments 2026-07-31 16:00:14 +02:00
bin-assemble renesas-rx: fix build for GCC RX 8.3/14.2 2026-07-30 15:32:31 +02:00
check_config
ci PolarFire SoC: LPDDR4 DDR init for MPFS250T Video Kit (M-Mode) 2026-08-03 12:27:22 +02:00
delta
efi efi: sign the x86_64_efi reference kernel with an authenticated HDR_CMDLINE 2026-08-10 21:03:50 +02:00
elf-parser
fdt-parser
keytools F-6762: compare the TLV field budget in a 32-bit domain 2026-08-21 08:52:59 +02:00
lms
openocd Support for MAX32666 2026-07-31 14:33:56 +02:00
renode
sbom sbom: re-vendor wolfGlass at b44ae8d 2026-08-20 15:22:16 +02:00
scripts c2000: add wolfBoot TI C28x (TMS320F28P550SJ) secure-boot XIP port 2026-08-25 00:01:33 +02:00
squashelf add O_BINARY flag for msys2/windows builds 2026-08-11 08:35:12 -06:00
test-expect-version
test-update-server
tpm
uart-flash-server
unit-tests F-11044: stage the fwTPM command in secure memory before processing 2026-08-25 08:51:09 +02:00
xmss
config.mk Add support for auxillary algorithms and cert chain/TPM usage 2026-07-22 11:47:16 +02:00
test-delta.mk
test-enc.mk
test-renode.mk
test.mk lib/wolfssl: bump to ti_c25 merge (e71b086fc) for CHAR_BIT!=8 wide-byte support 2026-08-25 00:01:33 +02:00
wolfboot-rpi-devicetree.diff