-
Notifications
You must be signed in to change notification settings - Fork 76
wolfSPDM migration to wolfTPM/spdm with Nuvoton and spdm-emu support #458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aidangarske
wants to merge
1
commit into
wolfSSL:master
Choose a base branch
from
aidangarske:add-full-spdm-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| name: SPDM Emulator Integration Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ 'master', 'main', 'release/**' ] | ||
| paths: [ 'spdm/**', 'src/tpm2_spdm.c', 'examples/spdm/**' ] | ||
| pull_request: | ||
| branches: [ '*' ] | ||
| paths: [ 'spdm/**', 'src/tpm2_spdm.c', 'examples/spdm/**' ] | ||
|
|
||
| jobs: | ||
| spdm-emu-test: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-22.04 | ||
| arch: x64 | ||
| - os: ubuntu-24.04 | ||
| arch: x64 | ||
| - os: ubuntu-24.04-arm | ||
| arch: aarch64 | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Checkout wolfTPM | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Cache wolfSSL | ||
| id: cache-wolfssl | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: wolfssl | ||
| key: wolfssl-spdm-${{ matrix.os }}-${{ hashFiles('.github/workflows/spdm-emu-test.yml') }} | ||
|
|
||
| - name: Build wolfSSL | ||
| if: steps.cache-wolfssl.outputs.cache-hit != 'true' | ||
| run: | | ||
| git clone --depth 1 https://github.com/wolfSSL/wolfssl.git | ||
| cd wolfssl | ||
| ./autogen.sh | ||
| ./configure --enable-wolftpm --enable-ecc --enable-sha384 --enable-aesgcm --enable-hkdf --enable-sp | ||
| make -j$(nproc) | ||
|
|
||
| - name: Install wolfSSL | ||
| run: | | ||
| cd wolfssl | ||
| sudo make install | ||
| sudo ldconfig | ||
|
|
||
| - name: Cache spdm-emu | ||
| id: cache-spdm-emu | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: spdm-emu/build/bin | ||
| key: spdm-emu-${{ matrix.os }}-${{ hashFiles('.github/workflows/spdm-emu-test.yml') }} | ||
|
|
||
| - name: Build spdm-emu | ||
| if: steps.cache-spdm-emu.outputs.cache-hit != 'true' | ||
| run: | | ||
| git clone --depth 1 --recursive https://github.com/DMTF/spdm-emu.git | ||
| cd spdm-emu | ||
| mkdir build && cd build | ||
| cmake -DARCH=${{ matrix.arch }} -DTOOLCHAIN=GCC -DTARGET=Release -DCRYPTO=mbedtls .. | ||
| make copy_sample_key | ||
| make -j$(nproc) | ||
|
|
||
| - name: Build wolfTPM with SPDM | ||
| run: | | ||
| ./autogen.sh | ||
| ./configure --enable-spdm --enable-swtpm --enable-debug | ||
| make -j$(nproc) | ||
|
|
||
| - name: Run SPDM emulator tests | ||
| run: | | ||
| export SPDM_EMU_PATH=$PWD/spdm-emu/build/bin | ||
| ./examples/spdm/spdm_test.sh --emu | ||
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| # SPDM Examples | ||
|
|
||
| This directory contains examples demonstrating SPDM (Security Protocol and Data Model) | ||
| functionality with wolfTPM. | ||
|
|
||
| ## Overview | ||
|
|
||
| The SPDM demo (`spdm_demo`) shows how to establish an SPDM secure session between | ||
| the host and a TPM using the built-in wolfSPDM library. It supports both the standard | ||
| spdm-emu emulator and Nuvoton hardware TPMs. | ||
|
|
||
| For real SPDM support on hardware TPMs, contact **[email protected]** | ||
|
|
||
| ## Example | ||
|
|
||
| ### `spdm_demo.c` - SPDM Secure Session Demo | ||
|
|
||
| **Quick test (emulator — starts/stops automatically):** | ||
|
|
||
| ```bash | ||
| ./examples/spdm/spdm_test.sh --emu | ||
| ``` | ||
|
|
||
| Runs session establishment, signed measurements, unsigned measurements, | ||
| challenge authentication, heartbeat, and key update. | ||
|
|
||
| **Quick test (Nuvoton hardware):** | ||
|
|
||
| ```bash | ||
| ./examples/spdm/spdm_test.sh --nuvoton | ||
| ``` | ||
|
|
||
| Runs connect, lock, caps-over-SPDM, unlock, and cleartext verification. | ||
|
|
||
| **Manual commands:** | ||
|
|
||
| ```bash | ||
| # Emulator (start spdm_responder_emu first, see spdm/README.md) | ||
| ./spdm_demo --emu # Session only | ||
| ./spdm_demo --meas # Session + signed measurements | ||
| ./spdm_demo --meas --no-sig # Session + unsigned measurements | ||
| ./spdm_demo --challenge # Sessionless challenge authentication | ||
| ./spdm_demo --emu --heartbeat # Session + heartbeat keep-alive | ||
| ./spdm_demo --emu --key-update # Session + key rotation | ||
|
|
||
| # Nuvoton hardware | ||
| ./spdm_demo --enable # Enable SPDM on TPM (one-time, requires reset) | ||
| ./spdm_demo --connect --status # Connect + get SPDM status | ||
| ./spdm_demo --connect --lock # Connect + lock SPDM-only mode | ||
| ./spdm_demo --connect --caps # Connect + run TPM commands over SPDM | ||
| ./spdm_demo --connect --unlock # Connect + unlock SPDM-only mode | ||
| ``` | ||
|
|
||
| ## Building | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| Build wolfSSL with the cryptographic algorithms required by SPDM: | ||
|
|
||
| ```bash | ||
| # wolfSSL (needs ECC P-384, SHA-384, AES-GCM, HKDF for SPDM) | ||
| cd wolfssl | ||
| ./autogen.sh | ||
| ./configure --enable-wolftpm --enable-ecc --enable-sha384 --enable-aesgcm --enable-hkdf --enable-sp | ||
| make && sudo make install && sudo ldconfig | ||
| ``` | ||
|
|
||
| ### wolfTPM with SPDM | ||
|
|
||
| SPDM support is built into wolfTPM (no external wolfSPDM needed): | ||
|
|
||
| ```bash | ||
| cd wolfTPM | ||
| ./autogen.sh | ||
| ./configure --enable-spdm | ||
| make | ||
| ``` | ||
|
|
||
| For Nuvoton hardware TPMs, add `--enable-nuvoton`: | ||
|
|
||
| ```bash | ||
| ./configure --enable-spdm --enable-nuvoton | ||
| make | ||
| ``` | ||
|
|
||
| ## Support | ||
|
|
||
| For production use with hardware TPMs and full SPDM protocol support, contact: | ||
|
|
||
| **[email protected]** |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # vim:ft=automake | ||
| # All paths should be given relative to the root | ||
|
|
||
| if BUILD_EXAMPLES | ||
| if BUILD_SPDM | ||
| noinst_PROGRAMS += examples/spdm/spdm_demo | ||
|
|
||
| examples_spdm_spdm_demo_SOURCES = examples/spdm/spdm_demo.c | ||
| examples_spdm_spdm_demo_LDADD = src/libwolftpm.la $(LIB_STATIC_ADD) | ||
| examples_spdm_spdm_demo_DEPENDENCIES = src/libwolftpm.la | ||
| examples_spdm_spdm_demo_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/spdm | ||
| endif | ||
| endif | ||
|
|
||
| example_spdmdir = $(exampledir)/spdm | ||
| dist_example_spdm_DATA = examples/spdm/spdm_demo.c | ||
|
|
||
| DISTCLEANFILES+= examples/spdm/.libs/spdm_demo |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.