Skip to content

fwTPM: append-only NV journal for write-once flash + swtpm UART symlinks#540

Merged
aidangarske merged 1 commit into
wolfSSL:masterfrom
dgarske:fwtpm_flash_nv_and_uart_symlink
Jun 29, 2026
Merged

fwTPM: append-only NV journal for write-once flash + swtpm UART symlinks#540
aidangarske merged 1 commit into
wolfSSL:masterfrom
dgarske:fwtpm_flash_nv_and_uart_symlink

Conversation

@dgarske

@dgarske dgarske commented Jun 24, 2026

Copy link
Copy Markdown
Member
  • Append-only NV mode for write-once flash (internal flash/NOR). The journal stops rewriting the header and trailing MAC in place; instead it derives writePos by scanning, seals each commit with an appended MAC checkpoint, and streams granule-aligned writes so a sector is erased only on compaction. This avoids wearing the header sector and survives a torn final commit (power loss). It plugs into the existing FWTPM_NV_HAL (read/write/erase) - a port sets hal.appendOnly = 1 and hal.writeAlign; no separate adapter. Opt-in and off by default (--enable-fwtpm-nv-appendonly / CMake WOLFTPM_FWTPM_NV_APPEND_ONLY); the file backend and default builds are unchanged and carry no extra memory.
  • swtpm UART now accepts symlinked serial paths (drops O_NOFOLLOW; keeps S_ISCHR/O_NOCTTY, adds O_NONBLOCK).

Tests: new unit test (RAM-backed write-once HAL) covers persist/reboot, torn-tail recovery, and tamper rejection. Verified clean with the option both off and on.

Docs: docs/FWTPM.md and src/fwtpm/ports/README.md (links wolftpm-examples; ports: STM32H5, PolarFire SoC U54, ZCU102 R5 lock-step).

@dgarske dgarske self-assigned this Jun 24, 2026
Copilot AI review requested due to automatic review settings June 24, 2026 22:37
@dgarske dgarske marked this pull request as ready for review June 25, 2026 17:15
@dgarske dgarske force-pushed the fwtpm_flash_nv_and_uart_symlink branch from 47e2ee4 to 724ffdf Compare June 25, 2026 18:18
@dgarske dgarske removed their assignment Jun 25, 2026

@aidangarske aidangarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skoll Multi-Scan Review

Modes: review + review-security + bugsOverall recommendation: REQUEST_CHANGES
Findings: 4 total — 4 posted, 0 skipped
4 finding(s) posted as inline comments (see file-level comments below)

Posted findings

  • [High] [review-security] Append-only NV tamper can roll state back to an earlier checkpointsrc/fwtpm/fwtpm_nv.c:1517-1604
  • [High] [bugs] Append-only recovery misses a torn header at the next append offsetsrc/fwtpm/fwtpm_nv.c:1514-1604
  • [Medium] [review] Document zero-initialization requirement for extended NV HALwolftpm/fwtpm/fwtpm_nv.h:182-184
  • [Medium] [review] Add coverage for no-key append-only images without a checkpointsrc/fwtpm/fwtpm_nv.c:1545-1557

Review generated by Skoll

Comment thread src/fwtpm/fwtpm_nv.c
Comment thread src/fwtpm/fwtpm_nv.c
Comment thread wolftpm/fwtpm/fwtpm_nv.h Outdated
Comment thread src/fwtpm/fwtpm_nv.c Outdated
@dgarske dgarske force-pushed the fwtpm_flash_nv_and_uart_symlink branch 2 times, most recently from a547438 to d3651bd Compare June 29, 2026 18:27
@dgarske dgarske requested a review from aidangarske June 29, 2026 18:29
@dgarske dgarske force-pushed the fwtpm_flash_nv_and_uart_symlink branch from d3651bd to b8709b1 Compare June 29, 2026 19:33
@aidangarske aidangarske merged commit 5506a19 into wolfSSL:master Jun 29, 2026
196 checks passed
@aidangarske aidangarske deleted the fwtpm_flash_nv_and_uart_symlink branch June 29, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants