collection of tools for playing with TPM v2 modules natively e.g. through SPI
Project description
tpm2-native
This is a collection of tools for playing with TPM v2 modules natively e.g. through SPI. The main purpose is to learn how TPM v2 works by interacting with a TPM.
I do all my testing on a Raspberry Pi 4 with an Infineon OPTIGA TPM SLM 9670 Iridium TPM2.0 Evaluation Board.
Install
Simply install with pip install tpm2-native
. This will install all utilities that can be called natively. All utilities have names starting with tpm2_
, utilities are simply the command names e.g. tpm2_Startup.
Supported Commands
- Startup
- Shutdown
- GetTestResult
References
- TPM 2.0 Library Specification
- Infineon Embedded Linux TPM Toolbox 2 (ELTT2) for TPM 2.0
- Infineon Iridium SLM 9670 TPM2.0
Example
Startup after reset.
$ tpm2_Startup clear
tag: 0x8001 [TPM_ST_NO_SESSIONS]
requestSize: 0xc [12]
commandCode: 0x144 [TPM_CC_Startup]
req: 80 01 00 00 00 0c 00 00 01 44 00 00
res: 80 01 00 00 00 0a 00 00 00 00
tag: 0x8001 [TPM_ST_NO_SESSIONS]
responseSize: 0xa [10]
responseCode: 0x0 [TPM_RC_SUCCESS]
GetTestResult:
$ tpm2_GetTestResult
tag: 0x8001 [TPM_ST_NO_SESSIONS]
requestSize: 0xa [10]
commandCode: 0x17c [TPM_CC_GetTestResult]
req: 80 01 00 00 00 0a 00 00 01 7c
res: 80 01 00 00 00 1a 00 00 00 00 00 0a 00 06 01 0b 00 00 00 00 0e b8 00 00 01 53
tag: 0x8001 [TPM_ST_NO_SESSIONS]
responseSize: 0x1a [26]
responseCode: 0x0 [TPM_RC_SUCCESS]
outDataSize: 0xa [10]
outData: 00 06 01 0b 00 00 00 00 0e b8
testResult: 0x0 [TPM_RC_SUCCESS]
Shutdown:
$ tpm2_Shutdown clear
tag: 0x8001 [TPM_ST_NO_SESSIONS]
requestSize: 0xc [12]
commandCode: 0x145 [TPM_CC_Shutdown]
req: 80 01 00 00 00 0c 00 00 01 45 00 00
res: 80 01 00 00 00 0a 00 00 00 00
tag: 0x8001 [TPM_ST_NO_SESSIONS]
responseSize: 0xa [10]
responseCode: 0x0 [TPM_RC_SUCCESS]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file tpm2-native-2.tar.gz
.
File metadata
- Download URL: tpm2-native-2.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7977376005a0ed7a517e9a81e9363c004476e02b1bfbe2798cab7034824dd9e9 |
|
MD5 | d878295aa4b8b02fc9790bdd9c4e0e66 |
|
BLAKE2b-256 | bc631f0fa2eaf5e7d28f28a36a3c644225505032b3640af6c9a3014f8f012e4f |