tpm2_send(1)

๐Ÿ’– tpm2_send(1) โ€” General Commands Manual (yes bestie, that's the whole vibe) ๐Ÿ’–

Okay so this is tpm2_send(1) from the General Commands Manual, and honestly it's giving "raw unfiltered TPM energy" โ€” let's get into it ๐Ÿซถ


โœจ NAME โœจ

tpm2_send(1) โ€” literally just: send a raw command buffer to the TPM. That's it. That's the whole gig ๐Ÿ’…

๐ŸŒธ SYNOPSIS ๐ŸŒธ

tpm2_send [OPTIONS] [STDIN]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So tpm2_send(1) sends a TPM command to the TPM, periodt. The command gets read from a file as a binary stream, then transmitted to the TPM using the TCTI that the caller specified. Whatever the TPM sends back โ€” the response โ€” gets written to the output file.

Lowkey, you're probably gonna want to redirect that output somewhere: into a file, or straight into a program that decodes it and shows the response in human-readable form. That's the main character move here ๐Ÿ‘‘

๐ŸŽ€ OPTIONS ๐ŸŽ€

  • -o, --output=FILE โ€” the output file where the response buffer gets sent. Defaults to STDOUT. (So if you say nothing, it just yeets it at your terminal ๐Ÿ™ˆ)
  • _STDIN โ€” the file containing the TPM2 command. That's your input, bestie.

๐Ÿ“š References

(That's the subsection, no cap โ€” nothing extra hiding in here.)

๐Ÿ’œ COMMON OPTIONS ๐Ÿ’œ

This little collection of options is common to many programs, and it provides info that a lot of users justโ€ฆ expect to be there. It's the standard bestie starter pack โœจ

  • -h, --help=[man|no-man] โ€” displays the tool's manpage. By default it tries to invoke the manpager for the tool, but if that fails it'll output a short tool summary instead. Same behavior if you pass the man option argument โ€” except if you explicitly ask for man, the tool will actually give you the errors from man on stderr. If you specify the no-man option, or the manpager just fails, the short options get output to stdout.
Just so you know ๐Ÿซถ โ€” for the manpages feature to actually work, the manpages need to be installed or on MANPATH. See man(1) for more details.
  • -v, --version โ€” displays version information for this tool plus the supported tctis, then exits. Slay.
  • -V, --verbose โ€” increases the info the tool prints to the console while it's running. When you use this option, the file and line number get printed too. iykyk ๐Ÿ”
  • -Q, --quiet โ€” silences normal tool output to stdout. Shhh ๐Ÿคซ
  • -Z, --enable-errata โ€” enables the application of errata fixups. Useful if an errata fixup needs to be applied to commands sent to the TPM. Defining the environment variable TPM2TOOLS_ENABLE_ERRATA is equivalent. Two paths, same destination ๐Ÿ’ซ
  • -z, --pwd-session โ€” uses a password session instead of a HMAC session for authentication. A clear text password is passed to the TPM to authorize the action. This option can be used to avoid problems when unsalted sessions are used in OpenSSL FIPS mode. If auth values are used, a salted session should be used for authentication. (Read that last bit again, bestie โ€” it matters ๐Ÿ’€)
  • -R, --autoflush โ€” enables autoflush for transient objects created by the command. If a parent object is loaded from a context file, then also the transient parent object will be flushed. Autoflush can also be activated if the environment variable TPM2TOOLS_AUTOFLUSH is set to yes or true. Here's that info many users may expect ๐ŸŒˆ

๐ŸŒผ TCTI Configuration ๐ŸŒผ

The TCTI โ€” aka the "Transmission Interface" โ€” is the communication mechanism with the TPM. TCTIs can be changed so you can talk to TPMs across different mediums. Versatile icon ๐Ÿ’…

To control the TCTI, the tools respect:

  1. The command line option -T or --tcti
  2. The environment variable: TPM2TOOLS_TCTI.
Note: the command line option always overrides the environment variable. No negotiating ๐Ÿ‘‘

The current known TCTIs are:

  • tabrmd โ€” the resource manager, called tabrmd. Note that tabrmd and abrmd as a tcti name are synonymous.
  • mssim โ€” typically used for communicating to the TPM software simulator.
  • device โ€” used when talking directly to a TPM device file.
  • none โ€” do not initalize a connection with the TPM. Some tools allow for off-tpm options and thus support not using a TCTI. Tools that don't support it will error when you try to use them without a TCTI connection. Does not support ANY options and MUST BE presented as the exact text of none.

The arguments to either the command line option or the environment variable are in the form:

<tcti-name>:<tcti-option-config>

Specifying an empty string for either the <tcti-name> or <tcti-option-config> results in the default being used for that portion respectively. Cute and forgiving ๐ŸŽ€

๐Ÿงš TCTI Defaults

When a TCTI isn't specified, the default TCTI is searched for using dlopen(3) semantics. The tools will search for tabrmd, device and mssim TCTIs IN THAT ORDER and USE THE FIRST ONE FOUND โ€” yes, the caps are doing their job, that's the actual emphasis ๐Ÿ˜ญ

You can query what TCTI will be chosen as the default by using the -v option to print the version information. The default-tcti key-value pair will tell you which of the aforementioned TCTIs is the default. Peek at your future, bestie ๐Ÿ”ฎ

โญ Custom TCTIs

Any TCTI that implements the dynamic TCTI interface can be loaded. The tools internally use dlopen(3), and the raw tcti-name value is used for the lookup. So that could be a path to the shared library, or a library name as understood by dlopen(3) semantics. Bring your own, we love a guest appearance ๐ŸŒŸ

๐Ÿ’€ TCTI OPTIONS ๐Ÿ’€

This collection of options is used to configure the various known TCTI modules available:

  • device โ€” for the device TCTI, the TPM character device file for use by the device TCTI can be specified. The default is /dev/tpm0.

Example: -T device:/dev/tpm0 or export TPM2TOOLS_TCTI="device:/dev/tpm0"

  • mssim โ€” for the mssim TCTI, the domain name or IP address and port number used by the simulator can be specified. The default are 127.0.0.1 and 2321.

Example: -T mssim:host=localhost,port=2321 or export TPM2TOOLS_TCTI="mssim:host=localhost,port=2321"

  • abrmd โ€” for the abrmd TCTI, the configuration string format is a series of simple key value pairs separated by a , character. Each key and value string are separated by a = character.
    • TCTI abrmd supports two keys:
      1. bus_name : the name of the tabrmd service on the bus (a string).
      2. bus_type : the type of the dbus instance (a string) limited to session and system.

Specify the tabrmd tcti name and a config string of bus_name=com.example.FooBar:

\--tcti=tabrmd:bus_name=com.example.FooBar

Specify the default (abrmd) tcti and a config string of bus_type=session:

\--tcti:bus_type=session
NOTE: abrmd and tabrmd are synonymous. Also, that's the various known TCTI modules. ๐Ÿ™ˆ

๐Ÿ”ฅ EXAMPLES ๐Ÿ”ฅ

๐Ÿ’ซ Send and receive raw commands to TPM

Send the contents of tpm2-command.bin to a device and collect the response as tpm2-response.bin. Watch her work:

tpm2_send < tpm2-command.bin > tpm2-response.bin

tpm2_send < tpm2-command.bin -o tpm2-response.bin

Two ways, same energy. Do it with shell redirection or do it with -o โ€” your call, both slay ๐ŸŽ€

๐Ÿ“ Returns ๐Ÿ“

Tools can return any of the following codes:

  • 0 โ€” Success. We love to see it ๐Ÿ’–
  • 1 โ€” General non-specific error. Vague, unhelpful, but real.
  • 2 โ€” Options handling error.
  • 3 โ€” Authentication error. Locked out, bestie ๐Ÿ˜ญ
  • 4 โ€” TCTI related error.
  • 5 โ€” Non supported scheme. Applicable to tpm2_testparams.

๐Ÿ› BUGS ๐Ÿ›

Github Issues. That's it, that's the whole bug section. Take it up with the issues page ๐Ÿซถ

๐Ÿ“ฃ HELP ๐Ÿ“ฃ

See the Mailing List.

๐Ÿ“œ License ๐Ÿ“œ

This work is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0). Respect the license, bestie ๐Ÿ’œ


And that's the whole page!! ๐Ÿฆ‹ This came to you from tpm2-tools โ€” the source/version behind everything you just read โ€” with tpm2_send(1) as the manpage name riding along at the bottom, exactly like the original footer (no date printed on this one, so no date to gossip about ๐Ÿ™ˆ). Go send some raw commands, you absolute icon ๐Ÿ‘‘โœจ

๐Ÿ“ฆ where this page comes from