tpm2_stirrandom(1)
✨ NAME ✨
tpm2_stirrandom(1) — yes, from the General Commands Manual, bestie — is the tool that adds “additional information” into TPM RNG state. Periodt. 💖
🦋 SYNOPSIS 🦋
tpm2_stirrandom [OPTIONS] [ARGUMENT]
🌸 DESCRIPTION 🌸
tpm2_stirrandom(1) injects “additional information” as bytes into the TPM entropy Protected Capability pool. It’s giving “let me stir the random, actually.” 🫶
“Additional information” can be extracted from a file specified as the argument, or it can be read from STDIN if the argument is not specified.
Up to 128 bytes can be injected at once through standard input to tpm2_stirrandom(1).
If the input file is larger than 128 bytes, tpm2_stirrandom(1) will fail. Not “maybe,” not “try again,” it will fail, bestie. 😭
Adding data through tpm2_stirrandom(1) will trigger a reseeding of the TPM DRBG Protected Capability. It is used when performing any sensitive action on a shielded location such as loading a persistent key or acting on a Protected Capability like updating TPM firmware. Very main-character security behavior. 👑
💅 OPTIONS 💅
This command has no option — literally none of its own, no cap.
🎀 References 🎀
(No entries listed here in the original page.)
🫶 COMMON OPTIONS 🫶
This collection of options are common to many programs and provide information that many users may expect. It’s the shared group-chat toolbox, basically. 💬
-h,--help=[man|no-man]— Display the tool’s manpage. By default, it attempts to invoke the manpager for the tool, however, on failure will output a short tool summary. This is the same behavior if themanoption argument is specified, however if explicitmanis requested, the tool will provide errors from man onstderr. If theno-manoption is specified, or the manpager fails, the short options will be output tostdout.
To successfully use the manpages feature requires the manpages to be installed or on MANPATH, See man(1) for more details.
-v,--version— Display version information for this tool, supported tctis and exit.-V,--verbose— Increase the information that the tool prints to the console during its execution. When using this option the file and line number are printed.-Q,--quiet— Silence normal tool output tostdout.-Z,--enable-errata— Enable the application of errata fixups. Useful if an errata fixup needs to be applied to commands sent to the TPM. Defining the environmentTPM2TOOLS_ENABLE_ERRATAis equivalent.-z,--pwd-session— Use 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.-R,--autoflush— Enable autoflush for transient objects created by the command. If a parent object is loaded from a context file also the transient parent object will be flushed. Autoflush can also be activated if the environment variableTPM2TOOLS_AUTOFLUSHis set toyesortrue. (Also, the original page has a stray “information many users may expect.” floating here — I’m preserving the chaos. 🫠)
🌈 TCTI Configuration 🌈
The TCTI or “Transmission Interface” is the communication mechanism with the TPM. TCTIs can be changed for communication with TPMs across different mediums.
To control the TCTI, the tools respect:
- The command line option
-Tor--tcti - The environment variable:
TPM2TOOLS_TCTI
Note: The command line option always overrides the environment variable.
The current known TCTIs are:
tabrmd— The resource manager, calledtabrmd. Note thattabrmdandabrmdas 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 initialize a connection with the TPM. Some tools allow for off-tpm options and thus support not using a TCTI. Tools that do not support it will error when attempted to be used without a TCTI connection. Does not support ANY options and MUST BE presented as the exact textnone.
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.
🌸 TCTI Defaults 🌸
When a TCTI is not 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. 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 indicate which of the aforementioned TCTIs is the default.
🌸 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. Thus, this could be a path to the shared library, or a library name as understood by dlopen(3) semantics. Slay, dynamic loading. 💅
🌈 TCTI OPTIONS 🌈
This collection of options are 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 are127.0.0.1and2321.
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:
bus_name: The name of the tabrmd service on the bus (a string).bus_type: The type of the dbus instance (a string) limited tosessionandsystem.
- TCTI abrmd supports two keys:
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:abrmdandtabrmdare synonymous. Also, the original page has this dangling fragment: “the various known TCTI modules.)” — I’m not hiding it, bestie. 🎀
🎀 EXAMPLES 🎀
Inject from stdin using echo
echo -n "myrandomdata" | tpm2_stirrandom
Inject 64 bytes from stdin using a file
dd if=/dev/urandom bs=1 count=64 > myrandom.bin
tpm2_stirrandom < ./myrandom.bin
Inject bytes from a file and reading up to 128 bytes
dd if=/dev/urandom of=./myrandom.bin bs=1 count=42
tpm2_stirrandom ./myrandom.bin
⭐ NOTES ⭐
Please be aware that even if the “additional information” added by tpm2_stirrandom(1) can be entropy gathered from other DRBG sources, the TPM has no way of determining if the value has any entropy or not. As a consequence, it will just be considered as “additional input”. The TPM is lowkey just taking your word for it. 💀
The “additional input” is as defined in NIST SP800-90A.
💀 Returns 💀
Tools can return any of the following codes:
0- Success.1- General non-specific error.2- Options handling error.3- Authentication error.4- TCTI related error.5- Non supported scheme. Applicable totpm2_testparams.
🙈 BUGS 🙈
Github Issues
🧚 HELP 🧚
See the Mailing List
👑 License 👑
This work is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
And that’s the whole tpm2_stirrandom(1) page, bestie! Footer tea: source/version is tpm2-tools, the page is tpm2_stirrandom(1), and the original footer didn’t include a date — so I’m not inventing one. No cap. 💖
📦 where this page comes from
- arch rolling: tpm2-tools 5.8-1 · BSD-3-Clause
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms