tpm2-totp(3)

๐Ÿ“ฆ
version 20240326.33e1986 ยท 2 versions
, in opensuse-leap 16.0

๐Ÿ’– tpm2-totp(3) โ€” Library Functions Manual ๐Ÿ’–

๐ŸŒธ NAME ๐ŸŒธ

tpm2-totp โ€” libtpm2-totp, bestie. Thatโ€™s the name drop, and itโ€™s lowkey iconic.

โœจ SYNOPSIS โœจ

๐ŸŽ€ Functions ๐ŸŽ€

int tpm2totp_generateKey (uint32_t pcrs, uint32_t banks, const char *password, TSS2_TCTI_CONTEXT *tcti_context, uint8_t **secret, size_t *secret_size, uint8_t **keyBlob, size_t *keyBlob_size)
int tpm2totp_reseal (const uint8_t *keyBlob, size_t keyBlob_size, const char *password, uint32_t pcrs, uint32_t banks, TSS2_TCTI_CONTEXT *tcti_context, uint8_t **newBlob, size_t *newBlob_size)
int tpm2totp_storeKey_nv (const uint8_t *keyBlob, size_t keyBlob_size, uint32_t nv, TSS2_TCTI_CONTEXT *tcti_context)
int tpm2totp_loadKey_nv (uint32_t nv, TSS2_TCTI_CONTEXT *tcti_context, uint8_t **keyBlob, size_t *keyBlob_size)
int tpm2totp_deleteKey_nv (uint32_t nv, TSS2_TCTI_CONTEXT *tcti_context)
int tpm2totp_calculate (const uint8_t *keyBlob, size_t keyBlob_size, TSS2_TCTI_CONTEXT *tcti_context, time_t *nowp, uint64_t *otp)
int tpm2totp_getSecret (const uint8_t *keyBlob, size_t keyBlob_size, const char *password, TSS2_TCTI_CONTEXT *tcti_context, uint8_t **secret, size_t *secret_size)

๐Ÿฆ‹ Detailed Description ๐Ÿฆ‹

The whole flex: attest the trustworthiness of a device against a human using time-based one-time passwords. Thatโ€™s the vibe, and honestly it eats.


๐Ÿ’… Function Documentation ๐Ÿ’…

๐Ÿงฎ tpm2totp_calculate

int tpm2totp_calculate (const uint8_t * keyBlob, size_t keyBlob_size, TSS2_TCTI_CONTEXT * tcti_context, time_t * nowp, uint64_t * otp)

Calculates a time-based one-time password for a key. Very main character of it.

Parameters

  • keyBlob โ€” Key to generate the TOTP.
  • keyBlob_size โ€” Size of the key.
  • tcti_context โ€” Optional TCTI context to select TPM to use.
  • nowp โ€” Current time.
  • otp โ€” Calculated TOTP.

Return values

  • 0 on success.
  • -1 on undefined/general failure.
  • TSS2_RC response code for failures relayed from the TSS library.

๐Ÿ—‘๏ธ tpm2totp_deleteKey_nv

int tpm2totp_deleteKey_nv (uint32_t nv, TSS2_TCTI_CONTEXT * tcti_context)

Deletes a key from a NV index. Bye-bye, key.

Parameters

  • nv โ€” NV index to delete.
  • tcti_context โ€” Optional TCTI context to select TPM to use.

Return values

  • 0 on success.
  • -1 on undefined/general failure.
  • TSS2_RC response code for failures relayed from the TSS library.

๐Ÿ”‘ tpm2totp_generateKey

int tpm2totp_generateKey (uint32_t pcrs, uint32_t banks, const char * password, TSS2_TCTI_CONTEXT * tcti_context, uint8_t ** secret, size_t * secret_size, uint8_t ** keyBlob, size_t * keyBlob_size)

Generates a key. Fresh key, fresh vibes.

Parameters

  • pcrs โ€” PCRs the key should be sealed against.
  • banks โ€” PCR banks the key should be sealed against.
  • password โ€” Optional password to recover or reseal the secret.
  • tcti_context โ€” Optional TCTI context to select TPM to use.
  • secret โ€” Generated secret.
  • secret_size โ€” Size of the secret.
  • keyBlob โ€” Generated key.
  • keyBlob_size โ€” Size of the generated key.

Return values

  • 0 on success.
  • -1 on undefined/general failure.
  • TSS2_RC response code for failures relayed from the TSS library.

๐Ÿ•ต๏ธ tpm2totp_getSecret

int tpm2totp_getSecret (const uint8_t * keyBlob, size_t keyBlob_size, const char * password, TSS2_TCTI_CONTEXT * tcti_context, uint8_t ** secret, size_t * secret_size)

Recovers a secret from a key. The secret is giving โ€œIโ€™m backโ€ energy.

Parameters

  • keyBlob โ€” Key to recover the secret from.
  • keyBlob_size โ€” Size of the key.
  • password โ€” Password of the key.
  • tcti_context โ€” Optional TCTI context to select TPM to use.
  • secret โ€” Recovered secret.
  • secret_size โ€” Size of the secret.

Return values

  • 0 on success.
  • -1 on undefined/general failure.
  • -10 on empty password.
  • -20 when no password-protected recovery copy of the secret has been stored.
  • TSS2_RC response code for failures relayed from the TSS library.

๐Ÿ“ฆ tpm2totp_loadKey_nv

int tpm2totp_loadKey_nv (uint32_t nv, TSS2_TCTI_CONTEXT * tcti_context, uint8_t ** keyBlob, size_t * keyBlob_size)

Loads a key from a NV index. Fetching the key like itโ€™s a group-chat screenshot.

Parameters

  • nv โ€” NV index of the key.
  • tcti_context โ€” Optional TCTI context to select TPM to use.
  • keyBlob โ€” Loaded key.
  • keyBlob_size โ€” Size of the key.

Return values

  • 0 on success.
  • -1 on undefined/general failure.
  • TSS2_RC response code for failures relayed from the TSS library.

๐Ÿ” tpm2totp_reseal

int tpm2totp_reseal (const uint8_t * keyBlob, size_t keyBlob_size, const char * password, uint32_t pcrs, uint32_t banks, TSS2_TCTI_CONTEXT * tcti_context, uint8_t ** newBlob, size_t * newBlob_size)

Reseals a key to new PCR values. Glow-up for your key, fr fr.

Parameters

  • keyBlob โ€” Original key.
  • keyBlob_size โ€” Size of the key.
  • password โ€” Password of the key.
  • pcrs โ€” PCRs the key should be sealed against.
  • banks โ€” PCR banks the key should be sealed against.
  • tcti_context โ€” Optional TCTI context to select TPM to use.
  • newBlob โ€” New key.
  • newBlob_size โ€” Size of the new key.

Return values

  • 0 on success.
  • -1 on undefined/general failure.
  • -10 on empty password.
  • -20 when no password-protected recovery copy of the secret has been stored.
  • TSS2_RC response code for failures relayed from the TSS library.

๐Ÿ’พ tpm2totp_storeKey_nv

int tpm2totp_storeKey_nv (const uint8_t * keyBlob, size_t keyBlob_size, uint32_t nv, TSS2_TCTI_CONTEXT * tcti_context)

Stores a key in a NV index. Putting it in NVRAM like itโ€™s the notes app.

Parameters

  • keyBlob โ€” Key to store to NVRAM.
  • keyBlob_size โ€” Size of the key.
  • nv โ€” NV index to store the key.
  • tcti_context โ€” Optional TCTI context to select TPM to use.

Return values

  • 0 on success.
  • -1 on undefined/general failure.
  • TSS2_RC response code for failures relayed from the TSS library.

๐Ÿซถ Author ๐Ÿซถ

Generated automatically by Doxygen for tpm2-totp from the source code. So not me, bestie โ€” Doxygen took the aux. ๐Ÿ’…


okay bye bestie ๐Ÿ’– this page is from tpm2-totp, version 20240326.33e1986 (yes, that date-ish version in the footer), and the footer page stamp is tpm2-totp(3). slay.

๐Ÿ“ฆ where this page comes from