tpm2_checkquote(1)

๐Ÿ’– tpm2_checkquote(1) ๐Ÿ’–

okay so this is tpm2_checkquote(1) from the General Commands Manual, and it is literally the vibe-check tool for TPM quotes. bestie, we are validating, not generating. slay. โœจ

๐ŸŒธ NAME ๐ŸŒธ

tpm2_checkquote(1) โ€” Validates a quote provided by a TPM. periodt. ๐Ÿ‘‘

โšก SYNOPSIS โšก

tpm2_checkquote [OPTIONS]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

tpm2_checkquote(1) uses the public portion of the key you hand it to validate a quote generated by a TPM. it will validate the signature against the quote message and, if you provide them, verify that the qualifying data and PCR values match those in the quote. no cap, this is the whole plot. ๐Ÿซถ

the PCR values can be provided with or without the TPML_PCR_SELECTION information. an example of PCR values without the PCR selection information is the output from tpm2_pcrread. if a PCR value is specified without the PCR selection information, then the PCR selection string must be specified using the -l option to interpret the PCR data. iykyk, that -l is doing main character work. ๐Ÿ’…

โœจ OPTIONS โœจ

  • -u, --public=FILE โ€” file input for the public portion of the signature verification key. either the pem file or tss public format file. ๐Ÿ”‘
  • -g, --hash-algorithm=ALGORITHM โ€” the hash algorithm used to digest the message. ๐Ÿงฎ
  • -m, --message=FILE โ€” the quote message that makes up the data that is signed by the TPM. ๐Ÿ“œ
  • -s, --signature=FILE โ€” the input signature file of the signature to be validated. โœ๏ธ
  • -f, --pcr=FILE โ€” optional PCR input file to save the list of PCR values that were included in the quote. ๐Ÿงฌ
  • -l, --pcr-list=PCR โ€” the list of PCR banks and selected PCRsโ€™ ids for each bank. ๐Ÿฆ
  • -q, --qualification=HEX_STRING_OR_PATH โ€” qualification data for the quote. can either be a hex string or path. this is typically used to add a nonce against replay attacks. ๐Ÿ›ก๏ธ
  • -F, --pcrs_format=FORMAT โ€” format selection for the binary blob in the PCR output file. values will output a binary blob of the PCR values. serialized will write or read a binary blob of the PCR values in the form of serialized data structure in little endian format. marshaled will read or write a binary blob in the binary format used by the TSS2 marshaling and unmarshaling functions. if marshaled is used the data is serialized in the following order: TPML_PCR_SELECTION, UINT32 (the number of following TPML_DIGEST elements) TPML_DIGEST [number of TPML_DIGEST elements]. optional. if -l is provided normalized will be used. otherwise serialized is the default. ๐ŸŽ€

๐Ÿ“š References ๐Ÿ“š

the algorithm lore starts here, bestie ๐Ÿ‘‡

๐Ÿงฌ Algorithm Specifiers ๐Ÿงฌ

options that take algorithms support โ€œnice-namesโ€.

there are two major algorithm specification string classes, simple and complex. only certain algorithms will be accepted by the TPM, based on usage and conditions. ๐Ÿงš

๐ŸŒŸ Simple specifiers ๐ŸŒŸ

these are strings with no additional specification data. when creating objects, non-specified portions of an object are assumed to defaults. you can find the list of known โ€œSimple Specifiersโ€ below. ๐Ÿ’ซ

๐Ÿ”‘ Asymmetric ๐Ÿ”‘

  • rsa
  • ecc

๐Ÿงธ Symmetric ๐Ÿงธ

  • aes
  • camellia
  • sm4

๐Ÿงฎ Hashing Algorithms ๐Ÿงฎ

  • sha1
  • sha256
  • sha384
  • sha512
  • sm3_256
  • sha3_256
  • sha3_384
  • sha3_512

๐Ÿซง Keyed Hash ๐Ÿซง

  • hmac
  • xor

โœ๏ธ Signing Schemes โœ๏ธ

  • rsassa
  • rsapss
  • ecdsa
  • ecdaa
  • ecschnorr
  • sm2

๐Ÿ” Asymmetric Encryption Schemes ๐Ÿ”

  • oaep
  • rsaes
  • ecdh

๐Ÿ” Modes ๐Ÿ”

  • ctr
  • ofb
  • cbc
  • cfb
  • ecb

๐Ÿฆ‹ Misc ๐Ÿฆ‹

  • null

๐Ÿงฉ Complex Specifiers ๐Ÿงฉ

objects, when specified for creation by the TPM, have numerous algorithms to populate in the public data. things like type, scheme and asymmetric details, key size, etc. below is the general format for specifying this data: <type>:<scheme>:<symmetric-details>. ๐ŸŒˆ

๐Ÿท๏ธ Type Specifiers ๐Ÿท๏ธ

this portion of the complex algorithm specifier is required. the remaining scheme and symmetric details will default based on the type specified and the type of the object being created.

  • aes โ€” default AES: aes128
  • aes128<mode> โ€” 128 bit AES with optional mode (ctr|ofb|cbc|cfb|ecb). if mode is not specified, defaults to null.
  • aes192<mode> โ€” same as aes128<mode>, except for a 192 bit key size.
  • aes256<mode> โ€” same as aes128<mode>, except for a 256 bit key size.
  • sm4 โ€” default SM4: sm4128
  • sm4128 or sm4_128 <mode> โ€” 128 bit SM4 with optional mode (ctr|ofb|cbc|cfb|ecb). if mode is not specified, defaults to null.
  • ecc โ€” Elliptical Curve, defaults to ecc256.
  • ecc192 or ecc_nist_p192 โ€” 192 bit ECC NIST curve
  • ecc224 or ecc_nist_p224 โ€” 224 bit ECC NIST curve
  • ecc256 or ecc_nist_p256 โ€” 256 bit ECC NIST curve
  • ecc384 or ecc_nist_p384 โ€” 384 bit ECC NIST curve
  • ecc521 or ecc_nist_p521 โ€” 521 bit ECC NIST curve
  • ecc_sm2 or ecc_sm2_p256 โ€” 256 bit SM2 curve
  • rsa โ€” default RSA: rsa2048
  • rsa1024 โ€” 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, is an optional field, it can be skipped.

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. ๐Ÿ’…

๐ŸŒธ Hash Optional Scheme Specifiers ๐ŸŒธ

these scheme specifiers are followed by a dash and a valid hash algorithm. for example: oaep-sha256.

  • oaep
  • ecdh
  • rsassa
  • rsapss
  • ecdsa
  • ecschnorr
  • sm2

๐ŸŒ€ Multiple Option Scheme Specifiers ๐ŸŒ€

  • ecdaa โ€” this scheme specifier is followed by a count (max size UINT16) then followed by a dash(-) and a valid hash algorithm. for example, ecdaa4-sha256. if no count is specified, it defaults to 4.

๐Ÿšซ No Option Scheme Specifiers ๐Ÿšซ

  • rsaes โ€” this scheme specifier takes NO arguments.

๐Ÿงด Symmetric Details Specifiers ๐Ÿงด

this field is optional, and defaults based on the type of object being created and its attributes. generally, any valid Symmetric specifier from the Type Specifiers list should work. if not specified, an asymmetric objects 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 sha384 hash:

/tpm2_create -C parent.ctx -G ecc256:ecdaa4-sha384 -u key.pub -r
key.priv cryptographic algorithms ALGORITHM.

and yes, the source also has the exact text cryptographic algorithms ALGORITHM. hanging out there, so it stays. ๐Ÿ˜ญ

โœ’๏ธ Signature Format Specifiers โœ’๏ธ

format selection for the signature output file. tss (the default) will output a binary blob according to the TPM 2.0 specification and any potential compiler padding. the option plain will output the plain signature data as defined by the used cryptographic algorithm. signature FORMAT. ๐Ÿ–Š๏ธ

๐Ÿ› ๏ธ COMMON OPTIONS ๐Ÿ› ๏ธ

this collection of options are common to many programs and provide information that many users may expect. ๐Ÿซถ

  • -h, --help=[man|no-man] โ€” display the tools 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 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 if 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. ๐Ÿ
  • -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 to stdout. ๐Ÿคซ
  • -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 TPM2TOOLS_ENABLE_ERRATA is 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 variable TPM2TOOLS_AUTOFLUSH is set to yes or true. information many users may expect. ๐Ÿšฝ

๐Ÿ”Œ 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:

  1. the command line option -T or --tcti
  2. the environment variable: TPM2TOOLS_TCTI.

note: the command line option always overrides the environment variable. ๐Ÿ’ฏ

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 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โ€. ๐Ÿšซ

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. ๐Ÿงš

๐Ÿซถ TCTI OPTIONS ๐Ÿซถ

Okay so this lil' cluster of options is how you set up the various known TCTI modules that are out there โ€” think of it as picking which pipe your tool talks to the TPM through:

  • device โ€” for the device TCTI, you get to say exactly which TPM character device file the device TCTI should use. The default is /dev/tpm0, bestie, no notes.

Example: -T device:/dev/tpm0 or export TPM2TOOLS_TCTI=โ€œdevice:/dev/tpm0โ€

  • mssim โ€” for the mssim TCTI, you can specify the domain name or IP address and the port number that the simulator is using. The defaults are 127.0.0.1 and 2321, iconic behaviour honestly.

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 whole series of simple key value pairs separated by a , character. Each key and value string are separated by a = character. Slay, very parseable.
    • The TCTI abrmd supports two keys, and yes there are exactly two:
      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. the various known TCTI modules.

โœจ EXAMPLES โœจ

๐Ÿ’… Generate a quote with a TPM, then verify it

This is the whole main character arc right here โ€” make the quote, then vibe check it:

tpm2_createek -c 0x81010001 -G rsa -u ekpub.pem -f pem

tpm2_createak -C 0x81010001 -c ak.ctx -G rsa -s rsassa -g sha256 \
-u akpub.pem -f pem -n ak.name

tpm2_quote -c ak.ctx -l sha256:15,16,22 -q abc123 -m quote.msg -s quote.sig \
  -o quote.pcrs -g sha256

tpm2_checkquote -u akpub.pem -m quote.msg -s quote.sig -f quote.pcrs -g sha256 \
  -q abc123

๐ŸŒˆ Returns ๐ŸŒˆ

Tools can return any of the following codes, and ngl you should lowkey memorise them:

  • 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 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).


That's the whole page, bestie โ€” go forth and verify those quotes ๐ŸŽ€

Signed, sealed, delivered: tpm2-tools, page tpm2_checkquote(1) โ€” that's the source and the version tag living right there in the footer, periodt. ๐Ÿ’œ

๐Ÿ“ฆ where this page comes from