tpm2_pcrreset(1)

πŸ’… tpm2_pcrreset(1) πŸ’…

ok so this is a page from the General Commands Manual β€” yes that one β€” and it's about tpm2_pcrreset. bestie, we're resetting PCR banks and honestly? it's giving factory-reset-for-cryptographic-measurements. let's get into it 🫢


✨ NAME ✨

tpm2_pcrreset(1) β€” reset one or more PCR banks. that's it. that's the whole job. iconic.


🌸 SYNOPSIS 🌸

tpm2_pcrreset [OPTIONS] PCR_INDEX ...

πŸ¦‹ DESCRIPTION πŸ¦‹

tpm2_pcrreset(1) resets the PCR value in all banks for the index you specify. and yes, you can pass more than one PCR index β€” go off, honestly.

the reset value is manufacturer-dependent, so it's either a whole sequence of 00 or a whole sequence of FF, and it's as long as the hash algorithm length for each supported bank. so like, every bank gets its own length of zeroes-or-FFs. no cap. πŸ’€

PCR_INDEX is a space separated list of PCR indexes to be reset when issuing the command.


πŸŽ€ OPTIONS πŸŽ€

the page literally states "This tool accepts no tool specific options." and then immediately gives you one (1) tool specific option. we love a plot twist πŸ™ˆ anyway:

  • --cphash=FILE β€” file path where you want the hash of the command parameters recorded. this is commonly called cpHash, iykyk. NOTE: when this option is selected, the tool will not actually execute the command β€” it just returns a cpHash. literally just the hash, nothing else happens. πŸ’…

πŸ’– COMMON OPTIONS πŸ’–

these are the options a bunch of the programs share, because consistency is cute and users expect them:

  • -h, --help=[man|no-man] β€” display the tool's manpage. by default it tries to invoke the manpager for the tool, but on failure it'll output a short tool summary instead. same behavior if you pass the man option argument β€” but if you explicitly ask for man, the tool will give you errors from man on stderr. if you specify the no-man option, or the manpager just fails, the short options get output to stdout.

to actually use the manpages feature you need the manpages installed or on MANPATH, see man(1) for more details.

  • -v, --version β€” display version information for this tool, plus supported tctis, then exit.
  • -V, --verbose β€” increases the info the tool prints to the console while it runs. when you use this option, the file and line number get printed. detective mode πŸ”
  • -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 environment variable TPM2TOOLS_ENABLE_ERRATA is equivalent.
  • -z, --pwd-session β€” use 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.
  • -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 variable TPM2TOOLS_AUTOFLUSH is set to yes or true. (the original page says "is is" and honestly same, typos happen 😭)

🌈 TCTI Configuration 🌈

the TCTI, aka "Transmission Interface", is the communication mechanism with the TPM. TCTIs can be changed for communication with TPMs across different mediums. very flexible, very main character energy.

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. always. periodt.

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 initialize 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. exact. like, character for character. no vibes-based spelling.

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. so like, empty = default. easy.

🧚 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. order matters, bestie. it's not a suggestion.

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. so 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 it 🫢


πŸ’œ 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 defaults 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.

the 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. same girl, different name πŸ’…


🌸 EXAMPLES 🌸

Reset a single PCR

tpm2_pcrreset 23

Reset multiple PCRs

tpm2_pcrreset 16 23

look at that. two indexes, one command. we love efficiency πŸŽ€


😭 NOTES 😭

on operating system's locality (generally locality 0), only PCR 23 can be reset. PCR-16 can also be reset on this locality, depending on TPM manufacturers, which could define this PCR as resettable.

PCR 0 to 15 are not resettable (being part of SRTM). PCR 16 to 22 are mostly reserved for DRTM or dedicated to specific localities and might not be resettable depending on current TPM locality.

so real talk: if you try to reset PCR 0–15, that's a no. and 16–22 is very much a "depends on your TPM and your locality" situation. check before you wreck, bestie 🫢

πŸ”₯ 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 to tpm2_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 page, bestie!! ✨ this little gem is brought to you by the fine folks of tpm2-tools β€” the footer on the original is literally just tpm2-tools and the page name tpm2_pcrreset(1), so no date to give you, it's giving mystery πŸ•΅οΈβ€β™€οΈ anyway go reset those PCRs responsibly, mwah πŸ’‹πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from