Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical flaws allow unauthenticated security-policy changes, key-revocation bypasses, and irreversible fuse writes outside the permitted range.
8 open issues
Reject negative ZynqMP eFuse starting rows · New Apply confirmed-image policy in the dual-bank swap loader · New Preserve security options in CONFIG_VARS · New Reject policy TLVs located after the signed digest · New Enforce key revocation across all verification backends · New Prevent hybrid images from revoking their secondary signing key · New Commit confirmed-image policy before installing a newer trial · New Declare pmu_mmio_read before use in FSBL builds · New
What changed in this PR
This PR adds signing-key revocation and an independent security-version floor to wolfBoot’s image-verification flow, alongside AArch64 FIPS support for AES-encrypted images.
Changes:
- Adds confirmation-triggered security policies, simulator and ZynqMP storage, and production build guards.
- Enables AArch64 FIPS assembly and AES encryption, checks cipher errors, and clears cipher state before handoff.
- Adds simulator and unit coverage, a ZynqMP FIPS build job, documentation, and cached FIPS-ready downloads.
| File | Description |
|---|---|
tools/unit-tests/unit-zynqmp-efuse-counter.c |
Tests monotonic eFuse counter encoding and capacity. |
tools/unit-tests/unit-update-disk-decrypt-fail.c |
Tests decrypt failures, failover, and cipher-state clearing. |
tools/unit-tests/Makefile |
Registers new tests and counter extraction rules. |
tools/scripts/sim-security-version.sh |
Exercises security-version enforcement and confirmation. |
tools/scripts/sim-key-revocation.sh |
Exercises key revocation, fallback, and self-revocation protection. |
tools/scripts/sim-common.sh |
Shares image-signing, assembly, and boot-check helpers. |
src/update_ram.c |
Adds confirmed-image policy handling to RAM boot. |
src/update_flash.c |
Adds confirmed-image policy handling to flash boot. |
src/update_disk.c |
Adds policy handling, cipher error checks, and cleanup. |
src/libwolfboot.c |
Checks AES initialization and key-setup results. |
src/image.c |
Enforces revocation and security versions and applies confirmed policies. |
options.mk |
Adds security options, production guards, and FIPS build support. |
include/wolfboot/wolfboot.h |
Defines revocation and security-version header fields. |
include/user_settings.h |
Enables FIPS ARM64 ECC and retains P-256 self-test support. |
include/image.h |
Declares the confirmed-image policy interface and feature guards. |
include/hal.h |
Declares persistent security-policy storage interfaces. |
hal/zynq.c |
Adds user-eFuse policy storage, FIPS entropy, and bounded heap allocation. |
hal/sim.c |
Adds file-backed security-policy storage. |
docs/Targets.md |
Documents ZynqMP policy-storage allocation and programming controls. |
docs/keystore.md |
Documents signing-key revocation and rotation. |
docs/firmware_update.md |
Explains the independent security-version floor. |
docs/FIPS.md |
Documents AArch64 assembly, AES encryption, entropy, and runtime requirements. |
docs/compile.md |
Documents the production build guard. |
arch.mk |
Passes ZynqMP eFuse allocation and programming options. |
.gitignore |
Ignores generated counter-test artifacts. |
.github/workflows/test-key-revocation-simulator.yml |
Adds separate and combined simulator policy jobs. |
.github/workflows/test-configs.yml |
Adds a ZynqMP FIPS/AES-256 build configuration. |
.github/workflows/test-build.yml |
Caches the FIPS-ready archive while retaining checksum checks. |
.github/workflows/test-build-aarch64.yml |
Adds equivalent FIPS-ready caching for AArch64 builds. |
Review effort: Balanced
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1011
Scan targets checked: wolfboot-src, wolfboot-bugs
Not reviewed (no scan target covers them): .github/workflows/test-build-aarch64.yml, .github/workflows/test-build.yml, .github/workflows/test-configs.yml, .github/workflows/test-key-revocation-simulator.yml, .gitignore, arch.mk, docs/FIPS.md, docs/Targets.md, docs/compile.md, docs/firmware_update.md, docs/keystore.md, options.mk, tools/scripts/sim-common.sh, tools/scripts/sim-key-revocation.sh, tools/scripts/sim-security-version.sh, tools/unit-tests/Makefile
Coverage: 9 of 13 in-scope changed file(s) opened by the reviewer; not opened: hal/sim.c, include/hal.h, tools/unit-tests/unit-update-disk-decrypt-fail.c, tools/unit-tests/unit-zynqmp-efuse-counter.c
Findings: 6
6 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Review tier: Max
cd1700f to
a0a24f4
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1011
Scan targets checked: wolfboot-src, wolfboot-bugs
Not reviewed (no scan target covers them): .github/workflows/test-build-aarch64.yml, .github/workflows/test-build.yml, .github/workflows/test-configs.yml, .github/workflows/test-key-revocation-simulator.yml, .github/workflows/test-units.yml, .gitignore, arch.mk, config/examples/nai_68int6.config, docs/FIPS.md, docs/TPM.md, docs/Targets.md, docs/compile.md, docs/firmware_update.md, docs/keystore.md, options.mk, stage1/Makefile, tools/config.mk, tools/scripts/sim-common.sh, tools/scripts/sim-key-revocation.sh, tools/scripts/sim-security-version.sh and 2 more
Coverage: 6 of 14 in-scope changed file(s) opened by the reviewer; not opened: hal/sim.c, include/hal.h, include/image.h, include/tpm.h, src/tpm_policy_nv.c, tools/tpm/policy_nv.c, tools/unit-tests/unit-update-disk-confirm.c, tools/unit-tests/unit-update-ram.c
Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Review tier: Lite
| #if defined(WOLFBOOT_TPM_POLICY_NV) && !defined(WOLFBOOT_ANTI_ROLLBACK) && \ | ||
| !defined(ARCH_SIM) | ||
| /* With platform auth the OS could undefine the policy indices */ | ||
| if (wolfBoot_tpm_policy_nv_lock() != 0) { |
There was a problem hiding this comment.
TPM platform-hierarchy lockout for policy NV never runs on non-x86 disk-boot targets · Rollback attacks
The only WOLFBOOT_TPM_POLICY_NV lockout is wolfBoot_tpm2_deinit(). src/update_disk.c never calls it, and only the x86 do_boot does. On AArch64, RISC-V and PPC SD/eMMC targets, loader.c:169 initializes the TPM, yet the OS gets an enabled platform hierarchy with empty auth. It can then undefine the revoke/SVN indices to lift revocation and the security-version floor.
Related known findings (similar but distinct; listed for context, not part of this finding)
- F-15015: that finding is about TPM session/SRK state not being zeroized on the disk handoff. This one is the new policy NV lockout being skipped, which defeats anti-rollback and key revocation.
There was a problem hiding this comment.
Fixed in d5830da. The disk boot path now calls wolfBoot_tpm2_deinit(), and with it the platform-hierarchy lock, before hal_prepare_boot() when WOLFBOOT_TPM_POLICY_NV is set. x86 FSP targets are excluded because their do_boot() already does it. Build-checked on nxp-ls1028a-sdcard with WOLFTPM=1 and the policy options. That build also showed that src/tpm.c did not include loader.h for wolfBoot_panic(), which is fixed in the same commit.
| * wolfBoot set them up. */ | ||
| wolfBoot_hook_preboot(&os_image); | ||
| #endif | ||
| #ifdef DISK_ENCRYPT |
There was a problem hiding this comment.
Disk boot path never locks the TPM platform hierarchy before handoff when WOLFBOOT_TPM_POLICY_NV is enabled · Rollback attacks
This PR adds wolfBoot_tpm2_deinit() (which calls wolfBoot_tpm_policy_nv_lock()) before hal_prepare_boot() in update_ram.c only. update_disk.c does not call it, and only the x86 FSP do_boot locks. On non-x86 disk targets (PPC/AArch64 SD or eMMC), the OS gets platform authorization with an empty password. It can then undefine the SVN or revocation NV indices, which resets the floor and un-revokes keys.
Related known findings (similar but distinct; listed for context, not part of this finding)
- F-15015: that finding is about TPM session and device state not being scrubbed at handoff; this one is the HierarchyControl lock never being reached on the disk path, which leaves the policy NV indices open to deletion.
There was a problem hiding this comment.
Same root cause as the src/tpm.c thread, fixed in d5830da: update_disk.c now locks before handoff on non-FSP targets, matching update_ram.c and update_flash.c.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1011
Scan targets checked: wolfboot-src, wolfboot-bugs
Not reviewed (no scan target covers them): .github/workflows/test-build-aarch64.yml, .github/workflows/test-build.yml, .github/workflows/test-configs.yml, .github/workflows/test-key-revocation-simulator.yml, .github/workflows/test-units.yml, .gitignore, arch.mk, config/examples/nai_68int6.config, docs/FIPS.md, docs/TPM.md, docs/Targets.md, docs/compile.md, docs/firmware_update.md, docs/keystore.md, options.mk, stage1/Makefile, tools/config.mk, tools/scripts/sim-common.sh, tools/scripts/sim-key-revocation.sh, tools/scripts/sim-security-version.sh and 2 more
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
Fenrir's latest completed scan found no issues; clearing the prior automated change request.
…evocation backends
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1011
Scan targets checked: wolfboot-src, wolfboot-bugs
Not reviewed (no scan target covers them): .github/workflows/test-build-aarch64.yml, .github/workflows/test-build.yml, .github/workflows/test-configs.yml, .github/workflows/test-key-revocation-simulator.yml, .github/workflows/test-units.yml, .gitignore, arch.mk, config/examples/nai_68int6.config, docs/API.md, docs/FIPS.md, docs/TPM.md, docs/Targets.md, docs/compile.md, docs/firmware_update.md, docs/keystore.md, hal/zynq.h, options.mk, stage1/Makefile, tools/config.mk, tools/scripts/sim-common.sh and 4 more
Coverage: 3 of 5 in-scope changed file(s) opened by the reviewer; not opened: src/tpm_policy_nv.c, tools/unit-tests/unit-update-disk.c
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
Fenrir's latest completed scan found no issues; clearing the prior automated change request.
…y version cannot be stored
There was a problem hiding this comment.
🟡 Changes recommended
Policy-storage write failures allow trial updates to proceed against stale rollback and revocation policy, potentially permitting downgraded images or revoked keys.
3 open issues
8 resolved since last review
Preserve ZYNQMP_SEC policy variables in CONFIG_VARS Check diagnostics overlap against label-resolved boot slots Reject resettable TPM attributes for monotonic policy indices Require successful TPM policy lock before enabling OS authorization Block image replacement when security policy persistence fails Check whether either AES option is enabled, not merely set Preserve security options in CONFIG_VARS Record initial probe failures and early no-image recovery
Review effort: Balanced
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1011
Scan targets checked: wolfboot-src, wolfboot-bugs
Not reviewed (no scan target covers them): .github/workflows/test-build-aarch64.yml, .github/workflows/test-build.yml, .github/workflows/test-configs.yml, .github/workflows/test-key-revocation-simulator.yml, .github/workflows/test-units.yml, .gitignore, arch.mk, config/examples/nai_68int6.config, docs/API.md, docs/FIPS.md, docs/TPM.md, docs/Targets.md, docs/compile.md, docs/firmware_update.md, docs/keystore.md, hal/zynq.h, options.mk, stage1/Makefile, tools/config.mk, tools/scripts/sim-common.sh and 4 more
Coverage: 1 of 1 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1011
Scan targets checked: wolfboot-src, wolfboot-bugs
Not reviewed (no scan target covers them): .github/workflows/test-build-aarch64.yml, .github/workflows/test-build.yml, .github/workflows/test-configs.yml, .github/workflows/test-key-revocation-simulator.yml, .github/workflows/test-units.yml, .gitignore, arch.mk, config/examples/nai_68int6.config, docs/API.md, docs/FIPS.md, docs/TPM.md, docs/Targets.md, docs/compile.md, docs/firmware_update.md, docs/keystore.md, hal/zynq.h, options.mk, stage1/Makefile, tools/config.mk, tools/scripts/sim-common.sh and 4 more
Coverage: 1 of 2 in-scope changed file(s) opened by the reviewer; not opened: tools/unit-tests/unit-update-disk.c
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Review tier: Lite
| } | ||
| #ifdef WOLFBOOT_DISK_FS | ||
| /* A label can resolve a slot to the log's partition at run time */ | ||
| golden = BOOT_LABEL_GOLDEN; |
There was a problem hiding this comment.
Disk-FS diagnostics partition check fails to compile without DISK_GOLDEN_SLOT · Logic errors
BOOT_LABEL_GOLDEN and BOOT_PART_GOLDEN are only defined inside #ifdef DISK_GOLDEN_SLOT (lines 143-152). They are used here without that guard, so a build with DISK_FS + WOLFBOOT_PERSIST_FAILURE_STATUS + WOLFBOOT_DIAGNOSTICS_DISK_PART and no golden slot fails to compile.
Suggested fix: Put the golden/golden_part lookup under #ifdef DISK_GOLDEN_SLOT and set golden_part = -1 in the #else branch.
Basis: ISO C11 6.5.1p2: an identifier used as a primary expression must be declared, and undefined macros are not replaced outside #if expressions.
Related known findings (similar but distinct; listed for context, not part of this finding)
- Earlier finding on this pull request: (1) File/function: -4 describes the disk_diag_off guard that disk_report_last_failure() sets, and the candidate is in that same function (disk_report_last_failure, src/update_disk.c:1073). It is the closest historical match, but -4 is reported at disk_boot_state_reap() (line 611). -3 is at the file-scope build guard near line 179. (2) Faulting operation: the candidate is a compile-time use of BOOT_LABEL_GOLDEN/BOOT_PART_GOLDEN outside #ifdef DISK_GOLDEN_SLOT, so the build breaks. -4 is a runtime
There was a problem hiding this comment.
Fixed in 8b49a69: the golden lookup and its locals are now under DISK_GOLDEN_SLOT, with golden_part -1 otherwise. A new unit-update-disk-fs-diag target builds WOLFBOOT_DISK_FS + WOLFBOOT_PERSIST_FAILURE_STATUS + WOLFBOOT_DIAGNOSTICS_DISK_PART without a golden slot (it failed with exactly this error before the fix) and checks that a slot resolved to the log partition turns recording off.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1011
Scan targets checked: wolfboot-src, wolfboot-bugs
Not reviewed (no scan target covers them): .github/workflows/test-build-aarch64.yml, .github/workflows/test-build.yml, .github/workflows/test-configs.yml, .github/workflows/test-key-revocation-simulator.yml, .github/workflows/test-units.yml, .gitignore, arch.mk, config/examples/nai_68int6.config, docs/API.md, docs/FIPS.md, docs/TPM.md, docs/Targets.md, docs/compile.md, docs/firmware_update.md, docs/keystore.md, hal/zynq.h, options.mk, stage1/Makefile, tools/config.mk, tools/scripts/sim-common.sh and 4 more
Coverage: 1 of 2 in-scope changed file(s) opened by the reviewer; not opened: tools/unit-tests/unit-update-disk-fs.c
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
Fenrir's latest completed scan found no issues; clearing the prior automated change request.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1011
Scan targets checked: wolfboot-src, wolfboot-bugs
Not reviewed (no scan target covers them): .github/workflows/test-build-aarch64.yml, .github/workflows/test-build.yml, .github/workflows/test-configs.yml, .github/workflows/test-key-revocation-simulator.yml, .github/workflows/test-units.yml, .gitignore, arch.mk, config/examples/nai_68int6.config, docs/API.md, docs/FIPS.md, docs/TPM.md, docs/Targets.md, docs/compile.md, docs/firmware_update.md, docs/keystore.md, hal/zynq.h, options.mk, stage1/Makefile, tools/config.mk, tools/scripts/sim-common.sh and 4 more
Coverage: 1 of 1 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because gaps in self-update policy enforcement, revocation validation, and simulator security-state handling can bypass security protections or halt production boots.
No open issues 🎉
Review effort: Balanced


Description
This PR adds signing-key revocation and an anti-rollback security version, and makes FIPS builds work with AES image encryption on AArch64. Each item is a separate commit:
HDR_KEY_REVOKEmask, applied only once the revoking image is confirmed (KEY_REVOCATION=1).SECURITY_VERSION=1).ZYNQMP_EFUSE_BURN=1.WOLFTPM=1target (WOLFBOOT_TPM_POLICY_NV=1): bit-field indices written only withTPM2_NV_SetBits, so the TPM itself keeps them from going back, with the platform hierarchy disabled before handoff. The x86 stage 1 loader does not apply the policy to stage 2.WOLFBOOT_PRODUCTION=1build guard that refuses options which weaken verification, includingALLOW_DOWNGRADEandDUALBOOT_ROLLBACK_UNCONFIRMED.FIPS on AArch64:
FIPS=1withENCRYPT_WITH_AES128/256allowed; ZynqMP seeds the DRBG from the module's jitter entropy source and bounds the newlib heap.ZynqMP boot policy and diagnostics (wolfBoot as BL33):
ZYNQMP_SEC_POLICY) that stops the boot underWOLFBOOT_PRODUCTION=1and warns otherwise; the state goes to/chosenaswolfboot,sec-ctrlandwolfboot,sec-policy.BOOT_BENCHMARK=1) printed as one summary line and passed to the OS in/chosen/wolfboot,boot-times.WOLFBOOT_DIAGNOSTICS_DISK_PART) as well as SPI flash, with new causes for decryption, version, policy and read failures.Testing
Tests and CI:
Validated on a ZCU102 (SD boot, BL33): encrypted FIT boot with the FIPS module operational, plus wrong-key and modified-ciphertext rejection. The eFuse path ran report-only; no eFuse was burned. The same board covered the policy gate (a development build warns and boots, a production build stops), the boot times and policy state read from Linux, and a modified slot recorded in QSPI and on the SD card and printed at the next boot. The bench PMU firmware does not return SEC_CTRL, so only the not-met path ran.
Validated on an NAI 68INT6 (Tiger Lake, Infineon SLB9670 TPM, disk boot): security version and revocation committed for a confirmed image, images below the floor or signed by the revoked key refused, an index not created by wolfBoot refused, and undefine or
NV_SetBitsfrom Linux after handoff rejected by the TPM.