wolfTPM SPDM support (Nuvoton NPCT75x and NSING NS350)#458
Open
aidangarske wants to merge 5 commits intowolfSSL:masterfrom
Open
wolfTPM SPDM support (Nuvoton NPCT75x and NSING NS350)#458aidangarske wants to merge 5 commits intowolfSSL:masterfrom
aidangarske wants to merge 5 commits intowolfSSL:masterfrom
Conversation
dgarske
requested changes
Feb 20, 2026
dgarske
requested changes
Feb 24, 2026
b684e06 to
e56719c
Compare
f43ecbb to
57c6e83
Compare
57c6e83 to
d58702e
Compare
- 18/18 emulator tests PASS (6 tests x 3 versions: 1.2, 1.3, 1.4) 1. Removed OpaqueDataLength(2) from CHALLENGE request for SPDM 1.3+ — spec says only RequesterContext(8), no OpaqueDataLength in request 2. Removed OpaqueDataLength(2) from signed GET_MEASUREMENTS request for SPDM 1.3+ — same issue - spdm/README.md: Added supported versions table (spdm-emu: 1.2/1.3/1.4, Nuvoton: 1.3), updated protocol flow diagram, added --ver flag to demo options, added wolfSPDM_SetMaxVersion() to API table, updated emulator section to mention 18-test multi-version coverage - Addressed PR review feedback
… lines)
Security fixes:
- Mandatory responder signature verification in KEY_EXCHANGE_RSP (was conditional skip)
- Sensitive stack buffer zeroing (wc_ForceZero) in BuildFinish, ParseKeyExchangeRsp,
wolfSPDM_Finish for keys, HMAC, and signature data
- TCG integer underflow guard in ParseTcgClearMessage (msgSize < header check)
- BuildIV: removed dead code duplicate branches, collapsed to single 8-byte XOR path
Code quality:
- Cascade error handling (rc == WOLFSPDM_SUCCESS pattern) across spdm_msg.c,
spdm_session.c, spdm_secured.c for single-cleanup-path safety
- wolfSPDM_BuildVendorDefined: added spdmVersion parameter (was hardcoded 0x13)
- spdm_error.h: added spdm_types.h include for standalone WOLFSPDM_API definition
- spdm.h: added stack usage documentation (~22KB context, ~20KB call chain)
Codebase reduction (-4,301 net lines):
- Condensed spdm_demo.c (382->256 lines), spdm_test.sh (143->70 lines)
- Removed verbose banner comments and redundant section headers across all files
- Consolidated unit tests with shared helpers, removed duplicate test patterns
- Removed spdm-emu-test.yml CI workflow (moved to standalone wolfSPDM repo)
- Streamlined README documentation
Test results:
- 26/26 unit tests PASS
- 6/6 Nuvoton hardware tests PASS (spdm_test.sh)
- Nations NS350 PSK mode: PSK_SET, PSK_CLEAR, PSK_EXCHANGE, PSK_FINISH,
GET_STATUS, SPDM_ONLY with 32-byte ClearAuth per TCG PC Client spec
- Salt_0 = 0xFF for PSK mode HKDF-Extract (vs 0x00 for identity key mode)
- NATIONS_PSK mode checks in spdm_secured.c encrypt/decrypt paths
- GET_STATUS response parsing fix (PSKSet byte was not being read)
- Demo cleanup order: TPM2_Shutdown before SPDM disconnect
- 32-byte ClearAuth enforcement on PSK_SET and PSK_CLEAR
- spdm_test.sh nations-psk: 12-step PSK lifecycle test with NSING reference data
- spdm/README.md: TCG commands section, Nations PSK docs, validation status
- Removed unused inline PSK_SET, SetPskSetPayload, ConnectNationsPskProvision
- SPDM 1.3+ OpaqueDataLength fix for CHALLENGE and GET_MEASUREMENTS requests
Tested: 10/10 Nations PSK tests PASS, 6/6 Nuvoton tests PASS
59b592b to
a5c2ffa
Compare
- Ct hash changed from SHA-384(X||Y) to SHA-384(TPMT_PUBLIC) for both
responder (KEY_EXCHANGE) and requester (FINISH mutual auth), matching
Vision's updated firmware and Nuvoton's implementation
- wolfSSL requires --enable-ecccustcurves=all for Nations (HAVE_ECC_CDH)
- spdm_test.sh: use run_test_no_reset for Nations (GPIO 4 not wired to
TPM_RST on NS350 daughter board, requires full power cycle)
- spdm_test.sh nations: full lifecycle (unset, set, connect, status, caps)
- spdm/README.md: separate wolfSSL build sections for Nuvoton vs Nations,
removed status columns from command tables, updated troubleshooting for
NS350 power cycle requirement
- CLAUDE.md: updated build instructions with correct minimal flags
Tested: 5/5 Nations identity key tests PASS, 12/12 Nations PSK tests PAS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Migrates the standalone wolfSPDM library into wolfTPM as an in-tree spdm/
subdirectory and adds full SPDM support for both Nuvoton NPCT75x and
Nations NS350 TPMs. Eliminates the external dependency a single
--enable-spdm configure flag builds everything.
wolfSPDM Library (spdm/)
GET_STS_, TPM2_CMD, PSK_SET_, PSK_CLR_)
GET_PUBK, KEY_EXCHANGE, GIVE_PUB, FINISH
PSK_EXCHANGE, PSK_FINISH
Nuvoton NPCT75x Support
Nations NS350 Support
PSK Mode
Identity Key Mode
wolfTPM Integration
automatically encrypted when SPDM session is active
SPDM Demo (examples/spdm/)
TCG SPDM Vendor Commands
Test Plan