Skip to content

Add firmware update support for the Infineon SLB9670, SLI9670 and SLM9670 - #684

Merged
aidangarske merged 1 commit into
wolfSSL:masterfrom
dgarske:slb9670_fwupdate
Dec 1, 2026
Merged

aidangarske merged 1 commit into
wolfSSL:masterfrom
dgarske:slb9670_fwupdate

Conversation

@dgarske

@dgarske dgarske commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Description

Adds firmware update for the Infineon SLB9670, SLI9670 and SLM9670 (all built with --enable-infineon=slb9670) through the existing wolfTPM2_FirmwareUpgrade API and the ifx_fw_update example. The SLB9670 starts an update with a TPM 2.0 vendor command and then switches to a boot loader that accepts only TPM 1.2 framed commands.

What it adds

  • wolftpm/tpm2_types.h - WOLFTPM_IFX_FW_UPGRADE_TPM12, set for WOLFTPM_SLB9670, keeps WOLFTPM_FIRMWARE_UPGRADE enabled for this part
  • wolftpm/tpm2_types.h - WOLFTPM_V12, set by the Infineon macro above, enables TPM 1.2 framed command support
  • src/tpm12.c, wolftpm/tpm12.h - new module for TPM 1.2 framed commands (tag 0x00C1): TPM12_SendCommand
  • src/tpm2.c, wolftpm/tpm2.h - TPM2_IFX_FieldUpgradeStart12, TPM2_IFX_FieldUpgradeCommand12 (TPM_FieldUpgrade, ordinal 0xAA, with its checksum byte) and the field upgrade information parser, beside the existing Infineon commands; the lock and packet send helpers become library-local so tpm12.c can use them
  • src/tpm2_wrap.c - the update flow: TPM2_FieldUpgradeStartVendor with the signed policy parameter block under a platform policy session, then data blocks at the size the TPM reports, or smaller when the command buffer is smaller (--enable-smallstack), then complete
  • src/tpm2_wrap.c - wolfTPM2_Init returns TPM_RC_UPGRADE when the boot loader is active, so an interrupted update can be resumed, and wolfTPM2_GetCapabilities fills fwCounter
  • examples/firmware/ifx_fw_extract.c - splits an SLB9670 .BIN into the manifest (policy parameter block) and data files and checks the image CRC; an SLI9670 or SLM9670 image names its part, which is written after the block in the manifest file
  • src/tpm2_wrap.c - a part name in the manifest must match the TPM vendor string or the update is refused before the start command; a part that reports SLI9670 or SLM9670 only takes an image that names it, since the TPM itself does not tell the two images apart
  • examples/firmware/ifx_fw_update.c - builds for the SLB9670 and resumes when the TPM is found in the boot loader; no longer built with --disable-wrapper, where it failed to compile for every Infineon part
  • examples/firmware/README.md - reduced to a file list that links to docs/firmware-update.md, which already carried the same text and is now the single copy
  • Docs, ChangeLog, build lists (autotools, CMake, Visual Studio) and unit tests for the command's argument checks and the information parser
  • tests/user_transport_unit_tests.c - stub Infineon parts on the application-supplied transport run the SLB9670 flow (start, data, complete, resume from the boot loader, refused start, part name check) and the SLB9672/SLB9673 flow (start, manifest, data, finalize, recover, cancel) with no TPM
  • examples/firmware/ifx_fw_extract_test.py - runs ifx_fw_extract against synthetic images of both layouts (make -C examples/firmware check)
  • CI - the slb9670 job runs the information parser test, builds ifx_fw_extract and runs its image tests; new slb9670-nowrapper build job; the user transport job runs the stub tests for slb9670, slb9672 and slb9673

Testing

Validated on three SLB9670 parts on a Raspberry Pi 4 over spidev: firmware 7.83.3358.0 updated to 7.85.4555.0 and 7.85.4555.0 to 7.87.19691.2, with the new version and a decremented update counter read back after a reset. An image for a different source version and an image with a corrupted signature were both rejected by the TPM without using an update.

An update stopped part way through the data left the TPM in the boot loader, which wolfTPM2_Init reported as TPM_RC_UPGRADE after a reset; running the same image again resumed and completed it. A --enable-smallstack build completed an update with 1010 byte data blocks.

An SLM9670 image was refused by the library on the SLB9670 before the start command. No SLI9670 or SLM9670 part was available, so those two follow the datasheet and are not hardware tested.

@dgarske dgarske self-assigned this 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 #684

Scan targets checked: wolftpm-src, wolftpm-bugs
Not reviewed (no scan target covers them): CMakeLists.txt, ChangeLog.md, IDE/VisualStudio/wolftpm.vcxproj, docs/build-options.md, docs/firmware-update.md, docs/ja/build-options.md, docs/ja/firmware-update.md, docs/ja/project-structure.md, docs/ja/supported-hardware.md, docs/ja/tpm2-overview.md, docs/project-structure.md, docs/supported-hardware.md, docs/tpm2-overview.md, examples/firmware/README.md, src/include.am, wolftpm/include.am
Coverage: 9 of 10 in-scope changed file(s) opened by the reviewer; not opened: wolftpm/tpm12.h

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

Comment thread src/tpm2_wrap.c Resolved
@dgarske
dgarske force-pushed the slb9670_fwupdate branch 2 times, most recently from 78430a6 to 3535939 Compare November 30, 2026 21:00

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

Scan targets checked: wolftpm-src, wolftpm-bugs
Not reviewed (no scan target covers them): .github/workflows/make-test-swtpm.yml, .github/workflows/user-transport-build.yml, CMakeLists.txt, ChangeLog.md, IDE/VisualStudio/wolftpm.vcxproj, docs/build-options.md, docs/firmware-update.md, docs/ja/build-options.md, docs/ja/firmware-update.md, docs/ja/project-structure.md, docs/ja/supported-hardware.md, docs/ja/tpm2-overview.md, docs/project-structure.md, docs/supported-hardware.md, docs/tpm2-overview.md, examples/firmware/README.md, src/include.am, wolftpm/include.am
Coverage: 3 of 5 in-scope changed file(s) opened by the reviewer; not opened: tests/user_transport_unit_tests.c, wolftpm/tpm2_wrap.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: Lite

@wolfSSL-Fenrir-bot
wolfSSL-Fenrir-bot dismissed their stale review November 30, 2026 21:09

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

@dgarske dgarske changed the title Add firmware update support for the Infineon SLB9670 Add firmware update support for the Infineon SLB9670, SLI9670 and SLM9670 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 #684

Scan targets checked: wolftpm-src, wolftpm-bugs
Not reviewed (no scan target covers them): .github/workflows/make-test-swtpm.yml, .github/workflows/user-transport-build.yml, CMakeLists.txt, ChangeLog.md, IDE/VisualStudio/wolftpm.vcxproj, docs/build-options.md, docs/firmware-update.md, docs/ja/build-options.md, docs/ja/firmware-update.md, docs/ja/project-structure.md, docs/ja/supported-hardware.md, docs/ja/tpm2-overview.md, docs/project-structure.md, docs/supported-hardware.md, docs/tpm2-overview.md, examples/firmware/README.md, src/include.am, wolftpm/include.am
Coverage: 2 of 3 in-scope changed file(s) opened by the reviewer; not opened: tests/user_transport_unit_tests.c

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/tpm2_wrap.c Resolved

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

Scan targets checked: wolftpm-src, wolftpm-bugs
Not reviewed (no scan target covers them): .github/workflows/make-test-swtpm.yml, .github/workflows/user-transport-build.yml, CMakeLists.txt, ChangeLog.md, IDE/VisualStudio/wolftpm.vcxproj, docs/build-options.md, docs/firmware-update.md, docs/ja/build-options.md, docs/ja/firmware-update.md, docs/ja/project-structure.md, docs/ja/supported-hardware.md, docs/ja/tpm2-overview.md, docs/project-structure.md, docs/supported-hardware.md, docs/tpm2-overview.md, examples/firmware/README.md, src/include.am, wolftpm/include.am
Coverage: 1 of 2 in-scope changed file(s) opened by the reviewer; not opened: tests/user_transport_unit_tests.c

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 their stale review November 30, 2026 23:09

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

@aidangarske aidangarske 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.

Skoll Code Review

Scan type: review

Overall recommendation: REQUEST_CHANGES
Findings: 5 total — 5 posted, 0 skipped
5 finding(s) posted as inline comments (see file-level comments below)

Posted findings

  • [High] Bound public TPM 1.2 payloads before packet arithmetic — src/tpm12.c:46-54
  • [High] Reject responses missing the mandatory length field — src/tpm2.c:7303-7320
  • [High] Require model metadata on SLI9670 and SLM9670 updates — src/tpm2_wrap.c:13071-13090
  • [Medium] Exercise the new firmware image parser — examples/firmware/ifx_fw_extract.c:154-310
  • [Medium] Do not list untested parts as tested hardware — docs/supported-hardware.md:34

Review generated by Skoll

Comment thread src/tpm12.c Resolved
Comment thread src/tpm2.c Resolved
Comment thread src/tpm2_wrap.c Resolved
Comment thread examples/firmware/ifx_fw_extract.c Resolved
Comment thread docs/supported-hardware.md Resolved
Copilot AI balanced review requested due to automatic review settings December 1, 2026 01:24

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.

🔵 Needs a closer look

Maintainer review is needed because SLI9670/SLM9670 firmware updates lack hardware validation, and unconfirmed model-identification, bootloader, and retry-counter assumptions could permanently block the TPM.

No open issues 🎉

What changed in this PR

Extends wolfTPM’s existing firmware-update APIs and examples to support Infineon SLB9670, SLI9670 and SLM9670 devices, including recovery from interrupted updates.

Changes:

  • Adds TPM 1.2 command framing for boot-loader updates, bounded firmware chunks and model-name validation.
  • Extends firmware extraction with the older image layout, model metadata and CRC validation.
  • Adds parser, simulated-transport and extraction tests; updates build integration, CI and documentation.
File Description
wolftpm/​tpm2.h Declares Infineon update commands, information structures and shared internal helpers.
wolftpm/​tpm2_wrap.h Extends capabilities and documents the new update flow.
wolftpm/​tpm2_types.h Enables firmware-update and TPM 1.2 support for SLB9670 builds.
wolftpm/​tpm12.h Defines the TPM 1.2 command interface.
wolftpm/​include.am Adds the TPM 1.2 header to installed headers.
tests/​user_transport_unit_tests.c Adds simulated Infineon update, recovery and rejection tests.
tests/​unit_tests.c Adds argument-validation and update-information parser tests.
src/​tpm2.c Implements Infineon commands and update-information parsing.
src/​tpm2_wrap.c Implements update sequencing, boot-loader recovery and model checks.
src/​tpm12.c Implements TPM 1.2 framed command dispatch.
src/​include.am Includes the TPM 1.2 module in Autotools builds.
IDE/​VisualStudio/​wolftpm.vcxproj Includes the new module and header in Visual Studio builds.
examples/​firmware/​README.md Replaces duplicated guidance with a file index and manual links.
examples/​firmware/​Makefile Adds an extraction-test target.
examples/​firmware/​include.am Includes extraction tests in source distributions.
examples/​firmware/​ifx_fw_update.c Enables SLB9670 updates and boot-loader recovery; guards wrapper-disabled builds.
examples/​firmware/​ifx_fw_extract.c Extracts policy-block images, preserves model names and validates CRCs.
examples/​firmware/​ifx_fw_extract_test.py Tests extraction using synthetic valid and malformed images.
docs/​tpm2-overview.md Points firmware guidance to the consolidated manual.
docs/​supported-hardware.md Documents update support and additional Infineon models.
docs/​project-structure.md Lists the TPM 1.2 command module.
docs/​ja/​tpm2-overview.md Updates the Japanese firmware-guide reference.
docs/​ja/​supported-hardware.md Documents the additional hardware support in Japanese.
docs/​ja/​project-structure.md Lists the new module in the Japanese project overview.
docs/​ja/​firmware-update.md Adds Japanese update instructions and recovery cautions.
docs/​ja/​build-options.md Expands the documented firmware-update device list.
docs/​firmware-update.md Documents extraction, model checks, recovery and device limits.
docs/​build-options.md Documents firmware support and shared Infineon build selection.
CMakeLists.txt Includes the TPM 1.2 module in CMake builds.
ChangeLog.md Records the new firmware-update support.
.github/​workflows/​user-transport-build.yml Runs simulated update tests for three Infineon configurations.
.github/​workflows/​make-test-swtpm.yml Adds hardware-free SLB9670 checks and a wrapper-disabled build.

Review effort: Balanced

@dgarske
dgarske requested a review from aidangarske December 1, 2026 15:20
@dgarske dgarske assigned wolfSSL-Bot and aidangarske and unassigned dgarske Dec 1, 2026

@aidangarske aidangarske 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.

Skoll Code Review

Scan type: review

Overall recommendation: COMMENT
Findings: 1 total — 1 posted, 0 skipped
1 finding(s) posted as inline comments (see file-level comments below)

Posted findings

  • [Medium] Return the required response size on BUFFER_E — src/tpm2.c:7317-7328

Review generated by Skoll

Comment thread src/tpm2.c Resolved
@aidangarske
aidangarske merged commit a4efb93 into wolfSSL:master Dec 1, 2026
263 checks passed
@aidangarske
aidangarske deleted the slb9670_fwupdate branch December 1, 2026 21:25
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.

5 participants