DOKK / manpages / debian 12 / swtpm-tools / swtpm_bios.8.en
swtpm_bios(8) swtpm_bios(8)

swtpm_bios - BIOS simulation tool for swtpm

swtpm_bios [OPTIONS]

swtpm_bios is a tool that can send the commands to the TPM (swtpm program) that typically are used by the BIOS to initialize the TPM. The user can choose among several command line options to choose the state the TPM should be set to.

This command requires the environment variable TCSD_USE_TCP_DEVICE to be set for communication via TCP. Otherwise it will use the device set in the environment variable TPM_DEVICE or fall back to use /dev/tpm0 to send the commands to. In TCP mode, the environment variable TCSD_TCP_DEVICE_HOSTNAME is used to indicate the host to send the commands to. By default localhost is assumed. The default TCP port is 6545 unless the environment variable TCSD_TCP_DEVICE_PORT indicates another port.

In case of success 0 will be returned. In case a TPM error was encountered the return code will be 128. In case of communication failure 255 is returned. In case the TPM needs to be reset to become activated, 129 will be returned.

This command will send the following sequence of commands to the TPM.

TSC_PhysicalPresence(0x20)">">TSC_PhysicalPresence(0x20) -- PhysicalPresenceCMDEnable
TSC_PhysicalPresence(0x08)">">TSC_PhysicalPresence(0x08) -- turn on physical presence
TPM_PhysicalSetDeactivated(0x0)">">TPM_PhysicalSetDeactivated(0x0) -- activate TPM
TSC_PhysicalPresence(0x20)~2">~2">TSC_PhysicalPresence(0x20) -- PhysicalPresenceCMDEnable
TSC_PhysicalPresence(0x14)">">TSC_PhysicalPresence(0x14) -- turn off physical presence & lock it

The following options are supported:

Use the given device rather than the default /dev/tpm0. This option overrides the TPM_DEVICE environment variable.
Connect to the given server and port; if no server is given, 127.0.0.1 is used; if port is not given, the default port 6545 is used.
Connect to the given UnixIO path.
The device is a TPM 2.
Send TPM_Startup(ST_CLEAR) (default). This instructs the TPM to start with clear state.
Send TPM_Startup(ST_STATE). This instructs the TPM to start by restoring previously saved state.
Send TPM_Startup(ST_DEACTIVATED). This instructs the TPM to start in deactivated mode. This option has no effect on a TPM 2.
Don't send a TPM_Startup command.
Only send the startup command and nothing else.
Make sure that the TPM is activated; if the TPM requires a reset, the program will exist and return a return code of 129.
Send a TPM_ContinueSelfTest command to a TPM 1.2 and a TPM2_IncrementalSelfTest command to a TPM 2.
Give up physical presence on a TPM 1.2. In case of a TPM 2 set the platform hierarchy to a random password.
Display version and exit.
Display the help screen and exit.

Report bugs to Stefan Berger <stefanb@linux.vnet.ibm.com>

2023-05-18 swtpm