Skip to content

Harden fwTPM key derivation and command validation - #596

Merged
dgarske merged 8 commits into
wolfSSL:masterfrom
aidangarske:fwtpm-fixes-12728
Sep 10, 2026
Merged

Harden fwTPM key derivation and command validation#596
dgarske merged 8 commits into
wolfSSL:masterfrom
aidangarske:fwtpm-fixes-12728

Conversation

@aidangarske

Copy link
Copy Markdown
Member
F-12728, F-11915, F-12711, F-12737, F-13450, F-13451, F-13462, F-13537

@aidangarske aidangarske self-assigned this Sep 9, 2026
Copilot AI lite review requested due to automatic review settings September 9, 2026 00:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 in FwWrapPrivate, and safer RSA CRT cleanup on init failures).
  • Tightens command behavior (PCR bank capability output reflects allocated banks; invalid hierarchy selectors return TPM_RC_VALUE vs TPM_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.

Comment thread src/fwtpm/fwtpm_crypto.c
Comment thread src/fwtpm/fwtpm_crypto.c
Comment thread wolftpm/fwtpm/fwtpm_crypto.h
Comment thread wolftpm/fwtpm/fwtpm_crypto.h
@aidangarske
aidangarske marked this pull request as ready for review September 9, 2026 16:27
Comment thread src/fwtpm/fwtpm_crypto.c Outdated
@dgarske
dgarske merged commit 08595ac into wolfSSL:master Sep 10, 2026
218 checks passed
@aidangarske
aidangarske deleted the fwtpm-fixes-12728 branch September 10, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants