Skip to content

Finish the fwTPM clock, x509sign and integrity key review items - #691

Merged
aidangarske merged 4 commits into
wolfSSL:masterfrom
dgarske:fwtpm_review_followup
Dec 2, 2026
Merged

aidangarske merged 4 commits into
wolfSSL:masterfrom
dgarske:fwtpm_review_followup

Conversation

@dgarske

@dgarske dgarske commented Dec 2, 2026

Copy link
Copy Markdown
Member

Three review items from #688 that were left when it merged, and two Coverity reports. One commit per item.

  • TPM2_Load refuses x509sign on an object that is not an asymmetric signing key, as TPM2_LoadExternal and TPM2_Import already do, per the Load row of Part 2 section 8.3.3.15. The error is TPM_RC_ATTRIBUTES for parameter 2. v1.85 builds only.
  • The NV journal sets *keySz to the size of its buffer before calling get_integrity_key, so a HAL can refuse a key that does not fit. The signature is unchanged and a HAL that ignores the value behaves as before. The in-tree OP-TEE port checks it.
  • With no clock HAL registered, TPMS_CLOCK_INFO.clock is reported as zero in TPM2_ReadClock, the attestation commands and the TPM2_PolicyCounterTimer operand, with safe NO, per Part 2 section 10.10.5. TPM2_ClockSet is still accepted and stored.
  • Coverity: the fwTPM NV test helpers bound each journal record size by the buffer before using it.

Compatibility:

  • A HAL whose get_integrity_key treats *keySz as output only is unaffected. One that expects zero on entry would now see 32; none was found in the tree or in wolftpm-examples.
  • An integration with no clock HAL that relied on TPM2_ClockSet to make a nonzero Clock visible now sees zero until a clock HAL is registered. Every in-tree and wolftpm-examples port registers one.

Testing

New and extended fwTPM unit tests cover the Load check, a HAL that honours the key size and one that holds a longer key, and the zero clock in all three paths; each failed before its change.

Resolves F-16240, F-16839, F-18946

@dgarske dgarske self-assigned this Dec 2, 2026
@dgarske
dgarske requested review from aidangarske and wolfSSL-Fenrir-bot and a balanced review from Copilot December 2, 2026 18:04

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.

🟢 Approval recommended

No active review issues are reported for the fwTPM follow-up changes.

No open issues 🎉

What changed in this PR

Completes fwTPM follow-ups from #688, tightening object validation, clock reporting, and NV integrity-key handling.

Changes:

  • Rejects invalid x509sign attributes in TPM2_Load for v1.85 builds.
  • Reports zero clock values without a clock HAL while preserving ClockSet state.
  • Passes buffer capacity to integrity-key callbacks, adds regression tests, and bounds journal reads in test helpers.
File Description
wolftpm/​fwtpm/​fwtpm.h Documents the integrity-key callback’s input/output size contract.
tests/​optee/​fwtpm_optee_port_tests.c Tests rejection of insufficient key-buffer capacity.
tests/​fwtpm_unit_tests.c Extends validation, clock, and key-capacity tests; bounds journal helpers.
src/​fwtpm/​ports/​optee/​fwtpm_optee_nv.c Checks buffer capacity before copying the integrity key.
src/​fwtpm/​fwtpm_nv.c Supplies key-buffer capacity to the HAL callback.
src/​fwtpm/​fwtpm_command.c Adds Load attribute validation and clockless reporting behavior.
docs/​fwtpm/​hal-and-porting.md Explains updated integrity-key and clock HAL contracts.

Review effort: Balanced

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot 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.

Fenrir Automated Review — PR #691

Scan targets checked: wolftpm-src, wolftpm-bugs
Not reviewed (no scan target covers them): docs/fwtpm/hal-and-porting.md
Coverage: 5 of 6 in-scope changed file(s) opened by the reviewer; not opened: wolftpm/fwtpm/fwtpm.h

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Max

@aidangarske
aidangarske merged commit 66c8926 into wolfSSL:master Dec 2, 2026
521 of 541 checks passed
@aidangarske
aidangarske deleted the fwtpm_review_followup branch December 2, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants