Skip to content

Align more fwTPM response codes with the reference and persist public-only objects in v1.85 builds - #686

Merged
aidangarske merged 9 commits into
wolfSSL:masterfrom
dgarske:fwtpm_refmatch2
Nov 30, 2026
Merged

aidangarske merged 9 commits into
wolfSSL:masterfrom
dgarske:fwtpm_refmatch2

Conversation

@dgarske

@dgarske dgarske commented Nov 30, 2026

Copy link
Copy Markdown
Member

Description

A second pass over fwTPM behavior that differed from the TPM 2.0 reference implementation, after #685. One commit per difference. Each was checked against the reference simulator.

Response codes:

  • A handle that is not of the type the command takes returns TPM_RC_VALUE with the handle number. This covers the hierarchy, provision, clear, lockout and PCR handles of TPM2_EvictControl, TPM2_Clear, TPM2_ClearControl, TPM2_ChangeEPS, TPM2_ChangePPS, TPM2_HierarchyControl, TPM2_HierarchyChangeAuth, TPM2_SetPrimaryPolicy, TPM2_CreatePrimary, TPM2_ClockSet, the dictionary attack commands, the PCR commands and the NV define and undefine commands.
  • TPM2_Create, TPM2_CreateLoaded and TPM2_CreatePrimary report the parameter number for an object attribute error.
  • TPM2_PolicySigned checks cpHashA and the signature scheme before the signature, and refuses a null or non-signing sigAlg in a trial session too.
  • A policy command whose cpHashA differs from the digest already held by the session returns TPM_RC_CPHASH, whichever command recorded it.

Behavior:

  • TPM2_CreatePrimary accepts sensitive data together with sensitiveDataOrigin for a key and takes the data into the derivation.
  • TPM2_DictionaryAttackParameters keeps the failed tries counter.
  • TPM2_EvictControl persists an object loaded with only its public area in a --enable-v185 build, as Part 3 version 185 allows. Other builds still refuse it. A policy session on such a persistent object returns TPM_RC_AUTH_UNAVAILABLE.

Compatibility:

  • A caller that matches the bare TPM_RC_HIERARCHY, TPM_RC_AUTH_TYPE, TPM_RC_VALUE or TPM_RC_ATTRIBUTES codes for these cases must mask the handle or parameter bits.
  • A caller that relied on TPM2_DictionaryAttackParameters to clear the counter needs TPM2_DictionaryAttackLockReset.
  • No existing primary key changes, and the NV journal format is unchanged.

Resolves F-16137

@dgarske
dgarske requested a review from aidangarske November 30, 2026 22:28
@dgarske dgarske self-assigned this Nov 30, 2026
@dgarske dgarske assigned aidangarske and wolfSSL-Bot and unassigned dgarske Nov 30, 2026

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

Scan targets checked: wolftpm-src, wolftpm-bugs
Not reviewed (no scan target covers them): docs/fwtpm/overview.md
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: Max

@aidangarske
aidangarske merged commit f7c2b6a into wolfSSL:master Nov 30, 2026
265 checks passed
@aidangarske
aidangarske deleted the fwtpm_refmatch2 branch November 30, 2026 23:23
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