Skip to content

Harden fwTPM command processing - #629

Merged
dgarske merged 57 commits into
wolfSSL:masterfrom
aidangarske:fenrir-fixes-14018-15838
Oct 16, 2026
Merged

dgarske merged 57 commits into
wolfSSL:masterfrom
aidangarske:fenrir-fixes-14018-15838

Conversation

@aidangarske

Copy link
Copy Markdown
Member

F-14018 - e04783c - Clear now commits replacement hierarchy seeds only after every random-number operation succeeds.

F-14020 - 8acf000 - A failed GlobalWriteLock operation now restores the previous lock state.

F-14021 - 7a450ab - Session parameter encryption and decryption failures are now returned to the caller.

F-14022 - fac7d24 - Small-stack allocation failures now retain their original error instead of continuing with invalid state.

F-14025 - 7a23828 - NV_SetBits now rejects command packets that end before the complete input is available.

F-14069 - b20df11 - NV counter, bit-field, and extend indices now require their TPM-defined data sizes.

F-14075 - b9af6bc - Policy command parsing now validates every sized buffer before reading it.

F-14407 - 8e2c941 - NV WRITE_STCLEAR access remains available until the startup-clear transition defined by the TPM state model.

F-14408 - 5dc6ce9 - PolicySigned now validates the nonce input before hashing or signature verification.

F-14409 - 49a1f68 - PolicySigned now rejects authorization handles that do not resolve to a supported entity.

F-14410 - 4af79b4 - Clear no longer erases PCR values that the TPM specification requires it to preserve.

F-14411 - a29ecfc - Clear now resets all TPM state owned by the command while preserving state outside its scope.

F-14412 - d32a80b - Startup and shutdown now track orderly state transitions correctly.

F-14413 - d7fe971 - ContextLoad now rejects restored sessions whose handle is already active.

F-14414 - 83eed37 - Keyed-hash objects now use their configured HMAC scheme instead of silently substituting another scheme.

F-14415 - 19e5735 - Event sequences now calculate and return digests for every allocated PCR bank.

F-14416 - ea20697 - RSA OAEP operations now preserve and use the caller-provided label.

F-14417 - ea2f8bc - Loaded objects now retain their authorization value.

F-14432 - b3ad443 - Policy commands now reject expiration forms the fwTPM does not implement.

F-14682 - bfbc47b - FlushContext now releases saved session state associated with the flushed handle.

F-14683 - c8d50ce - Failed NV counter persistence no longer exposes a counter value below the established high-water mark.

F-14685 - aaa3e58 - EvictControl validates an object before copying it into persistent storage.

F-14696 - 3dfb466 - CertifyCreation now requires and validates a matching creation ticket.

F-14697 - e9f0021 - Imported objects can no longer claim fixedTPM or fixedParent attributes.

F-14698 - 76ff8fd - Unsupported PIN-pass and PIN-fail NV index types are now rejected.

F-15704 - 88701cb - Bound entity authorization is no longer included twice when deriving a session HMAC key.

F-15705 - 8edab65 - PCR_Read now bounds the number of digest values written to its response list.

F-15706 - 4d86e8d - PCR event commands now extend only PCR banks that are currently allocated.

F-15707 - 2d59a2b - Dictionary-attack parameters are now checked against supported numeric limits.

F-15708 - 77e8bf6 - NV_Extend now returns hash initialization, update, and finalization failures.

F-15814 - 0142cf7 - StartAuthSession now rejects caller nonces that exceed the destination buffer.

F-15815 - 81a1654 - Session symmetric algorithm, key-size, and mode combinations are now validated before use.

F-15816 - 1c7daa5 - Salted session setup now normalizes cryptographic failures to the appropriate TPM error.

F-15817 - ece9620 - HMAC operations now validate that the selected key has a compatible type and scheme.

F-15818 - ff73e1d - Restricted keyed-hash objects can no longer be used for unsupported HMAC sequences.

F-15819 - 1997401 - Symmetric commands now reject cipher modes the fwTPM does not support.

F-15820 - 270dc16 - Symmetric encrypt and decrypt commands now enforce their required key and mode constraints.

F-15821 - 126ff80 - GetCapability now bounds TPM property groups and advances paginated property queries correctly.

F-15822 - 9f89069 - Command capability responses now report the correct NV usage attribute.

F-15823 - ba5b2d9 - Startup now resets platform authorization when required by the TPM state model.

F-15824 - 71c27e1 - Every Startup transition now flushes transient objects and sessions.

F-15825 - 17e8662 - ClockSet now applies the correct upper bound to the requested clock value.

F-15826 - 1a6c500 - Provisioning commands now return the correct handle error for invalid hierarchy handles.

F-15827 - 507f687 - Hash tickets are now checked against the hierarchy that generated them.

F-15828 - 2d3a6c1 - A sequence remains available when completion fails before consuming it.

F-15829 - eb94e14 - Context management commands now reject unsupported authorization sessions.

F-15830 - 8094860 - Invalid command handles now return the correctly indexed TPM handle-reference error.

F-15831 - 6ccac13 - Capability queries that require initialized state are now rejected before Startup.

F-15832 - e064db5 - PolicySigned and PolicyTicket now enforce expiration semantics, validate ticket fields, and prevent ticket replay across Clear.

F-15833 - 47b9a72 - PolicyLocality now rejects locality bits outside the TPM-defined range.

F-15834 - 20d55c2 - PolicyCommandCode now rejects commands unavailable in the current fwTPM build.

F-15836 - f483ae2 - Object creation now rejects contradictory or unsupported attribute combinations.

F-15837 - 8d20d56 - Attestation metadata is now obfuscated with the correct hierarchy proof and context-integrity hash.

F-15838 - 294ee40 - StirRandom now rejects input larger than the TPM-defined maximum.

F-15835 - 8b61c8b - PCR selection parsing now validates the selection count and every sizeofSelect value.

@aidangarske aidangarske self-assigned this Oct 14, 2026
@aidangarske
aidangarske force-pushed the fenrir-fixes-14018-15838 branch 4 times, most recently from a7500fa to 5ac415a Compare October 14, 2026 21:49

@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 #629

Scan targets checked: wolftpm-src, wolftpm-bugs
Coverage: 4 of 8 in-scope changed file(s) opened by the reviewer; not opened: examples/bench/bench.c, tests/fwtpm_unit_tests.c, wolftpm/fwtpm/fwtpm.h, wolftpm/fwtpm/fwtpm_nv.h

Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Review tier: Lite

Comment thread src/fwtpm/fwtpm_command.c Outdated
Comment thread src/fwtpm/fwtpm_command.c Outdated

@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 #629

Scan targets checked: wolftpm-src, wolftpm-bugs
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Review tier: Lite

Comment thread src/fwtpm/fwtpm_command.c

@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 #629

Scan targets checked: wolftpm-src, wolftpm-bugs
Not reviewed (no scan target covers them): docs/fwtpm/overview.md, wrapper/rust/wolftpm/src/key.rs
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer

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: Lite

@wolfSSL-Fenrir-bot
wolfSSL-Fenrir-bot dismissed stale reviews from themself October 15, 2026 16:26

Fenrir's latest completed scan found no issues; clearing the prior automated change request.

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lots of great work here, just needs some cleanups.

Comment thread src/fwtpm/fwtpm.c
Comment thread src/fwtpm/fwtpm_command.c Outdated
Comment thread src/fwtpm/fwtpm_command.c Outdated
Comment thread src/fwtpm/fwtpm_command.c Outdated
Comment thread src/fwtpm/fwtpm_command.c Outdated
@aidangarske
aidangarske force-pushed the fenrir-fixes-14018-15838 branch from 1d25ebf to 22f74aa Compare October 16, 2026 16:57
@aidangarske
aidangarske requested a review from dgarske October 16, 2026 17:19

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also please make sure we have a small stack sanitizer build in CI. Specifically the WOLFSSL_SMALL_STACK (--enable-smallstack) not just our wolfTPM small stack.

Comment thread src/fwtpm/fwtpm_command.c Outdated
@aidangarske
aidangarske force-pushed the fenrir-fixes-14018-15838 branch 4 times, most recently from 7c6617c to 0eab1a7 Compare October 16, 2026 19:13
dgarske
dgarske previously approved these changes Oct 16, 2026
@dgarske dgarske self-assigned this Oct 16, 2026
@dgarske
dgarske merged commit d59adcd into wolfSSL:master Oct 16, 2026
234 checks passed
@aidangarske
aidangarske deleted the fenrir-fixes-14018-15838 branch October 16, 2026 21:53
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.

3 participants