tpm2_pcrread(1)
π tpm2_pcrread(1) β General Commands Manual π
okay bestie, buckle up, because this is tpm2_pcrread(1) and it's literally the tool that shows you your PCR values. yes, those PCRs. the platform configuration registers. the vibe check of your TPM, fr fr. β¨
πΈ NAME πΈ
tpm2_pcrread(1) β List PCR values. that's it. that's the whole job. iconic. π
π¦ SYNOPSIS π¦
tpm2_pcrread [OPTIONS] PCR_LIST_OR_ALG
π DESCRIPTION π
tpm2_pcrread(1) displays PCR values. and like, if you run it with no arguments at all? it outputs all the PCRs and all their hash banks. everything. the whole closet. no cap. π«Ά
but you can filter, because you're a main character with preferences:
if you want to only see PCR banks with a given algorithm, just specify the hashing algorithm as the argument. algorithms follow the βformatting standardsβ (iykyk), so peek at the section βAlgorithm Specifiersβ. also, the section βSupported Hash Algorithmsβ has the full list of what's supported. π₯
if instead you want a list of PCR banks (sha1, sha256, etc) and ids (0, 1, 2 etc), then you specify a PCR selection list as the argument, exactly as laid out in the section βPCR Bank Specifiersβ. π
also β please, please read the NOTES section below. it's there for a reason. π
the output gets written in a YAML format to stdout, with each algorithm followed by a PCR index and its value. so like, say you've only got sha1 and sha256 support and only 1 PCR. the output would be:
$ tpm2_pcrread sha1:0+sha256:0
sha1 :
0 : 0000000000000000000000000000000000000003
sha256 :
0 : 0000000000000000000000000000000000000000000000000000000000000003
look at those zeroes. gorgeous. π
β¨ OPTIONS β¨
-o,--output=FILEβ the output file to write the PCR values in binary format. optional, bestie. π--cphash=FILEβ a file path to record the hash of the command parameters. this is commonly termed ascpHash. > NOTE: when this option is selected, the tool will not actually execute the command β it simply returns a cpHash. so like, it's giving window shopping, not actual shopping. π-S,--session=FILEβ specifies the auxiliary sessions for the command. π-F,--pcrs_format=FORMATβ format selection for the binary blob in the PCR output file. here's the tea:valueswill output a binary blob of the PCR values.serializedwill write or read a binary blob of the PCR values in the form of serialized data structure in little endian format.marshaledwill read or write a binary blob in the binary format used by the TSS2 marshaling and unmarshaling functions. ifmarshaledis used, the data is serialized in the following order:TPML_PCR_SELECTION,UINT32(the number of followingTPML_DIGESTelements)TPML_DIGEST[number ofTPML_DIGESTelements].
optional. default is values. π¦
πΌ COMMON OPTIONS πΌ
this collection of options are common to many programs and provide information that many users may expect. the shared starter pack, 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 it will output a short tool summary. this is the same behavior if the βmanβ option argument is specified, however 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 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. quick little flex. π-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. it's giving receipts. π§Ύ-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. π-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. clean girl aesthetic, but for objects. π§Ή
π 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 the how-do-we-talk-to-the-TPM situation. π¬
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. no exceptions. the CLI said what it said. π
the current known TCTIs are:
tabrmdβ the resource manager, calledtabrmd. note thattabrmdandabrmdas a tcti name are synonymous. same girl, different name. π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 text of βnoneβ. literally exactlynone. all lowercase. no extras. that's the whole assignment. π
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 blank is fine, it'll just default on you. π
π 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. (caps lock because it's serious. that's the priority list, periodt.) π₯
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, bestie. β¨
πΈ 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. π
π PCR bank specifiers π
β Supported Hash Algorithms β
supported hash algorithms are:
0x4orsha1forTPM_ALG_SHA10xBorsha256forTPM_ALG_SHA256(default)0xCorsha384forTPM_ALG_SHA3840xDorsha512forTPM_ALG_SHA5120x12orsm3_256forTPM_ALG_SM3_256
NOTE: your TPM may not support all algorithms. sad but true. check before you commit. π
π Algorithm Specifiers
Okay bestie, this is the part where the manual teaches you how to talk algorithm β¨ Any option that takes an algorithm is lowkey fluent in βnice-namesβ, so you don't have to hand-write some cursed little struct every time. Slay.
There are two major algorithm specification string classes: simple and complex. And heads up β only certain algorithms get accepted by the TPM, depending on usage and conditions. So like, not everything on the menu is available at every TPM, iykyk π
Simple specifiers
These are strings with no extra specification data attached β just the bare name, no accessories. When you're creating objects, any part of the object you didn't specify is assumed to be defaults. The full list of known βSimple Specifiersβ is right below, go off π
Asymmetric
rsaecc
Symmetric
aescamelliasm4
Hashing Algorithms
sha1sha256sha384sha512sm3_256sha3_256sha3_384sha3_512
Keyed Hash
hmacxor
Signing Schemes
rsassarsapssecdsaecdaaecschnorrsm2
Asymmetric Encryption Schemes
oaeprsaesecdh
Modes
ctrofbcbccfbecb
Misc
null
Complex Specifiers
So when objects get specified for creation by the TPM, they have like a whole public data situation to populate β type, scheme, asymmetric details, key size, all of it. The general format for spelling that out is:
<type>:<scheme>:<symmetric-details>
Type Specifiers
This part of the complex algorithm specifier is required, fr fr β you can't skip it. The remaining scheme and symmetric details will default based on the type you specified and the type of the object being created. Here's the whole roster:
aesβ Default AES:aes128aes128<mode>β 128 bit AES with optional mode (ctr|ofb|cbc|cfb|ecb). If mode is not specified, defaults tonull.aes192<mode>β Same asaes128<mode>, except for a 192 bit key size.aes256<mode>β Same asaes128<mode>, except for a 256 bit key size.sm4β Default SM4:sm4128sm4128orsm4_128 <mode>β 128 bit SM4 with optional mode (ctr|ofb|cbc|cfb|ecb). If mode is not specified, defaults tonull.eccβ Elliptical Curve, defaults toecc256.ecc192orecc_nist_p192β 192 bit ECC NIST curveecc224orecc_nist_p224β 224 bit ECC NIST curveecc256orecc_nist_p256β 256 bit ECC NIST curveecc384orecc_nist_p384β 384 bit ECC NIST curveecc521orecc_nist_p521β 521 bit ECC NIST curveecc_sm2orecc_sm2_p256β 256 bit SM2 curversaβ Default RSA:rsa2048rsa1024β RSA with 1024 bit keysize.rsa2048β RSA with 2048 bit keysize.rsa3072β RSA with 3072 bit keysize.rsa4096β RSA with 4096 bit keysize.
Scheme Specifiers
Next up is an optional field β you can absolutely skip it, no pressure π«Ά
Schemes are usually Signing Schemes or Asymmetric Encryption Schemes. Most signing schemes take a hash algorithm directly following the signing scheme. If the hash algorithm is missing, it defaults to sha256. Some take no arguments, and some take multiple arguments. Chaotic, but we deal.
Hash Optional Scheme Specifiers
These scheme specifiers get followed by a dash and a valid hash algorithm. For example: oaep-sha256.
oaepecdhrsassarsapssecdsaecschnorrsm2
Multiple Option Scheme Specifiers
This scheme specifier is followed by a count (max size UINT16), then followed by a dash (-) and a valid hash algorithm.
ecdaa
For example, ecdaa4-sha256. If no count is specified, it defaults to 4.
No Option Scheme Specifiers
This scheme specifier takes NO arguments. Like, zero. None.
rsaes
Symmetric Details Specifiers
This field is optional, and defaults based on the type of object being created and it's attributes. Generally, any valid Symmetric specifier from the Type Specifiers list should work. If it's not specified, an asymmetric object's symmetric details defaults to aes128cfb.
Examples
Create an rsa2048 key with an rsaes asymmetric encryption scheme
tpm2_create -C parent.ctx -G rsa2048:rsaes -u key.pub -r key.priv
Create an ecc256 key with an ecdaa signing scheme with a count of 4 and a sha384 hash
/tpm2_create -C parent.ctx -G ecc256:ecdaa4-sha384 -u key.pub -r key.priv
Yes bestie, that leading / is literally what the page says π copying it exactly, periodt.
π¦ EXAMPLES
Display all PCR values
tpm2_pcrread
Display the PCR values with a specified bank
tpm2_pcrread sha1
Display the PCR values with specified banks and store in a file
tpm2_pcrread -o pcrs sha1:16,17,18+sha256:16,17,18
Display the supported PCR bank algorithms and exit
tpm2_pcrread
π NOTES
The maximum number of PCR that can be dumped at once is associated with the maximum length of a bank.
On most TPMs, it means that this tool can dump up to 24 PCRs at once. So like, don't come for it when your giant list gets capped at 24 β that's just the vibe check the hardware is giving you π
β Returns
Tools can return any of the following codes:
0β Success. We love to see it π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 β that's where the bugs live, bestie.
π HELP
See the Mailing List β the elders are there and they know things π«Ά
π License
This work is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
<div align=βcenterβ>
β¨ that's the whole page, you're so smart β¨
</div>
And for the cute sign-off: this gem is from the tpm2-tools package, page tpm2_pcrread(1) β that's literally all the footer says, no date in sight, which honestly? iconic. Go read those PCRs, main character ππ
π¦ 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