wolfBoot hardening: PCI BAR restore, DICE zeroization, FIT bounds, and CT-compare fixes#823
Open
aidangarske wants to merge 5 commits into
Open
wolfBoot hardening: PCI BAR restore, DICE zeroization, FIT bounds, and CT-compare fixes#823aidangarske wants to merge 5 commits into
aidangarske wants to merge 5 commits into
Conversation
aidangarske
commented
Jul 10, 2026
Member
Contributor
There was a problem hiding this comment.
Pull request overview
Hardening-focused update across wolfBoot’s PCI enumeration, FIT image loading, DICE handling, and constant-time verification logic, with new unit tests to prevent regressions in key failure paths.
Changes:
- Fix PCI 64-bit BAR failure cleanup to restore both BAR dwords (and add coverage for the non-“too much memory” failure path).
- Add bounds enforcement for uncompressed FIT subimages copied into a caller-provided buffer (plus a regression unit test).
- Reduce sensitive-data exposure risk via DICE digest/hash zeroization and a more optimization-resistant constant-time compare accumulator.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tools/unit-tests/unit-pci.c | Adds a unit test ensuring 64-bit BAR upper dword is restored on a non-“too much memory” failure path. |
| tools/unit-tests/unit-fit-gzip.c | Adds a unit test verifying oversized uncompressed (“none”) FIT subimages are rejected when exceeding out_max. |
| src/pci.c | Restores 64-bit BAR high dword via unified restore_bar: path to avoid leaving probe masks behind. |
| src/fdt.c | Enforces out_max bound for uncompressed payload memcpy to prevent overflow; improves failure behavior. |
| src/dice/dice.c | Zeroizes hash contexts and derived digests after UEID derivation to reduce sensitive-data lifetime. |
| src/wolfhsm_flash_hal.c | Uses a volatile accumulator in constant-time compare to reduce risk of compiler “helpfulness” altering behavior. |
| options.mk | Emits a build-time warning when WOLFBOOT_SKIP_BOOT_VERIFY=1 is enabled, clarifying security impact. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.