This utility is a Rust wrapper around the Trusted Computing Group (TCG) TPM 2.0 reference implementation. It performs the "manufacturing" process for a software TPM, initializing its persistent state.
The tool links against the official TCG TPM C reference code (included as a submodule). It:
- Initializes the TPM's Non-Volatile (NV) memory system.
- Executes
TPM_Manufactureto set up the initial TPM state (seeds, hierarchies, etc.). - Persists the resulting state to a file named
NVChipin the current directory.
Before building, ensure you have the following installed:
-
Rust & Cargo: Install Rust
-
C Compiler:
gccorclang(required to compile the C reference code). -
OpenSSL Development Headers: The project links against
libcrypto.- Ubuntu/Debian:
sudo apt-get install libssl-dev
- Fedora/RHEL:
sudo dnf install openssl-devel
- macOS:
brew install openssl # You may need to set OPENSSL_DIR if brew doesn't link it automatically
- Ubuntu/Debian:
Clone the repository and its submodules, then build with Cargo:
# Clone with submodules
git clone --recursive <repository-url>
cd tpm_manufacture_tcg
# Build
cargo build --releaseNote: If you already cloned without --recursive, run git submodule update --init --recursive to fetch the C source code.
Run the utility directly with Cargo:
cargo run --releaseIf successful, you will see:
Starting TCG TPM Manufacture utility...
TPM Manufacture successful. State saved to 'NVChip'.
A file named NVChip will be created in your current working directory. This file represents the persistent storage of your simulated TPM.
Error: openssl/aes.h: No such file or directory
This means the OpenSSL development headers are missing. Install libssl-dev (or equivalent) as described in Prerequisites.