tpm2_flushcontext(1)
π¦ tpm2_flushcontext(1)
okay so first things first β this page lives in the tpm2-tools manual set, and it's all about tpm2_flushcontext. Think of it as the "clear your tabs" button for your TPM. no cap, it's that simple. π
πΈ NAME
tpm2_flushcontext β removes a specified handle, or all the contexts associated with a transient object, a loaded session, or a saved session, from the TPM. bye, handle. you are so flushed. π½β¨
β¨ SYNOPSIS
tpm2_flushcontext [OPTIONS] [ARGUMENT]
π DESCRIPTION
tpm2_flushcontext(1) β Remove a specified handle, or all contexts associated with a transient object, loaded session or saved session from the TPM.
The thing you're yeeting is specified as the first argument to the tool, and it's in one of these forms:
- The handle of the object you want flushed from the TPM. Gotta be a valid handle number, bestie β no made-up digits π
- Flush a session via a session file. And where do session files come from? From
tpm2_startauthsession(1)'s-Soption. iykyk π«Ά
π OPTIONS
-t,--transient-objectβ Remove all transient objects. every last one. gone.-l,--loaded-sessionβ Remove all loaded sessions. clean slate energy β¨-s,--saved-sessionβ Remove all saved sessions. also gone. no survivors πARGUMENTβ the command line argument specifies the OBJECT to be removed from the TPM resident memory. so you literally just hand it a thing and it goes poof π«§--cphash=FILEβ File path to record the hash of the command parameters. this is commonly termed cpHash. NOTE: when this option is selected, the tool will not actually execute the command β it simply returns a cpHash. lowkey a fake-out, but a useful one π
π COMMON OPTIONS
This collection of options are common to many programs and provide information that many users may expect. the shared wardrobe of the tpm2-tools world, fr fr.
-h,--help=[man|no-man]β Display the tool's manpage. By default it attempts to invoke the manpager for the tool, however, on failure it will output a short tool summary. This is the same behavior if the "man" option argument is specified β BUT if explicit "man" is requested, the tool will provide errors from man on stderr. If the "no-man" option is specified, or the manpager fails, the short options will be output to stdout.
To successfully use the manpages feature, you need the manpages installed or onMANPATH. seeman(1)for more details, bestie π
-v,--versionβ Display version information for this tool and supported tctis, then 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. she's chatty and we love that π£οΈ-Q,--quietβ Silence normal tool output to stdout. shhh π€«-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. β οΈ heads up on that last bit, okay?-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. πΏ
π§ 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. it's giving "different roads, same destination" π£οΈ
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. always. no exceptions. π
The current known TCTIs are:
tabrmdβ The resource manager, called tabrmd. Note thattabrmdandabrmdas a tcti name are synonymous. same girl, two names π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 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 text ofnone. like, literally the exact text. don't get creative π«
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. blanks are valid, bestie π«Ά
β 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. it's not a vibe check, it's a queue.
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. bring your own TCTI, we'll load her π
π 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. say it with me one more time π£
π₯ EXAMPLES
π«§ Flushing a Transient Object
Typically, when using the TPM, the interactions occur through a resource manager, like tpm2-abrmd(8). When the process exits, transient object handles are flushed. Thus, flushing transient objects through the command line is not required. slay, the resource manager handles it for you π
However, when interacting with the TPM directly, this scenario is possible. The below example assumes direct TPM access not brokered by a resource manager. Specifically we will use the simulator.
tpm2_createprimary -Tmssim -c primary.ctx
tpm2_getcap -T mssim handles-transient
- 0x80000000
tpm2_flushcontext -T mssim 0x80000000
β¨ Flush All the Transient Objects
tpm2_flushcontext \--transient-object
π Flush a Session
tpm2_startauthsession -S session.dat
tpm2_flushcontext session.dat
π 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. go yell there (politely) π«Ά
πΈ HELP
See the Mailing List. the girlies there are helpful, fr fr π
π License
This work is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
and that's the whole page, bestie!! π this little gem comes to you straight from the tpm2-tools crew, and you've just read the tpm2_flushcontext(1) page top to bottom. go flush something. literally anything. πβ¨π¦
π¦ 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