Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
87e8a10
Raise the ECC384 stack limit for AArch64 SP math
dgarske Nov 25, 2026
d329f91
Check disk decrypt AES return codes and wipe cipher state before boot
dgarske Nov 25, 2026
09b4fb5
Link ARMv8 assembly inside the FIPS boundary and keep P-256 for its CAST
dgarske Nov 25, 2026
e2b9b85
Add FIPS builds with AES image encryption on ZynqMP
dgarske Nov 25, 2026
1b892ec
Add signing key revocation through a signed HDR_KEY_REVOKE mask
dgarske Nov 25, 2026
bc34977
Add a security version floor checked on every boot path
dgarske Nov 25, 2026
6c2f0f7
Keep the ZynqMP security version and key revocation state in user eFuses
dgarske Nov 25, 2026
ccf58ba
Add WOLFBOOT_PRODUCTION build guard against verification-weakening op…
dgarske Nov 25, 2026
d363c28
Cache the FIPS-ready wolfSSL archive in CI
dgarske Nov 30, 2026
8e51af7
Read policy TLVs only from the signed header and refuse unsupported r…
dgarske Dec 1, 2026
37da123
Apply a confirmed image's policy before verifying a staged update
dgarske Dec 1, 2026
b26af5b
Keep the key revocation mask and security version floor in TPM NV bit…
dgarske Dec 1, 2026
8d4b235
Keep the security version floor and key revocation out of the stage 1…
dgarske Dec 1, 2026
86d9ec2
Refuse a security version above what the policy storage can hold
dgarske Dec 1, 2026
94287c2
Lock the TPM platform hierarchy on the disk boot path for policy NV
dgarske Dec 1, 2026
81afd3d
Gate the ZynqMP boot on a required eFuse policy and read it through t…
dgarske Dec 2, 2026
822edb7
Record per-stage boot times and pass them to the OS
dgarske Dec 2, 2026
bf9a5a4
Record verification failures on the disk boot path, in a disk partiti…
dgarske Dec 2, 2026
2d54dd2
Keep the disk failure log clear of the boot state trailer in a shared…
dgarske Dec 2, 2026
bc257d4
Fix review findings in the TPM policy lock and attributes, the FIPS A…
dgarske Dec 2, 2026
f9de468
Stop a production boot when a confirmed image's revocation or securit…
dgarske Dec 3, 2026
676934a
Record a slot whose header cannot be read or used even when the other…
dgarske Dec 3, 2026
8b49a69
Build the disk failure log slot check without a golden slot in filesy…
dgarske Dec 3, 2026
770f8a2
Change the revocation mask and security floor only from a confirmed a…
dgarske Dec 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/test-build-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ jobs:
unsigned long psu_ddr_qos_init_data(void) { return 1UL; }
STUB

# Keep the archive across runs so wolfssl.com is fetched only on a cache
# miss. Both build workflows share the key, which must name the same
# version as WOLFSSL_FIPS_READY_VER below; the SHA-256 check still runs.
- name: Cache FIPS-ready wolfSSL
if: ${{ inputs.fips }}
uses: actions/cache@v4
with:
path: .fips-ready-cache
key: wolfssl-5.9.2-gplv3-fips-ready

- name: Download FIPS-ready wolfSSL
if: ${{ inputs.fips }}
env:
Expand All @@ -145,9 +155,12 @@ jobs:
run: |
set -euxo pipefail
sudo apt-get install -y unzip
zip=/tmp/wolfssl-fips-ready.zip
curl -fsSL --retry 3 --retry-delay 5 -o "$zip" \
"https://www.wolfssl.com/wolfssl-${WOLFSSL_FIPS_READY_VER}.zip"
zip=.fips-ready-cache/wolfssl-${WOLFSSL_FIPS_READY_VER}.zip
if [ ! -f "$zip" ]; then
mkdir -p .fips-ready-cache
curl -fsSL --retry 3 --retry-delay 5 -o "$zip" \
"https://www.wolfssl.com/wolfssl-${WOLFSSL_FIPS_READY_VER}.zip"
fi
got="$(sha256sum "$zip" | awk '{print $1}')"
echo "wolfssl-${WOLFSSL_FIPS_READY_VER}.zip sha256=$got"
if [ -n "${WOLFSSL_FIPS_READY_SHA256:-}" ]; then
Expand Down
19 changes: 16 additions & 3 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ jobs:
- name: Pre-build setup
if: inputs.prep-run != ''
run: ${{inputs.prep-run}}
# Keep the archive across runs so wolfssl.com is fetched only on a cache
# miss. Both build workflows share the key, which must name the same
# version as WOLFSSL_FIPS_READY_VER below; the SHA-256 check still runs.
- name: Cache FIPS-ready wolfSSL
if: ${{ inputs.fips }}
uses: actions/cache@v4
with:
path: .fips-ready-cache
key: wolfssl-5.9.2-gplv3-fips-ready

- name: Download FIPS-ready wolfSSL
if: ${{ inputs.fips }}
env:
Expand All @@ -65,9 +75,12 @@ jobs:
WOLFSSL_FIPS_READY_SHA256: ${{ vars.WOLFSSL_FIPS_READY_SHA256 }}
run: |
set -euxo pipefail
zip=/tmp/wolfssl-fips-ready.zip
curl -fsSL --retry 3 --retry-delay 5 -o "$zip" \
"https://www.wolfssl.com/wolfssl-${WOLFSSL_FIPS_READY_VER}.zip"
zip=.fips-ready-cache/wolfssl-${WOLFSSL_FIPS_READY_VER}.zip
if [ ! -f "$zip" ]; then
mkdir -p .fips-ready-cache
curl -fsSL --retry 3 --retry-delay 5 -o "$zip" \
"https://www.wolfssl.com/wolfssl-${WOLFSSL_FIPS_READY_VER}.zip"
fi
got="$(sha256sum "$zip" | awk '{print $1}')"
echo "wolfssl-${WOLFSSL_FIPS_READY_VER}.zip sha256=$got"
if [ -n "${WOLFSSL_FIPS_READY_SHA256:-}" ]; then
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/test-configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,15 @@ jobs:
config-file: ./config/examples/sim-fips.config
fips: true

# ARMv8 asm inside the FIPS boundary, with AES-256 image encryption.
zynqmp_fips_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
arch: aarch64
config-file: ./config/examples/zynqmp_sdcard.config
make-args: wolfboot.bin FIPS=1 SIGN=ECC384 HASH=SHA384 ENCRYPT=1 ENCRYPT_WITH_AES256=1 WOLFBOOT_LIB_WOLFSSL=../wolfssl-5.9.2-gplv3-fips-ready
fips: true

tegra234_sdcard_fs_test:
uses: ./.github/workflows/test-build.yml
with:
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/test-key-revocation-simulator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Key revocation and security version - test with simulator target

on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]

jobs:
revocation_svn_simulator_tests:
strategy:
fail-fast: false
matrix:
include:
- name: key-revocation
options: KEY_REVOCATION=1
scripts: sim-key-revocation.sh
- name: security-version
options: SECURITY_VERSION=1
scripts: sim-security-version.sh
- name: both
options: KEY_REVOCATION=1 SECURITY_VERSION=1
scripts: sim-security-version.sh sim-key-revocation.sh
- name: both-production
options: KEY_REVOCATION=1 SECURITY_VERSION=1 WOLFBOOT_PRODUCTION=1
scripts: sim-security-version.sh sim-key-revocation.sh
name: ${{ matrix.name }}
runs-on: ubuntu-latest
container:
image: ghcr.io/wolfssl/wolfboot-ci-sim:v1.0
timeout-minutes: 15

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Trust workspace
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Select config
run: |
make distclean
cp config/examples/sim.config .config
for opt in ${{ matrix.options }}; do echo "$opt" >> .config; done

- name: Build tools
run: |
make -C tools/keytools && make -C tools/bin-assemble

- name: Build wolfboot.elf and test-app/image.elf
run: |
make test-sim-internal-flash-with-update

- name: Run simulator tests
run: |
for s in ${{ matrix.scripts }}; do tools/scripts/$s || exit 1; done

revocation_svn_tpm_nv_tests:
name: tpm-nv
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- uses: actions/checkout@v4
with:
repository: kgoldman/ibmswtpm2
ref: ad169862f25060f6d83ef3018be7dbdc9bf4e266
path: ibmswtpm2
- name: ibmswtpm2 make
working-directory: ./ibmswtpm2/src
run: |
make
./tpm_server &

- uses: actions/checkout@v4
with:
submodules: true

- name: Select config
run: |
make distclean
cp config/examples/sim-tpm.config .config
for opt in KEY_REVOCATION=1 SECURITY_VERSION=1 WOLFBOOT_TPM_POLICY_NV=1; do echo "$opt" >> .config; done

- name: Build tools
run: |
make -C tools/keytools && make -C tools/bin-assemble

- name: Build wolfboot.elf and test-app/image.elf
run: |
make test-sim-internal-flash-with-update

- name: Build TPM tools
run: |
make tpmtools

- name: Run simulator tests
run: |
for s in sim-security-version.sh sim-key-revocation.sh; do tools/scripts/$s || exit 1; done
2 changes: 1 addition & 1 deletion .github/workflows/test-units.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
container:
image: ghcr.io/wolfssl/wolfboot-ci-sim:v1.0
timeout-minutes: 15
timeout-minutes: 30

steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ tools/tpm/pcr_reset
tools/tpm/pcr_extend
tools/tpm/policy_create
tools/tpm/policy_sign
tools/tpm/policy_nv
config/*.ld
config/*.sct
test-lib
Expand Down Expand Up @@ -642,6 +643,7 @@ tools/unit-tests/imx8qm_flexspi_extract.h
tools/unit-tests/unit-ct-compare
tools/unit-tests/unit-zynqmp-bbram-crc
tools/unit-tests/unit-zynqmp-efuse-guards
tools/unit-tests/unit-zynqmp-efuse-counter
tools/unit-tests/unit-zynqmp-efuse-burn
tools/unit-tests/unit-fit-gzip-small
tools/unit-tests/unit-gzip-bits32
Expand Down Expand Up @@ -703,12 +705,15 @@ tools/unit-tests/unit-ti-hercules-erase
tools/unit-tests/unit-update-disk-fsp
tools/unit-tests/unit-update-ram-custom-trailer
tools/unit-tests/unit-update-ram-rollback-unconfirmed
tools/unit-tests/unit-update-ram-confirm-hooks
tools/unit-tests/unit-update-disk-confirm-hooks
tools/unit-tests/unit-update-ram-nofixed-noramboot
tools/unit-tests/unit-update-trigger-scrub
tools/unit-tests/unit-x86-uart
# sources generated by the unit-test extraction rules
tools/unit-tests/bbram_crc_extract.h
tools/unit-tests/efuse_guards_extract.h
tools/unit-tests/efuse_counter_extract.h
tools/unit-tests/stm32g0_write_extract.h
tools/unit-tests/ct_compare_extract.h
tools/unit-tests/puf_extract.h
Expand Down
42 changes: 42 additions & 0 deletions arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,25 @@ ifeq ($(ARCH),AARCH64)
ifeq ($(TARGET),zynq)
ARCH_FLAGS=-march=armv8-a+crypto
CFLAGS+=$(ARCH_FLAGS) -DCORTEX_A53
# User eFuse rows (USER_0..USER_7 index) for the security version counter
# and the key revocation mask. No default: the allocation is a
# provisioning decision.
ifeq ($(SECURITY_VERSION),1)
ifeq ($(ZYNQMP_EFUSE_SVN_ROW),)
$(error SECURITY_VERSION=1 on zynq needs ZYNQMP_EFUSE_SVN_ROW)
endif
ifeq ($(ZYNQMP_EFUSE_SVN_NROWS),)
$(error SECURITY_VERSION=1 on zynq needs ZYNQMP_EFUSE_SVN_NROWS)
endif
CFLAGS+=-DZYNQMP_EFUSE_SVN_ROW=$(ZYNQMP_EFUSE_SVN_ROW)
CFLAGS+=-DZYNQMP_EFUSE_SVN_NROWS=$(ZYNQMP_EFUSE_SVN_NROWS)
endif
ifeq ($(KEY_REVOCATION),1)
ifeq ($(ZYNQMP_EFUSE_REVOKE_ROW),)
$(error KEY_REVOCATION=1 on zynq needs ZYNQMP_EFUSE_REVOKE_ROW)
endif
CFLAGS+=-DZYNQMP_EFUSE_REVOKE_ROW=$(ZYNQMP_EFUSE_REVOKE_ROW)
endif
CFLAGS+=-DNO_QNX
# Support detection and skip of U-Boot legacy header */
CFLAGS+=-DWOLFBOOT_UBOOT_LEGACY
Expand Down Expand Up @@ -182,6 +201,29 @@ ifeq ($(ARCH),AARCH64)
endif
endif
endif
# As BL33 the user eFuse writes go through the PMU firmware; the same
# opt-in arms them, otherwise they are report-only.
ifneq ($(ZYNQMP_FSBL),1)
ifeq ($(ZYNQMP_EFUSE_BURN),1)
CFLAGS+=-DZYNQMP_EFUSE_BURN
endif
endif
# eFuse security state (SEC_CTRL, PUF, PPK0 hash): read directly as the
# FSBL, through the PMU firmware as BL33.
ifeq ($(ZYNQMP_SEC),1)
CFLAGS+=-DWOLFBOOT_ZYNQMP_SEC_STATE
endif
# SEC_CTRL bits a deployed part must have. A WOLFBOOT_PRODUCTION build
# refuses a part without them; any other build boots it and reports it.
ifneq ($(ZYNQMP_SEC_POLICY),)
ifneq ($(ZYNQMP_SEC),1)
$(error ZYNQMP_SEC_POLICY needs ZYNQMP_SEC=1)
endif
ifneq ($(filter 0 0x0 0x00 0x00000000,$(ZYNQMP_SEC_POLICY)),)
$(error ZYNQMP_SEC_POLICY=0 would refuse every part; leave it unset for no policy)
endif
CFLAGS+=-DZYNQMP_SEC_POLICY=$(ZYNQMP_SEC_POLICY)
endif

endif

Expand Down
8 changes: 8 additions & 0 deletions config/examples/nai_68int6.config
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,11 @@ DISK_ERASE=0
# Anti-rollback: persistent version floor + audit counters in TPM NV
# (trust-on-first-use; provision before first boot where that matters).
ANTI_ROLLBACK=1

# Signing key revocation and a security version floor in TPM NV bit-field
# indices. They are committed only for a confirmed image, so the OS must
# confirm each boot (DISK_BOOT_CONFIRM). Not yet run on this board.
#DISK_BOOT_CONFIRM=1
#KEY_REVOCATION=1
#SECURITY_VERSION=1
#WOLFBOOT_TPM_POLICY_NV=1
43 changes: 41 additions & 2 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,24 @@ This feature is disabled by default. To enable it, set
smaller than, the flash write granularity. Raise it on platforms whose flash
write word is wider than 16 bytes (for example 32 for the 256-bit words on
STM32H7).
- `WOLFBOOT_DIAGNOSTICS_DISK_PART`: on the disk boot path (`WOLFBOOT_UPDATE_DISK`),
keep the region in this partition of the boot disk instead of flash. The
partition is normally reserved for it (a few sectors of
`WOLFBOOT_SECTOR_SIZE`); `WOLFBOOT_DIAGNOSTICS_ADDRESS` becomes a byte offset
into it and defaults to 0, and an erase writes the erased pattern. On a card
with no partition to spare it can share a boot slot's partition, with
`WOLFBOOT_DIAGNOSTICS_ADDRESS` at or beyond `IMAGE_HEADER_SIZE +
WOLFBOOT_RAMBOOT_MAX_SIZE` so no image the slot accepts can reach it; the
build refuses a slot partition without that, and a slot that holds a
filesystem (`WOLFBOOT_DISK_FS`). At boot the region must also end inside
the partition, before the slot's boot state trailer with
`DISK_BOOT_CONFIRM`; otherwise wolfBoot prints a warning and records
nothing.
The drive is `BOOT_DISK`. It cannot be combined with
`WOLFBOOT_DIAGNOSTICS_EXT`. Where the board also has a SPI flash, the same
store can live there instead with `EXT_FLASH=1` and
`WOLFBOOT_DIAGNOSTICS_EXT=1`; `WOLFBOOT_SECTOR_SIZE` must then be the flash
erase block (for example `0x20000` for the dual-parallel QSPI on ZCU102).

The region is managed as a circular store over its sectors. With two or more
sectors, older records are retained until the log wraps all the way around, so
Expand All @@ -117,11 +135,25 @@ The following events are recorded:
- A rollback was caused by a new image that never confirmed via
`wolfBoot_success()` (`WOLFBOOT_FAILURE_PHASE_ROLLBACK`).

On the disk boot path every slot that is refused is recorded with
`WOLFBOOT_FAILURE_PHASE_BOOT` (or `WOLFBOOT_FAILURE_PHASE_ROLLBACK` for a slot
that did not confirm its last boot), `partition` set to the slot (0 A, 1 B,
2 golden) and `fw_version` to the version its header declares. When no slot
boots, a final `WOLFBOOT_FAILURE_PHASE_RECOVERY` record repeats the last cause
and slot. The newest record is printed on the console at the next boot. A
failure detected before the disk is opened (a HAL policy check in `hal_init()`)
can only be recorded in a flash store, not in a disk partition.

For verification failures, the cause distinguishes a bad header
(`WOLFBOOT_FAILURE_CAUSE_HEADER`), a failed integrity/hash check
(`WOLFBOOT_FAILURE_CAUSE_HASH`) and a failed signature/authenticity check
(`WOLFBOOT_FAILURE_CAUSE_SIGNATURE`). A rollback uses
`WOLFBOOT_FAILURE_CAUSE_NOT_CONFIRMED`.
`WOLFBOOT_FAILURE_CAUSE_NOT_CONFIRMED`. The disk boot path also reports an
image that could not be decrypted (`WOLFBOOT_FAILURE_CAUSE_DECRYPT`) and one
refused for its version (`WOLFBOOT_FAILURE_CAUSE_VERSION`) or that could not be read from the disk
(`WOLFBOOT_FAILURE_CAUSE_READ`), and a HAL that
refuses a device whose security state does not meet the build's policy uses
`WOLFBOOT_FAILURE_CAUSE_POLICY` (ZynqMP `ZYNQMP_SEC_POLICY`).

The application can read the records, ordered newest-first, through this API:

Expand All @@ -133,7 +165,14 @@ The application can read the records, ordered newest-first, through this API:
The read functions only read the region and have no external dependency.
`wolfBoot_clear_failures()`, however, erases flash, so an application that calls
it must have the HAL flash driver (`hal_flash_unlock`, `hal_flash_erase`,
`hal_flash_lock`) similarly to `wolfBoot_success()`.
`hal_flash_lock`) similarly to `wolfBoot_success()`. With
`WOLFBOOT_DIAGNOSTICS_DISK_PART` the API is built into wolfBoot only; an OS
reads the partition directly, where the layout is the same as in flash: sectors
of `WOLFBOOT_SECTOR_SIZE` bytes, each starting with a header (magic
`0x47414944`, generation, format version, CRC32) in a slot of
`WOLFBOOT_DIAGNOSTICS_RECORD_SIZE` bytes, followed by records in
`struct wolfBoot_failure_record` layout at the same stride, in the target's
byte order.

Each `struct wolfBoot_failure_record` reports `phase`, `cause`, `partition`,
`fw_version` (the version of the offending image, when known) and a monotonic
Expand Down
Loading
Loading