TPM 2.0 Simulator Extraction Script
The purpose of this script is to extract the source code from the publicly available PDF versions 01.16 and 01.38 of the Trusted Platform Module Library Specification published by the Trusted Computing Group (TCG).
The result of the extraction scripts is a complete set of the source files for a Trusted Platform Module (TPM) 2.0 Simulator, which runs under Windows, Linux, as well as Genode (by applying the appropriate patches).
Note: The extraction script also works with a Microsoft Word-based FODT-version of the more recent specifications (e.g., version 01.19), which are however only available to TCG members.
License: The files of this project are licensed under BSD 2-Clause License (except where indicated otherwise).
Make sure the following packages are installed on your system:
patch cmake build-essential python-bs4 python-pip python-dev
Also install the python module "pyastyle" for formatted output:
pip install pyastyle
Extracting the source code
Open a terminal and navigate to the project folder
Edit configuration settings in the file
FIRMWARE_V1) and change
SET = Falseto
SET = Truewhen finished
Create a folder named
buildand run the following command inside:
cmake -G "Unix Makefiles" ../cmake -DCMAKE_BUILD_TYPE=Debug -DSPEC_VERSION=116
cmake -G "Unix Makefiles" ../cmake -DCMAKE_BUILD_TYPE=Debug -DSPEC_VERSION=138
- runs the Python script to extract the simulator source code
- patches files containing the source code
- generates a Makefile used for building the simulator
Building and running the simulator
- Build the simulator
- Run the simulator:
(If there are any error messages at startup, restart the simulator)
In order to test if the simulator is working correctly, we use IBM's TPM 2.0 TSS
Open a terminal and start the TPM simulator
Open another terminal and navigate to the project folder
Build the TSS:
- Run the tests:
The following table shows which version of the TPM Simulator works with which version of the IBM's TPM 2.0 TSS.
|Specification version||Used document type||TSS version||Results|
1: The option
-116 has to be added to line 88 in /utils/regtests/testaes.sh.
2: The policy tests (
-18 for version 755 of the TSS,
-21 for version 996 of the TSS) cannot be executed separately. They only work if they are executed with the other tests using the option
-a (all) in the TSS.
3: The lines 66-68 in /utils/regtests/initkeys.sh have to be removed. Only the tests which are not for version 138 of the TPM specification can be executed (which tests are affected can be retrieved by calling the TSS with the help argument
-h). The tests have to be executed separately by using the option
-n$TESTNUMBER with the TSS.
4: The TSS fails when running it the first time, but not in any subsequent run. The clock test fails.
IBM's TPM 2.0 TSS was created by Ken Goldman and is licensed under the Berkeley Software Distribution (BSD) License. We'd like to thank Ken for implementing and providing a TSS that also includes test cases, which we could use to verify the extracted source code of the TPM 2.0 simulator.