Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The flash policy hook directly dereferences an external-flash offset, risking faults or incorrect reads, and disk-policy failure paths can panic before clearing sensitive encryption buffers.
2 open issues
What changed in this PR
Adds TPM NV storage for wolfBoot’s key-revocation mask and security-version floor, building on #1011.
Changes:
- Stores monotonic policy values in TPM NV and locks the platform hierarchy before handoff.
- Applies policy from confirmed images while excluding x86 stage 1.
- Adds tooling, tests, and documentation, alongside stacked ZynqMP and FIPS changes.
| File | Description |
|---|---|
| tools/unit-tests/unit-zynqmp-sec-bl33.c | Tests PMU security-state reads. |
| tools/unit-tests/unit-zynqmp-efuse-counter.c | Tests eFuse counter encoding. |
| tools/unit-tests/unit-update-ram.c | Tests RAM policy-call ordering. |
| tools/unit-tests/unit-update-disk-confirm.c | Tests disk policy commits. |
| tools/unit-tests/Makefile | Registers new unit tests. |
| tools/tpm/policy_nv.c | Adds policy inspection/reset tool. |
| tools/tpm/Makefile | Builds the policy tool. |
| tools/scripts/sim-security-version.sh | Tests security-version enforcement. |
| tools/scripts/sim-key-revocation.sh | Tests signing-key revocation. |
| tools/scripts/sim-common.sh | Shares simulator policy helpers. |
| tools/config.mk | Preserves new configuration options. |
| stage1/Makefile | Disables policy for stage 2 verification. |
| src/update_ram.c | Integrates policy commits and TPM teardown. |
| src/update_flash.c | Commits confirmed-image policy. |
| src/update_disk.c | Integrates policy commits and TPM teardown. |
| src/tpm.c | Locks policy storage before cleanup. |
| src/tpm_policy_nv.c | Implements TPM NV policy storage. |
| src/image.c | Enforces and commits signed policy. |
| src/boot_state.c | Makes policy-lock failures fatal. |
| options.mk | Adds policy guards and FIPS configuration. |
| include/wolfboot/wolfboot.h | Defines policy headers and failure cause. |
| include/user_settings.h | Updates FIPS crypto settings. |
| include/tpm.h | Declares policy indices and locking API. |
| include/image.h | Declares confirmed-image policy hooks. |
| include/hal.h | Defines policy storage interfaces. |
| hal/zynq.h | Exposes security-state APIs for BL33. |
| hal/zynq.c | Adds eFuse policy and FIPS support. |
| hal/sim.c | Adds file-backed policy storage. |
| docs/TPM.md | Documents TPM policy configuration. |
| docs/Targets.md | Documents ZynqMP security policy. |
| docs/keystore.md | Explains revocation and TPM storage. |
| docs/firmware_update.md | Explains security-version enforcement. |
| docs/FIPS.md | Documents AArch64 assembly and encryption. |
| docs/compile.md | Documents production build guards. |
| docs/API.md | Documents policy failure reporting. |
| config/examples/nai_68int6.config | Adds commented TPM policy options. |
| arch.mk | Configures ZynqMP eFuse policy. |
| .gitignore | Ignores new generated artifacts. |
| .github/workflows/test-units.yml | Extends unit-test timeout. |
| .github/workflows/test-key-revocation-simulator.yml | Adds simulator and TPM policy coverage. |
| .github/workflows/test-configs.yml | Adds ZynqMP FIPS/AES build coverage. |
Review effort: Balanced
93010f7 to
b15b516
Compare
b15b516 to
f4b4ad2
Compare
f4b4ad2 to
a9a5939
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The secure-mode flash handoff skips the TPM hierarchy lock, leaving empty platform authorization enabled and allowing code with TPM access to delete policy indices and reset their values.
1 open issue
2 resolved since last review
Review effort: Balanced
f5729d8 to
875255a
Compare
875255a to
18c0277
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Irreversible policy writes, TPM boot handoffs, and FIPS boundary changes require hardware/security-owner review, with validation gaps in production locking and eFuse burning.
No open issues 🎉
2 resolved since last review
Review effort: Balanced
18c0277 to
2c8a919
Compare
2c8a919 to
9b40039
Compare


Description
Depends on #1011: this branch is stacked on it, and only the last commit is new.
Adds a TPM NV backend for
KEY_REVOCATIONandSECURITY_VERSIONon anyWOLFTPM=1target (WOLFBOOT_TPM_POLICY_NV=1):TPM_NT_BITSindices written only withTPM2_NV_SetBits, so the TPM itself keeps them from going back.tools/tpm/policy_nvreads, clears or replaces the indices for testing.Testing
tpm-nvCI job, adding a foreign-index case and the 64-level limit.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.