Repository navigation
Align fwTPM command behavior and return codes with the TPM 2.0 reference - #677
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
A key-lookup failure after journal writes can invalidate persisted state and lose seeds and NV data on restart, while ECC Import also incorrectly converts allocation failures from TPM_RC_MEMORY to TPM_RC_FAILURE.
2 open issues
What changed in this PR
This PR aligns wolfTPM’s firmware TPM behavior with the TPM 2.0 reference, improving interoperability, persistence, and sensitive-data handling.
Changes:
- Updates cryptographic validation, signing checks, and duplication formats, including seedValue and Qualified Name preservation.
- Hardens NV integrity-key failure handling and clears command and TIS buffers after use.
- Adds TIS regression tests and clarifies HAL security and compatibility documentation.
| File | Description |
|---|---|
| wolftpm/fwtpm/fwtpm.h | Extends object state, sensitive-buffer capacity, and allocation-failure hooks. |
| wolftpm/fwtpm/fwtpm_tis.h | Corrects FIFO sizing and register-layout comments. |
| wolftpm/fwtpm/fwtpm_nv.h | Clarifies NV buffer, clock, and error documentation. |
| wolftpm/fwtpm/fwtpm_crypto.h | Updates interfaces for seed handling and cryptographic validation. |
| tests/fwtpm_hal_unit_tests.c | Tests FIFO wiping and locality isolation. |
| src/fwtpm/ports/optee/README.md | Documents storage requirements for rollback protection. |
| src/fwtpm/fwtpm_tis.c | Wipes command and response FIFOs during lifecycle transitions. |
| src/fwtpm/fwtpm_tis_shm.c | Clears shared-memory FIFOs during cleanup. |
| src/fwtpm/fwtpm_nv.c | Persists additional object fields and hardens journal handling. |
| src/fwtpm/fwtpm_io.c | Clears command buffers after dispatch and receive failures. |
| src/fwtpm/fwtpm_crypto.c | Implements seed-aware wrapping, ECC validation, and signing checks. |
| docs/fwtpm/hal-and-porting.md | Documents failure behavior for integrity-key callbacks. |
Review effort: Balanced
aidangarske
requested changes
Nov 23, 2026
aidangarske
left a comment
Member
There was a problem hiding this comment.
Skoll Code Review
Scan type: review
Overall recommendation: REQUEST_CHANGES
Findings: 2 total — 2 posted, 0 skipped
2 finding(s) posted as inline comments (see file-level comments below)
Posted findings
- [High] Global write lock can partially commit when a later NV save fails —
src/fwtpm/fwtpm_command.c:18703-18716 - [High] Zero-length KEYEDHASH sensitive data is mistaken for a public-only object —
src/fwtpm/fwtpm_command.c:24254-24263
Review generated by Skoll
dgarske
force-pushed
the
fenrir_fwtpm
branch
from
November 23, 2026 23:04
75f71b3 to
5f4ad42
Compare
aidangarske
reviewed
Nov 24, 2026
…WNERREAD or OWNERWRITE
…as no command code
…or parameter encryption
…past TPMS_TIME_INFO
…NV and PolicyAuthorizeNV
…er a successful init
dgarske
force-pushed
the
fenrir_fwtpm
branch
from
November 24, 2026 23:57
5f4ad42 to
e596618
Compare
aidangarske
approved these changes
Nov 25, 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.


This PR brings the firmware TPM (fwTPM) in line with the TPM 2.0 Library specification code and with the behavior of discrete TPMs. One commit per finding. Key changes:
uniqueof a KEYEDHASH or SYMCIPHER object is computed from it, so the reference can import fwTPM duplicates.Compatibility:
uniquenow includes the seedValue. Key material, children and persistent copies are unaffected.get_integrity_keycallback that fails now failsFWTPM_Init().Testing: unit tests were added for each behavior change and for existing untested paths. Session, policy and trial-session behavior was confirmed on Infineon SLB9670 and SLB9678 TPMs. Duplication in both directions, Qualified Name and null-signer attestation were cross-checked against the reference simulator with tpm2-tools, and private blobs, persistent objects and duplicates written by the previous build were confirmed to load.
Scope: fwTPM private blobs keep the fwTPM wrap format rather than the reference's seedValue-keyed protection, so Duplicate and Import remain the only cross-TPM path.
Resolves F-15792, F-16097, F-16102, F-16103, F-16105, F-16108, F-16124, F-16125, F-16126, F-16130, F-16131, F-16132, F-16134, F-16135, F-16136, F-16137, F-16182, F-16183, F-16184, F-16185, F-16186, F-16187, F-16188, F-16200, F-16201, F-16202, F-16203, F-16204, F-16205, F-16206, F-16207, F-16209, F-16210, F-16211, F-16219, F-16222, F-16224, F-16225, F-16226, F-16227, F-16228, F-16229, F-16230, F-16231, F-16233, F-16235, F-16236, F-16239, F-16241, F-16816, F-16834, F-16835, F-16836, F-16837, F-16838, F-16840, F-16846, F-17126, F-17150, F-17151, F-17152, F-17155, F-17156, F-17157, F-18002, F-18062, F-18066, F-18067, F-18068, F-18069, F-18070, F-18071, F-18072, F-18073, F-18075, F-18076, F-18077