Expand description
TPM 2.0 Command Structures
TPM command and response packet formats per TPM 2.0 specification (Part 3).
§TPM 2.0 Command Format
All TPM commands follow this structure:
+-------------------+
| Tag (2 bytes) | TPM_ST_SESSIONS or TPM_ST_NO_SESSIONS
+-------------------+
| Size (4 bytes) | Total packet size
+-------------------+
| Command (4 bytes) | TPM_CC_* command code
+-------------------+
| Parameters | Command-specific
+-------------------+§Supported Commands
TPM2_Startup/TPM2_Shutdown– lifecycleTPM2_GetRandom– hardware RNGTPM2_PCR_Read/TPM2_PCR_Extend– measured bootTPM2_SelfTest– POST diagnosticsTPM2_GetCapability– feature query
Modules§
- capability
- Well-known capability constants
- hash_
alg - TPM Hash Algorithms (TPM_ALG_*)
Structs§
- PcrSelection
- PCR selection structure (TPMS_PCR_SELECTION)
- TpmCommand
Header - TPM Command Header (10 bytes, big-endian on wire)
- TpmGet
Capability Command - TPM2_GetCapability command for querying TPM properties.
- TpmGet
Random Command - TPM2_GetRandom command
- TpmGet
Random Response - TPM2_GetRandom response parser
- TpmPcr
Extend Command - TPM2_PCR_Extend command
- TpmPcr
Read Command - TPM2_PCR_Read command
- TpmPcr
Read Response - TPM2_PCR_Read response parser
- TpmResponse
Header - TPM Response Header (10 bytes, big-endian on wire)
- TpmSelf
Test Command - TPM2_SelfTest command
- TpmShutdown
Command - TPM2_Shutdown command
- TpmStartup
Command - TPM2_Startup command
Enums§
- TpmCommand
Code - TPM Command Codes (TPM_CC, partial list)
- TpmResponse
Code - TPM Response Codes (TPM_RC)
- TpmShutdown
Type - TPM Shutdown Types (TPM_SU)
- TpmStartup
Type - TPM Startup Types (TPM_SU)
- TpmStructure
Tag - TPM Structure Tags (TPM_ST)
Functions§
- marshal_
command - Marshal a generic TPM command into a byte buffer.
- parse_
response - Parse a TPM response buffer and extract the response code and payload.