tpm2_clockrateadjust(1)

πŸŽ€ tpm2_clockrateadjust β€” from the General Commands Manual, bestie edition πŸŽ€

okay so first things first: you're reading the manual page for tpm2_clockrateadjust(1) πŸ’… it lives in the General Commands Manual, and it is genuinely about making your TPM's internal clock stop being so dramatic and start matching real time. let's get into it 🫢


✨ NAME ✨

tpm2_clockrateadjust(1) β€” Sets the clock rate period on the TPM. that's it, that's the whole vibe. πŸ•°οΈ


✨ SYNOPSIS ✨

tpm2_clockrateadjust [OPTIONS] ADJUSTER

✨ DESCRIPTION ✨

tpm2_clockrateadjust(1) adjusts the rate at which clock and time are updated on the TPM, so you can better match real time 🌸 like, the TPM has its own little sense of time and sometimes it needs a nudge to line up with actual reality, no cap.

With no argument, the command is invoked but the clock rate is not altered. zero changes, we're just vibing 😌

With an argument, the tool will adjust the clock and time period. and it can either increase or decrease the clock period via 3 distinct granularities: course, medium and fine ⭐ to specify this, the argument can be a string of 1 to 3 characters of all s or all f.

fr fr: all s or all f, no mixing. don't try to be cute with it πŸ™ˆ

πŸ’– Valid Adjuster Arguments πŸ’–

  • s β€” slows down the clock period one fine increment.
  • ss β€” slows down the clock period one medium increment.
  • sss β€” slows down the clock period one course increment.
  • f β€” speeds up the clock period one fine increment.
  • ff β€” speeds up the clock period one medium increment.
  • fff β€” speeds up the clock period one course increment.

so like, s is a little nudge slower, sss is a big ol' slide slower, and f through fff are the same deal but faster πŸ”₯ iconic.


✨ OPTIONS ✨

  • -c, --hierarchy=OBJECT β€” the hierarchy to use for authorization, either platform or owner. defaults to the owner hierarchy if you don't specify one πŸ‘‘
  • -p, --auth=AUTH β€” specifies the authorization value for the hierarchy specified by option -c πŸ”
  • --cphash=FILE β€” file path to record the hash of the command parameters. this is commonly termed as cpHash. ⚠️ NOTE: when this option is selected, the tool will not actually execute the command, it simply returns a cpHash. so like, don't expect any actual clock adjusting to happen, bestie 😭 it's giving "look but don't touch".

🌈 References 🌈

πŸ¦‹ Context Object Format πŸ¦‹

The type of a context object β€” whether it's a handle or a file name β€” is determined according to the following logic, in-order:

  • If the argument is a file path, then the file is loaded as a restored TPM transient object. πŸ“‚
  • If the argument is a prefix match on one of:
    • owner: the owner hierarchy
    • platform: the platform hierarchy
    • endorsement: the endorsement hierarchy
    • lockout: the lockout control persistent object
  • If the argument can be loaded as a number it will be treated as a handle, e.g. 0x81010013 and used directly._OBJECT_. πŸ’€

🧚 Authorization Formatting 🧚

Authorization for use of an object in TPM2.0 can come in 3 different forms:

  1. Password
  2. HMAC
  3. Sessions
NOTE: "Authorizations default to the EMPTY PASSWORD when not specified". πŸ«₯

For authentication with auth values, the tool commands implicitly generate an HMAC session. thus passwords are not transmitted unencrypted. πŸ”’ this does not apply to passwords defined for objects. in that case, an HMAC session should be used (see tpm2_startauthsession(1)).

πŸ’œ Passwords πŸ’œ

Passwords are interpreted in the following forms below using prefix identifiers.

Note: by default passwords are assumed to be in the string form when they do not have a prefix.

πŸ“ String πŸ“

A string password, specified by prefix str: or its absence (raw string without prefix) is not interpreted, and is directly used for authorization.

Examples:

foobar
str:foobar

πŸ“ Hex-string πŸ“

A hex-string password, specified by prefix hex:, is converted from a hexidecimal form into a byte array form, thus allowing passwords with non-printable and/or terminal un-friendly characters ✨ perfect for the chaotic gays.

Example:

hex:1122334455667788

πŸ“ File πŸ“

A file based password, specified by prefix file:, should be the path of a file containing the password to be read by the tool β€” or a - to use stdin. storing passwords in files prevents information leakage; passwords passed as options can be read from the process list or common shell history features πŸ‘€ stay safe out there.

Examples:

# to use stdin and be prompted
file:-

# to use a file from a path
file:path/to/password/file

# to echo a password via stdin:
echo foobar | tpm2_tool -p file:-

# to use a bash here-string via stdin:

tpm2_tool -p file:- <<< foobar

πŸ“ Sessions πŸ“

When using a policy session to authorize the use of an object, prefix the option argument with the session keyword. then indicate a path to a session file that was created with tpm2_startauthsession(1). optionally, if the session requires an auth value to be sent with the session handle (eg policy password), then append a + and a string as described in the Passwords section.

Examples β€” to use a session context file called session.ctx:

session:session.ctx

To use a session context file called session.ctx AND send the authvalue mypassword:

session:session.ctx+mypassword

To use a session context file called session.ctx AND send the HEX authvalue 0x11223344:

session:session.ctx+hex:11223344

πŸ“ PCR Authorizations πŸ“

You can satisfy a PCR policy using the pcr: prefix and the PCR minilanguage. the PCR minilanguage is as follows:

<pcr-spec>=<raw-pcr-file>

The PCR spec is documented in the section "PCR bank specifiers". πŸ“‹

The raw-pcr-file is an optional argument that contains the output of the raw PCR contents as returned by tpm2_pcrread(1).

PCR bank specifiers

πŸ“ Examples πŸ“

To satisfy a PCR policy of sha256 on banks 0, 1, 2 and 3, use a specifier of:

pcr:sha256:0,1,2,3

specifying AUTH. πŸ”‘


✨ COMMON OPTIONS ✨

This collection of options are common to many programs and provide information that many users may expect 🫢 like the shared group-chat of options, iykyk.

  • -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 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. 🏷️
  • -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 🌐 like different roads to the same destination, vibe check passed.

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. no cap, CLI wins πŸ’…

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". πŸ’€ like, exactly. 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 πŸŽ€

🌸 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 ✨

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 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.
    • 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. the various known TCTI modules. πŸŽ€

✨ EXAMPLES ✨

Set the clock

Slow the clock down by one medium increment, using the owner password. Slay, gentle vibes only:

tpm2_clockrateadjust -p ownerpw ss

Speed the clock up by one course increment, but this time we're using the platform password β€” main character energy, platform edition:

tpm2_clockrateadjust -c p -p platformpw fff

πŸ’€ Returns

bestie, this tool can hand you back any of these codes, so vibe check your exit status fr fr:

  • 0 β€” Success. We ate. πŸ’…
  • 1 β€” General non-specific error. Like, something went wrong but nobody's saying what 😭
  • 2 β€” Options handling error. You fumbled the flags, it happens 🫢
  • 3 β€” Authentication error. Wrong password energy, not iconic πŸ™ˆ
  • 4 β€” TCTI related error. The transport layer said nope 🌸
  • 5 β€” Non supported scheme. Applicable to tpm2_testparams. πŸ’€

πŸ› BUGS

Found a bug? Github Issues. That's literally where they live, go tell them πŸ¦‹


πŸ†˜ HELP

Need a hand? See the Mailing List. The community is right there waiting for you πŸŽ€


πŸ“œ License

This work is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0). That's the whole license, no cap ✨


okay that's the whole page bestie, you're officially a clock-rate-adjusting icon πŸ‘‘ this little number comes to you courtesy of tpm2-tools, page tpm2_clockrateadjust(1) β€” check the date in the footer if you're curious, mwah πŸ’–

πŸ“¦ where this page comes from