Repository navigation
Finish the fwTPM clock, x509sign and integrity key review items - #691
Merged
Merged
Conversation
dgarske
requested review from
aidangarske and
wolfSSL-Fenrir-bot
and
a balanced review from Copilot
December 2, 2026 18:04
There was a problem hiding this comment.
🟢 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
x509signattributes inTPM2_Loadfor v1.85 builds. - Reports zero clock values without a clock HAL while preserving
ClockSetstate. - 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
left a comment
There was a problem hiding this comment.
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
approved these changes
Dec 2, 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.
Three review items from #688 that were left when it merged, and two Coverity reports. One commit per item.
TPM2_Loadrefusesx509signon an object that is not an asymmetric signing key, asTPM2_LoadExternalandTPM2_Importalready do, per the Load row of Part 2 section 8.3.3.15. The error isTPM_RC_ATTRIBUTESfor parameter 2. v1.85 builds only.*keySzto the size of its buffer before callingget_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.TPMS_CLOCK_INFO.clockis reported as zero inTPM2_ReadClock, the attestation commands and theTPM2_PolicyCounterTimeroperand, with safe NO, per Part 2 section 10.10.5.TPM2_ClockSetis still accepted and stored.Compatibility:
get_integrity_keytreats*keySzas output only is unaffected. One that expects zero on entry would now see 32; none was found in the tree or in wolftpm-examples.TPM2_ClockSetto 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