Skip to content

Select ST33 field upgrade commands from the TPM command set - #586

Open
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:st33_fu_ordinal
Open

Select ST33 field upgrade commands from the TPM command set#586
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:st33_fu_ordinal

Conversation

@dgarske

@dgarske dgarske commented Aug 27, 2026

Copy link
Copy Markdown
Member

Summary

ST33 supports two different field-upgrade command code pairs, and wolfTPM always sent the ST33KTPM vendor pair (0x2000030C/0x2000030D) - which some ST33 parts do not implement, so the upgrade failed at the very first command with TPM_RC_COMMAND_CODE. wolfTPM now asks the TPM which pair it implements and uses that, falling back to the standard codes (0x0000012F/0x00000141) for generation-2 images, and otherwise leaving the previous behavior unchanged.

ZD 22193

@dgarske dgarske self-assigned this Aug 27, 2026
Copilot AI lite review requested due to automatic review settings August 27, 2026 20:12

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.

Pull request overview

This PR improves ST33 firmware upgrade compatibility by selecting the correct FieldUpgradeStart/Data command-code pair per device, avoiding immediate TPM_RC_COMMAND_CODE failures on ST33 parts that don’t implement the previously hard-coded vendor ordinals.

Changes:

  • Add a capability-based probe (TPM_CAP_COMMANDS) to choose between standard TCG FieldUpgradeStart/Data and ST33KTPM vendor ordinals, with a version-based fallback heuristic.
  • Expose helpers to parse the target firmware version from the ST33 manifest header and to compute fallback upgrade ordinals.
  • Extend ST33 firmware tooling/tests/docs to cover new part families/lines and the ordinal selection behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
wolftpm/tpm2.h Documents ST33 vendor ordinals and adds an _ex start API variant taking a caller-supplied command code.
wolftpm/tpm2_wrap.h Adds wrapper/test APIs for manifest version parsing and fallback ST33 firmware-upgrade ordinal selection.
src/tpm2.c Makes ST33 FieldUpgradeStart accept a supplied command code and improves vendor RC string classification for format-zero codes.
src/tpm2_wrap.c Implements ST33 manifest-version parsing, command-set probing via TPM_CAP_COMMANDS, and safer manifest-size/family handling.
tests/unit_tests.c Adds unit tests for manifest-version parsing and ordinal selection rules.
examples/firmware/st33_fw_update.c Updates the ST33 update tool to probe command support, print diagnostics, and use selected ordinals (including retry logic on resume).
examples/firmware/st33_blob0.h Refactors manifest-size selection to be family-based and explicitly handle unknown families.
examples/firmware/st33_blob0.c Implements family detection and avoids asserting a manifest size when the family is unknown.
examples/firmware/README.md Documents part identification and field-upgrade ordinal selection behavior.
README.md Adds a new ST33TPHF2XSPI firmware-line example and notes vendor-string behavior on ST33TPHF2X.
hal/tpm_io_linux.c Allows overriding I2C defaults (TPM2_I2C_*) at build time for board-specific setups.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/tpm2_wrap.c Outdated
Comment thread examples/firmware/st33_fw_update.c Outdated
Comment thread examples/firmware/README.md Outdated
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.

2 participants