Skip to content

Add hardware SPDM CI runner + fix SPDM auto-connect regression#482

Merged
dgarske merged 1 commit into
wolfSSL:masterfrom
aidangarske:spdm-runners
Apr 17, 2026
Merged

Add hardware SPDM CI runner + fix SPDM auto-connect regression#482
dgarske merged 1 commit into
wolfSSL:masterfrom
aidangarske:spdm-runners

Conversation

@aidangarske
Copy link
Copy Markdown
Member

@aidangarske aidangarske commented Apr 16, 2026

Summary

Three SPDM/test bug fixes plus a new hardware-in-the-loop CI workflow that runs examples/spdm/spdm_test.sh against real TPMs on a Raspberry Pi 5 self-hosted runner.

Validated end-to-end on my fork: here (6/6 spdm_test.sh nuvoton passes on real Nuvoton NPCT75x).

Code fixes

1. src/tpm2_wrap.c - SPDM auto-connect regression
2. src/tpm2_spdm.c - ParseVendorDefined return-value mismatch
3. tests/unit_tests.c - unsupported-hash skip for non-ECC-complete TPMs

New CI workflow: .github/workflows/hw-spdm-test.yml

Runs examples/spdm/spdm_test.sh on a self-hosted Pi 5. Matrix includes both Nuvoton NPCT75x (CS0) and Nations NS350 (CS1) each entry runs a caps probe first and skips-with-::warning:: if the expected vendor isn't present, so adding Nations hardware later needs no code change.

Test plan

  • 6/6 spdm_test.sh nuvoton passes on real Pi 5 + Nuvoton NPCT75x
  • Unit tests pass cleartext on Nuvoton with --enable-nuvoton (SHA512 skip verified)
  • Fork-PR gate tested with a second account - hw-spdm job shows Skipped, confirming fork PRs cannot reach the runner
  • Existing SWTPM-based CI (make-test-swtpm.yml, cmake-build.yml, sanitizer, etc.) unchanged; green on fork PR
  • External security audit on the workflow; LOW-2 (mutable wolfSSL master) and INFO-4 (PR-writable persistent cache) addressed in this PR
  • First real run will fire on this PR's merge commit (push trigger)

Security

documented here

   - src/tpm2_wrap.c: wolfTPM2_Init auto-SPDM path now calls vendor-specific
     wolfTPM2_SpdmConnectNuvoton/Nations (which sets TIS I/O, mode, and the
     host ephemeral key pair for mutual auth). Previous refactor to the
     generic wolfTPM2_SpdmConnect dropped that setup, so FINISH failed with
     WOLFSPDM_E_PEER_ERROR whenever the TPM was in SPDM-only-locked mode.

   - src/tpm2_spdm.c: wolfSPDM_ParseVendorDefined returns payload dataLen
     (>=0) on success per spdm_tcg.c:72 convention. wolfTPM2_SPDM_SecuredExchange
     was treating any non-zero return as an error, so the first TPM command
     over SPDM (10-byte Startup response) bubbled up as rc=0xa.

   - tests/unit_tests.c: Add test_tpm_alg_supported() helper that queries
     TPM_CAP_ALGS and skip test_wolfTPM2_EccSignVerifyDig iterations when the
     hash isn't supported. Nuvoton NPCT75x lacks SHA512 and returns
     TPM_RC_SIZE parameter 1 (not TPM_RC_HASH), so the prior post-hoc skip
     couldn't catch it.

   - .github/workflows/hw-spdm-test.yml: New workflow targeting a self-hosted
     Raspberry Pi runner. Runs examples/spdm/spdm_test.sh against real Nuvoton
     hardware. Fork-PR gated. Health check soft-fails with a warning if the
     Pi is unhealthy so merging isn't blocked on a flaky runner. Nations
     matrix entry scaffolded (commented) for when the NS350 is wired.

   - scripts/hw-runner-health-check.sh: Pre-flight that verifies /dev/spidev,
     /dev/gpiochip, and gpiod are present+accessible before the build.
Copilot AI review requested due to automatic review settings April 16, 2026 23:19
@aidangarske aidangarske self-assigned this Apr 16, 2026
@dgarske dgarske self-requested a review April 16, 2026 23:24
@aidangarske aidangarske review requested due to automatic review settings April 16, 2026 23:38
@aidangarske aidangarske assigned dgarske and unassigned aidangarske Apr 17, 2026
@dgarske dgarske merged commit 35629e9 into wolfSSL:master Apr 17, 2026
81 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.

2 participants