⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module tpm_commands

Module tpm_commands 

Source
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 – lifecycle
  • TPM2_GetRandom – hardware RNG
  • TPM2_PCR_Read / TPM2_PCR_Extend – measured boot
  • TPM2_SelfTest – POST diagnostics
  • TPM2_GetCapability – feature query

Modules§

capability
Well-known capability constants
hash_alg
TPM Hash Algorithms (TPM_ALG_*)

Structs§

PcrSelection
PCR selection structure (TPMS_PCR_SELECTION)
TpmCommandHeader
TPM Command Header (10 bytes, big-endian on wire)
TpmGetCapabilityCommand
TPM2_GetCapability command for querying TPM properties.
TpmGetRandomCommand
TPM2_GetRandom command
TpmGetRandomResponse
TPM2_GetRandom response parser
TpmPcrExtendCommand
TPM2_PCR_Extend command
TpmPcrReadCommand
TPM2_PCR_Read command
TpmPcrReadResponse
TPM2_PCR_Read response parser
TpmResponseHeader
TPM Response Header (10 bytes, big-endian on wire)
TpmSelfTestCommand
TPM2_SelfTest command
TpmShutdownCommand
TPM2_Shutdown command
TpmStartupCommand
TPM2_Startup command

Enums§

TpmCommandCode
TPM Command Codes (TPM_CC, partial list)
TpmResponseCode
TPM Response Codes (TPM_RC)
TpmShutdownType
TPM Shutdown Types (TPM_SU)
TpmStartupType
TPM Startup Types (TPM_SU)
TpmStructureTag
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.