You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add key revocation, a security version floor and FIPS image encryption on AArch64 - #1011
This PR adds signing-key revocation and an anti-rollback security version, and makes FIPS builds work with AES image encryption on AArch64:
Signing-key revocation through a signed HDR_KEY_REVOKE mask, applied only once the revoking image is confirmed (KEY_REVOCATION=1).
A security version floor, independent of the image version, enforced on flash, RAM and disk boot paths (SECURITY_VERSION=1).
ZynqMP storage of both in user eFuses, report-only unless ZYNQMP_EFUSE_BURN=1.
WOLFBOOT_PRODUCTION=1 build guard that refuses options which weaken verification, including ALLOW_DOWNGRADE and DUALBOOT_ROLLBACK_UNCONFIRMED.
FIPS on AArch64:
The module's ARMv8 assembly (AES, SHA-2, SHA-3, SP ECC) linked inside the module boundary; 32-bit ARM keeps the portable-C module.
P-256 kept in FIPS builds because the module's ECDHE self-test is fixed to it.
FIPS=1 with ENCRYPT_WITH_AES128/256 allowed; ZynqMP seeds the DRBG from the module's jitter entropy source and bounds the newlib heap.
ECC384 stack limit raised for AArch64 SP math (GCC 13 needs 11232 bytes).
ZynqMP boot policy (wolfBoot as BL33):
The eFuse security state (SEC_CTRL, PUF, PPK0 hash) read through the PMU firmware, and a required SEC_CTRL mask (ZYNQMP_SEC_POLICY) that stops the boot under WOLFBOOT_PRODUCTION=1 and warns otherwise; the state goes to /chosen as wolfboot,sec-ctrl and wolfboot,sec-policy.
Split out: TPM NV storage (#1027, stacked on this PR), disk-path failure records and boot times (#1026), and the disk decrypt return-code checks (#1025).
Testing
Simulator scripts for key revocation and the security version, run by a new workflow (development and production builds).
Unit tests for the BL33 eFuse read and the user-eFuse counter.
A ZynqMP FIPS + AES build job.
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 policy gate: a development build warns and boots, a production build stops, and the policy state reads from Linux. The bench PMU firmware does not return SEC_CTRL, so only the not-met path ran.
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.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved critical issues can bypass revocation and rollback protections, corrupt boot data through diagnostics writes, and drop required production security policy during configuration regeneration.
Defer updates until confirmed policy storage succeeds
src/image.c:3482
Policy application only prints backend write errors, so this returns success even when the confirmed image's mask/floor was not persisted. With an update already staged, the boot paths then verify it against the old policy and can replace the last carrier of the confirmed policy permanently. Propagate storage failures and defer the pending update until the policy is durable, rather than treating a failed commit as complete.
Route rollback records through diagnostics bounds checks
src/update_disk.c:613
This direct store call bypasses disk_diag_off, so reaping a TESTING slot still writes even when logging was disabled because its region overlaps a boot-state trailer. Initializing or rotating the log can then overwrite boot-confirmation state. Route this event through disk_record_failure() so rollback records respect the same bounds check as other failures.
Commit confirmed-image policy before checking self-updates
src/update_flash.c:2307
With RAM_CODE enabled, wolfBoot_check_self_update() can install a bootloader before this confirmed-image policy commit runs. A bootloader update signed by a newly revoked key, or below the newly confirmed security version, is therefore checked against the old policy. Commit the verified confirmed image's policy before checking self-updates as well as ordinary firmware updates.
Preserve ZYNQMP security policy and prerequisite in CONFIG_VARS
tools/config.mk:150
Please preserve ZYNQMP_SEC_POLICY and its ZYNQMP_SEC prerequisite in CONFIG_VARS too. config/Makefile deletes .config and rewrites only this list, so running make config drops the required eFuse mask while retaining the newly listed WOLFBOOT_PRODUCTION=1. The next production build merely warns and no longer enforces the device security policy.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Monolithic self-updates can replace the confirmed application before pending security policy is committed and inherit BOOT’s SUCCESS trailer, applying replacement policy before confirmation.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical flaws allow unconfirmed images with missing trailers to boot before pending revocations or security-version floors are applied, while revocation-store read failures can silently bypass pending revocations.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved critical issues cause duplicate-definition errors in FIPS self-header builds and allow production compiler flags to disable boot verification or permit downgrades.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
BL33 burn-path regression coverage is missing, leaving irreversible PMU writes, row and bit selection, zero-bit no-ops, and both error-status words untested.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A critical issue under EXT_FLASH=1 NO_XIP=1 misinterprets the disk loader’s RAM-resident header as an external-flash offset, rejecting valid disk slots and requiring a fix with regression coverage.
`WOLFBOOT_PRODUCTION=1` makes these options build errors, whether set as make variables or passed as `-D` flags: `SIGN=NONE`, `WOLFBOOT_SKIP_BOOT_VERIFY=1`, `ALLOW_DOWNGRADE=1`, `DUALBOOT_ROLLBACK_UNCONFIRMED=1`, `WOLFBOOT_UDS_UID_FALLBACK_FORTEST=1` and `DEBUG_CSU` (JTAG on ZynqMP).
The reason will be displayed to describe this comment to others. Learn more.
I think we should list both the Makefile variables as well as the corresponding wolfBoot defines here, since I'm pretty sure they aren't all the same (e.g. SIGN).
Also, this is a pretty important list for users to grok, so recommend bulleted list, one per line. I think "these options" reads weird, I'd prefer "the following options". Something like the following, but with both env variables and macros highlighted
Suggested change
`WOLFBOOT_PRODUCTION=1` makes these options build errors, whether set as make variables or passed as `-D` flags: `SIGN=NONE`, `WOLFBOOT_SKIP_BOOT_VERIFY=1`, `ALLOW_DOWNGRADE=1`, `DUALBOOT_ROLLBACK_UNCONFIRMED=1`, `WOLFBOOT_UDS_UID_FALLBACK_FORTEST=1` and `DEBUG_CSU` (JTAG on ZynqMP).
`WOLFBOOT_PRODUCTION=1` makes the following options build errors, whether set as make variables or passed as `-D` flags:
The reason will be displayed to describe this comment to others. Learn more.
Done in 8984102 with "the following options", one per line. I used a two-column table (make variable, define) rather than bullets so both names sit side by side. DEBUG_CSU is define-only.
- **POST entry.** The module registers its POST via a C constructor (`.init_array`), which a hosted runtime runs before `main()`. wolfBoot's bare-metal startup does not run `.init_array`, so build with `NO_ATTRIBUTE_CONSTRUCTOR` and call `fipsEntry()` explicitly (`src/loader.c`).
- **Normal (cacheable) memory.** wolfBoot's simple startup runs with the MMU off, where all memory is Device-nGnRnE and unaligned / 128-bit SIMD accesses fault (the FIPS module and newlib `printf`/`snprintf` do both). The CM4 HAL enables a minimal identity MMU with DDR mapped Normal cacheable before the POST (`cm4_mmu_enable`), and tears it down (clean D-cache, disable MMU/caches) before the boot handoff (`cm4_mmu_disable`) so the loaded image is coherent and the application starts MMU-off.
- **libc.** The module uses malloc/printf; stub the newlib syscalls (`--specs=nosys.specs`) and provide a bounded `_sbrk` so the heap cannot grow into the unverified image (the CM4 HAL allocates from a fixed static buffer in `hal/rpi_common.c`).
- **libc.** The module uses malloc/printf; stub the newlib syscalls (`--specs=nosys.specs`, the default on cm4, cm5 and zynq via `FIPS_NOSYS_SPECS`) and provide a bounded `_sbrk` so the heap cannot grow into the unverified image (`hal/rpi_common.c`, `hal/zynq.c`). Use a bare-metal toolchain (`aarch64-none-elf-`); with a glibc cross compiler the module's `printf` does not link to anything at run time.
The reason will be displayed to describe this comment to others. Learn more.
Yes, for cm4/cm5 (hal/rpi_common.c) and zynq (hal/zynq.c). Reworded in 8984102: wolfBoot provides it on those targets, and a new bare-metal FIPS target needs its own.
The reason will be displayed to describe this comment to others. Learn more.
Recommend changing the name, as wolfBoot already has a "hooks" feature, and this will cause confusion since it has nothing to do with that. Maybe something like WOLFBOOT_CONFIRMED_IMAGE_POLICY or WOLFBOOT_COMMIT_CONFIRMED (which matches the other macros you build off of it)?
The reason will be displayed to describe this comment to others. Learn more.
This feels janky for a "first class feature". IMO custom TLVs should be for users to implement their own custom extensions, but I think official features should not need to take advantage of them. Thoughts on just adding support to the sign tool?
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Added --security-version <n> and --revoke-keys <mask> to the sign tool in 8984102. They write the 4-byte signed TLVs, take a value up to 32 bits, and refuse a second TLV with the same tag (option given twice, or alongside --custom-tlv). Documented in Signing.md; unit-sign-policy-tlv.py checks the bytes and the refusals, and the simulator scripts use the options (only the malformed-length cases still use --custom-tlv).
The reason will be displayed to describe this comment to others. Learn more.
Nothing wrong in this file, but elsewhere I think we need the same check for disk boot without DISK_BOOT_CONFIRM and for RAM boot without partition trailers? In those cases, images never get marked confirmed so I think that means the floor and the revocation mask would never be written but also never print anything or warn the user? Maybe theres some way we could make this a runtime error too?
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Made it a build error in 8984102 rather than a runtime one, since the build already knows: update_disk.c refuses KEY_REVOCATION/SECURITY_VERSION without DISK_BOOT_CONFIRM, and update_ram.c refuses them without partition trailers (WOLFBOOT_FIXED_PARTITIONS or CUSTOM_PARTITION_TRAILER). Documented in firmware_update.md and keystore.md.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A permitted partition configuration skips the pre-commit pass, allowing a newer unconfirmed image to boot without enforcing pending security floors or revocations.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Irreversible ZynqMP eFuse writes and FIPS boundary changes require specialist validation because fuse testing was report-only, a policy-met device was not exercised, and the exact FIPS bundle was unavailable for inspection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds signing-key revocation and an anti-rollback security version, and makes FIPS builds work with AES image encryption on AArch64:
HDR_KEY_REVOKEmask, applied only once the revoking image is confirmed (KEY_REVOCATION=1).SECURITY_VERSION=1).ZYNQMP_EFUSE_BURN=1.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 (wolfBoot as BL33):
ZYNQMP_SEC_POLICY) that stops the boot underWOLFBOOT_PRODUCTION=1and warns otherwise; the state goes to/chosenaswolfboot,sec-ctrlandwolfboot,sec-policy.Split out: TPM NV storage (#1027, stacked on this PR), disk-path failure records and boot times (#1026), and the disk decrypt return-code checks (#1025).
Testing
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 policy gate: a development build warns and boots, a production build stops, and the policy state reads from Linux. The bench PMU firmware does not return SEC_CTRL, so only the not-met path ran.