Repository navigation
Add firmware update support for the Infineon SLB9670, SLI9670 and SLM9670 - #684
Conversation
fcfa22a to
b0cb83d
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
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
78430a6 to
3535939
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
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
Fenrir's latest completed scan found no issues; clearing the prior automated change request.
3535939 to
b72ba89
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
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
b72ba89 to
4c2c5d2
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
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
Fenrir's latest completed scan found no issues; clearing the prior automated change request.
aidangarske
left a comment
There was a problem hiding this comment.
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
4c2c5d2 to
0967870
Compare
There was a problem hiding this comment.
🔵 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
aidangarske
left a comment
There was a problem hiding this comment.
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
0967870 to
ab87ef2
Compare
Description
Adds firmware update for the Infineon SLB9670, SLI9670 and SLM9670 (all built with
--enable-infineon=slb9670) through the existingwolfTPM2_FirmwareUpgradeAPI and theifx_fw_updateexample. 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 forWOLFTPM_SLB9670, keepsWOLFTPM_FIRMWARE_UPGRADEenabled for this partwolftpm/tpm2_types.h-WOLFTPM_V12, set by the Infineon macro above, enables TPM 1.2 framed command supportsrc/tpm12.c,wolftpm/tpm12.h- new module for TPM 1.2 framed commands (tag 0x00C1):TPM12_SendCommandsrc/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 sotpm12.ccan use themsrc/tpm2_wrap.c- the update flow:TPM2_FieldUpgradeStartVendorwith 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 completesrc/tpm2_wrap.c-wolfTPM2_InitreturnsTPM_RC_UPGRADEwhen the boot loader is active, so an interrupted update can be resumed, andwolfTPM2_GetCapabilitiesfillsfwCounterexamples/firmware/ifx_fw_extract.c- splits an SLB9670.BINinto 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 filesrc/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 apartexamples/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 partexamples/firmware/README.md- reduced to a file list that links todocs/firmware-update.md, which already carried the same text and is now the single copytests/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 TPMexamples/firmware/ifx_fw_extract_test.py- runsifx_fw_extractagainst synthetic images of both layouts (make -C examples/firmware check)slb9670job runs the information parser test, buildsifx_fw_extractand runs its image tests; newslb9670-nowrapperbuild job; the user transport job runs the stub tests for slb9670, slb9672 and slb9673Testing
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_Initreported asTPM_RC_UPGRADEafter a reset; running the same image again resumed and completed it. A--enable-smallstackbuild 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.