tpm2-totp(3) tpm2-totp tpm2-totp(3) NAME tpm2-totp - libtpm2-totp 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 Attest the trustworthiness of a device against a human using time-based one-time passwords. Function Documentation int tpm2totp_calculate (const uint8_t * keyBlob, size_t keyBlob_size, TSS2_TCTI_CONTEXT * tcti_context, time_t * nowp, uint64_t * otp) Calculate a time-based one-time password for a key. 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. int tpm2totp_deleteKey_nv (uint32_t nv, TSS2_TCTI_CONTEXT * tcti_context) Delete a key from a NV index. 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. 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) Generate a key. 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. 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) Recover a secret from a key. 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. int tpm2totp_loadKey_nv (uint32_t nv, TSS2_TCTI_CONTEXT * tcti_context, uint8_t ** keyBlob, size_t * keyBlob_size) Load a key from a NV index. 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. 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) Reseal a key to new PCR values. 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. int tpm2totp_storeKey_nv (const uint8_t * keyBlob, size_t keyBlob_size, uint32_t nv, TSS2_TCTI_CONTEXT * tcti_context) Store a key in a NV index. 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. Version 0.3.0 Sun Sep 13 2020 tpm2-totp(3)