Portable TPM 2.0 project designed for embedded use.
- TPM 2.0 API built on the TCG TPM 2.0 Library Specification, including the revision 1.85 post-quantum additions: ML-DSA (FIPS 204) and ML-KEM (FIPS 203).
- Wrappers that simplify Key Generation and Loading, RSA encrypt and decrypt, ECC sign and verify, ECDH, NV, Hashing and HMAC, AES, Sealing and Unsealing, Attestation, PCR Extend and Quote, and Secure Root of Trust.
- TPM Interface Specification (TIS) communication over SPI or a memory mapped I/O range, with I2C and LPC available through the Linux kernel driver.
- Runtime module auto-detection on Linux between the kernel TPM driver (
/dev/tpmX) and direct SPI access (--enable-autodetect). - Easy portability: native C for embedded use, a single IO callback for the hardware SPI interface, no external dependencies, and a compact code size.
- Parameter encryption using AES-CFB or XOR, salted unbound authenticated sessions, HMAC sessions, and Endorsement certificate reading (EK Credential Profile).
- A portable firmware TPM 2.0 (fwTPM / fTPM / swtpm) for platforms with no discrete TPM, post-quantum cryptography (TPM 2.0 v1.85), and SPDM attestation (see the sections below).
- Example code for the native and wrapper API's, PKCS 7, CSR, TLS client and server, NV storage, attestation, benchmarking, key generation and storage, sealing and unsealing, timestamps, PCR, GPIO, and endorsement key and certificate retrieval.
wolfTPM works with any TPM 2.0 compliant module. Tested parts:
- Infineon OPTIGA SLB9670 (SPI), SLB9672 (SPI), SLB9673 (I2C)
- STMicroelectronics ST33KTPM2XSPI, ST33KTPM2I, ST33TPHF2XSPI, ST33TPHF2XI2C
- Microchip ATTPM20
- Nuvoton NPCT650, NPCT750
- Nations Technologies / NSING Z32H330, NS350
- SealSQ QVault TPM (SPI, the first TPM with post-quantum ML-DSA and ML-KEM in silicon)
- NVIDIA Jetson Orin (Tegra234) firmware TPM, reached through the Linux kernel driver
- The wolfCrypt firmware TPM (fwTPM), for platforms with no discrete TPM chip
Platform support: Raspberry Pi (Linux), Linux /dev/tpmX, MMIO, STM32 with CubeMX,
Atmel ASF, Xilinx, QNX, Infineon TriCore, Espressif ESP-IDF, Zephyr, wolfHAL, and
Barebox. See the Supported Hardware manual
for how to build and wire each part.
wolfTPM includes a portable firmware TPM 2.0 implementation (fwtpm_server) built
entirely on wolfCrypt. It provides a standards-compliant TPM 2.0 command processor
that can replace a hardware TPM on embedded platforms without a discrete TPM chip,
or serve as a drop-in development and CI/CD replacement for external simulators
like swtpm or the Microsoft TPM simulator.
Features:
- 105 TPM 2.0 commands implemented (93% of the v1.38 spec) with wolfCrypt cryptography (RSA, ECC, SHA, AES, HMAC)
- Socket transport (Microsoft TPM simulator protocol) compatible with tpm2-tools and the wolfTPM examples
- TIS register-level transport over shared memory or SPI/I2C for bare-metal integration
- HAL abstractions for IO transport and NV storage portability
- File-based or custom NV storage via HAL callbacks
- Compile-time algorithm and per-command-group feature selection (for example
NO_RSA,FWTPM_NO_NV, and independent per-command-group gates you pick to shrink the fTPM footprint) WOLFTPM_SMALL_STACKsupport for constrained environments
See the firmware TPM manual for build instructions, configuration, and API reference.
wolfTPM implements the TPM 2.0 Library Specification v1.85 post-quantum algorithms: ML-DSA (FIPS 204) signing and ML-KEM (FIPS 203) key encapsulation. Both the client library and the firmware TPM server implement the eight new v1.85 PQC commands, and the SealSQ QVault is supported as the first TPM with ML-DSA and ML-KEM in silicon.
Build with --enable-pqc (the leaner ML-DSA and ML-KEM subset) or --enable-v185
(the full v1.85 feature set), against a wolfCrypt built with ML-DSA and ML-KEM.
Per-operation trimming is available with --enable-mldsa and --enable-mlkem, and
make check runs the PQC tests.
See the post-quantum manual and the firmware TPM post-quantum manual.
wolfTPM implements SPDM (Security Protocol and Data Model, DMTF DSP0274) for TPM 2.0 attestation over the TCG SPDM-over-TPM binding. Both the TCG certificate handshake and the DSP0274 pre-shared-key (PSK) handshake are supported, negotiating SPDM protocol version 1.3.
For testing without discrete silicon, the fwtpm_server ships an SPDM 1.3 responder
that drives the same handshake the real Nuvoton and Nations parts use, so the SPDM
stack can be exercised end-to-end in CI.
Build with --enable-spdm plus at least one handshake mode (--enable-tcg for the
certificate handshake, --enable-psk for the PSK handshake). Vendor wire-format
adapters are optional (--enable-nuvoton, --enable-nations).
See the SPDM manual for build instructions, responder modes, and the end-to-end test scripts.
git clone https://github.com/wolfSSL/wolfssl.git
cd wolfssl
./autogen.sh
./configure --enable-wolftpm
make
sudo make install
sudo ldconfigautogen.sh requires automake and libtool: sudo apt-get install automake libtool.
./autogen.sh
./configure
make
make checkOn Linux x86_64 and aarch64 a bare ./configure auto-enables the software TPM
backends, so make check runs without hardware.
mkdir build
cd build
# use an installed wolfSSL (library and headers)
cmake .. -DWITH_WOLFSSL=/prefix/to/wolfssl/install/
# OR use a wolfSSL source tree
cmake .. -DWITH_WOLFSSL_TREE=/path/to/wolfssl/
cmake --build .For the full list of configure flags and defines see the Build Options manual. To build for a specific TPM, see the Supported Hardware manual.
The full wolfTPM manual is published at
https://www.wolfssl.com/documentation/manuals/wolftpm/. The sources are kept in
docs/, with a Japanese translation under docs/ja/.
Overview
- Introduction: what wolfTPM is, with a map of the manual
- TPM 2.0 Overview: protocol, hierarchies, PCRs, and device identification
- Project Structure: the source layout
Getting started
- Getting Started: install, build, and run your first example
- Building: autotools, CMake, out-of-tree wolfSSL, and bare-metal
- Build Options: every configure flag and define
- System Interfaces: the software simulator (SWTPM), Linux
/dev/tpmX, and Windows TBS
Hardware
- Supported Hardware: every supported TPM and how to build for it
- HAL IO Callback: the single IO callback porting model and wolfHAL
Usage
- Examples Overview, Key Management, Attestation, Sealing and NVRAM, TLS and Certificates, Firmware Update, Management and GPIO
Features
- Post-Quantum: ML-DSA, ML-KEM, PQC TLS 1.3, and the SealSQ QVault
- SPDM: encrypted TPM sessions over the TCG SPDM binding
- Firmware TPM: the wolfCrypt firmware TPM (overview, building, usage, HAL and porting, post-quantum, and SPDM)
Wrappers and integrations
Reference
wolfTPM generates a Software Bill of Materials (CycloneDX 1.6 and SPDX 2.3) for EU
Cyber Resilience Act (CRA) compliance, with make sbom or the CMake sbom target.
See the SBOM and Compliance manual
and wolfssl/doc/CRA.md.
Email us at support@wolfssl.com.