Harden fwTPM key derivation and command validation - #596
Merged
Conversation
aidangarske
commented
Sep 9, 2026
Member
There was a problem hiding this comment.
🟡 Changes recommended
The new RNG parameters are used without defined NULL-handling in hardened ECC paths and the public header prototype changes are API-breaking without an explicit compatibility/versioning plan.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR hardens fwTPM cryptographic operations and command validation paths, primarily by adding RNG-backed blinding to ECC operations and tightening command behavior around PCR capability reporting, hierarchy selection, and physical presence.
Changes:
- Plumbs
WC_RNG*into ECC primary key derivation and ECC shared-point computation to enable RNG-backed timing/blinding hardening where supported. - Improves safety/robustness in crypto helpers (OOM handling in
FwComputePublicName, guarded sensitive marshaling inFwWrapPrivate, and safer RSA CRT cleanup on init failures). - Tightens command behavior (PCR bank capability output reflects allocated banks; invalid hierarchy selectors return
TPM_RC_VALUEvsTPM_RC_HIERARCHY; platform PP latch disabled unless explicitly opted-in).
File summaries
| File | Description |
|---|---|
| wolftpm/fwtpm/fwtpm_crypto.h | Updates public prototypes to accept WC_RNG* for ECC derivation/shared-point routines. |
| src/fwtpm/fwtpm_crypto.c | Implements RNG-backed ECC hardening and improves error/cleanup handling in several crypto helpers. |
| src/fwtpm/fwtpm_command.c | Updates PCR capability response generation, refines hierarchy-handle validation, and gates platform PP latch behind an opt-in macro. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
aidangarske
force-pushed
the
fwtpm-fixes-12728
branch
from
September 9, 2026 16:18
f4d7685 to
2e42bf7
Compare
aidangarske
marked this pull request as ready for review
September 9, 2026 16:27
dgarske
requested changes
Sep 9, 2026
aidangarske
force-pushed
the
fwtpm-fixes-12728
branch
from
September 9, 2026 20:06
2e42bf7 to
1721aa6
Compare
dgarske
approved these changes
Sep 9, 2026
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.