Skip to content

Add an application-supplied TPM command transport - #680

Merged
dgarske merged 1 commit into
wolfSSL:masterfrom
aidangarske:user-transport-cb
Nov 25, 2026
Merged

dgarske merged 1 commit into
wolfSSL:masterfrom
aidangarske:user-transport-cb

Conversation

@aidangarske

@aidangarske aidangarske commented Nov 24, 2026 •

Copy link
Copy Markdown
Member
  • wolfTPM had no supported way for an application to carry TPM commands over its own channel, so integrators replaced internal functions such as TPM2_SWTPM_SendCommand and the TIS hooks.
  • New --enable-usertransport (CMake WOLFTPM_INTERFACE=USER) routes every command through the IO callback the application already passes to wolfTPM2_Init or TPM2_Init.
  • In that build TPM2HalIoCb takes one whole command and returns its response, the same way WOLFTPM_ADV_IO swaps the callback signature. There is no new registration API and no global state; the callback and its context live in ctx->ioCb and ctx->userCtx, and TPM2_SetHalIoCb replaces them.
  • The response length is checked against the TPM header size, the buffer size and the length the response header declares.
  • The TIS layer is compiled out, TPM2_ChipStartup returns NOT_COMPILED_IN, and TPM2_Init_ex rejects a NULL callback or a positive timeoutTries. TPM2_TIS_ValidateRspSz stays available.
  • configure and CMake reject it with devtpm, pikeos, swtpm, optee, the Windows TBS API, spi, i2c, mmio, advio, the fwTPM TIS transport or spdm. wolfTPM2_New returns NULL in this build since it cannot take a callback.
  • No existing API changes; the new code builds only with the new option.
  • tests/user_transport_unit_tests.c covers init arguments, framing and each bad-response check, TPM_RC_RETRY resend, per-context callbacks, TPM2_SetHalIoCb, and wolfTPM2_Init/wolfTPM2_Test. CI builds the library, examples and tests under the option, runs make check, and checks that conflicting options are rejected.

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

Scan targets checked: wolftpm-src, wolftpm-bugs
Not reviewed (no scan target covers them): .github/workflows/cmake-build.yml, .github/workflows/user-transport-build.yml, CMakeLists.txt, configure.ac, docs/build-options.md, docs/system-interfaces.md, hal/tpm_io.h, tests/include.am
Coverage: 7 of 7 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: Max

Comment thread tests/user_transport_unit_tests.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 #680

Scan targets checked: wolftpm-src, wolftpm-bugs
Not reviewed (no scan target covers them): .github/workflows/cmake-build.yml, .github/workflows/user-transport-build.yml, CMakeLists.txt, configure.ac, docs/build-options.md, docs/system-interfaces.md, hal/tpm_io.h, tests/include.am
Coverage: 0 of 1 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 24, 2026 19:59

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

@aidangarske
aidangarske requested a review from dgarske November 24, 2026 20:14
Comment thread configure.ac Resolved
@dgarske
dgarske merged commit 899abf1 into wolfSSL:master Nov 25, 2026
254 checks passed
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