.TH "tpm2-totp" 3 "Sun Sep 13 2020" "Version 0.3.0" "tpm2-totp" \" -*- nroff -*- .ad l .nh .SH NAME tpm2-totp \- libtpm2-totp .SH SYNOPSIS .br .PP .SS "Functions" .in +1c .ti -1c .RI "int \fBtpm2totp_generateKey\fP (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)" .br .ti -1c .RI "int \fBtpm2totp_reseal\fP (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)" .br .ti -1c .RI "int \fBtpm2totp_storeKey_nv\fP (const uint8_t *keyBlob, size_t keyBlob_size, uint32_t nv, TSS2_TCTI_CONTEXT *tcti_context)" .br .ti -1c .RI "int \fBtpm2totp_loadKey_nv\fP (uint32_t nv, TSS2_TCTI_CONTEXT *tcti_context, uint8_t **keyBlob, size_t *keyBlob_size)" .br .ti -1c .RI "int \fBtpm2totp_deleteKey_nv\fP (uint32_t nv, TSS2_TCTI_CONTEXT *tcti_context)" .br .ti -1c .RI "int \fBtpm2totp_calculate\fP (const uint8_t *keyBlob, size_t keyBlob_size, TSS2_TCTI_CONTEXT *tcti_context, time_t *nowp, uint64_t *otp)" .br .ti -1c .RI "int \fBtpm2totp_getSecret\fP (const uint8_t *keyBlob, size_t keyBlob_size, const char *password, TSS2_TCTI_CONTEXT *tcti_context, uint8_t **secret, size_t *secret_size)" .br .in -1c .SH "Detailed Description" .PP Attest the trustworthiness of a device against a human using time-based one-time passwords\&. .SH "Function Documentation" .PP .SS "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\&. .PP \fBParameters\fP .RS 4 \fIkeyBlob\fP Key to generate the TOTP\&. .br \fIkeyBlob_size\fP Size of the key\&. .br \fItcti_context\fP Optional TCTI context to select TPM to use\&. .br \fInowp\fP Current time\&. .br \fIotp\fP Calculated TOTP\&. .RE .PP \fBReturn values\fP .RS 4 \fI0\fP on success\&. .br \fI-1\fP on undefined/general failure\&. .br \fITSS2_RC\fP response code for failures relayed from the TSS library\&. .RE .PP .SS "int tpm2totp_deleteKey_nv (uint32_t nv, TSS2_TCTI_CONTEXT * tcti_context)" Delete a key from a NV index\&. .PP \fBParameters\fP .RS 4 \fInv\fP NV index to delete\&. .br \fItcti_context\fP Optional TCTI context to select TPM to use\&. .RE .PP \fBReturn values\fP .RS 4 \fI0\fP on success\&. .br \fI-1\fP on undefined/general failure\&. .br \fITSS2_RC\fP response code for failures relayed from the TSS library\&. .RE .PP .SS "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\&. .PP \fBParameters\fP .RS 4 \fIpcrs\fP PCRs the key should be sealed against\&. .br \fIbanks\fP PCR banks the key should be sealed against\&. .br \fIpassword\fP Optional password to recover or reseal the secret\&. .br \fItcti_context\fP Optional TCTI context to select TPM to use\&. .br \fIsecret\fP Generated secret\&. .br \fIsecret_size\fP Size of the secret\&. .br \fIkeyBlob\fP Generated key\&. .br \fIkeyBlob_size\fP Size of the generated key\&. .RE .PP \fBReturn values\fP .RS 4 \fI0\fP on success\&. .br \fI-1\fP on undefined/general failure\&. .br \fITSS2_RC\fP response code for failures relayed from the TSS library\&. .RE .PP .SS "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\&. .PP \fBParameters\fP .RS 4 \fIkeyBlob\fP Key to recover the secret from\&. .br \fIkeyBlob_size\fP Size of the key\&. .br \fIpassword\fP Password of the key\&. .br \fItcti_context\fP Optional TCTI context to select TPM to use\&. .br \fIsecret\fP Recovered secret\&. .br \fIsecret_size\fP Size of the secret\&. .RE .PP \fBReturn values\fP .RS 4 \fI0\fP on success\&. .br \fI-1\fP on undefined/general failure\&. .br \fI-10\fP on empty password\&. .br \fI-20\fP when no password-protected recovery copy of the secret has been stored\&. .br \fITSS2_RC\fP response code for failures relayed from the TSS library\&. .RE .PP .SS "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\&. .PP \fBParameters\fP .RS 4 \fInv\fP NV index of the key\&. .br \fItcti_context\fP Optional TCTI context to select TPM to use\&. .br \fIkeyBlob\fP Loaded key\&. .br \fIkeyBlob_size\fP Size of the key\&. .RE .PP \fBReturn values\fP .RS 4 \fI0\fP on success\&. .br \fI-1\fP on undefined/general failure\&. .br \fITSS2_RC\fP response code for failures relayed from the TSS library\&. .RE .PP .SS "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\&. .PP \fBParameters\fP .RS 4 \fIkeyBlob\fP Original key\&. .br \fIkeyBlob_size\fP Size of the key\&. .br \fIpassword\fP Password of the key\&. .br \fIpcrs\fP PCRs the key should be sealed against\&. .br \fIbanks\fP PCR banks the key should be sealed against\&. .br \fItcti_context\fP Optional TCTI context to select TPM to use\&. .br \fInewBlob\fP New key\&. .br \fInewBlob_size\fP Size of the new key\&. .RE .PP \fBReturn values\fP .RS 4 \fI0\fP on success\&. .br \fI-1\fP on undefined/general failure\&. .br \fI-10\fP on empty password\&. .br \fI-20\fP when no password-protected recovery copy of the secret has been stored\&. .br \fITSS2_RC\fP response code for failures relayed from the TSS library\&. .RE .PP .SS "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\&. .PP \fBParameters\fP .RS 4 \fIkeyBlob\fP Key to store to NVRAM\&. .br \fIkeyBlob_size\fP Size of the key\&. .br \fInv\fP NV index to store the key\&. .br \fItcti_context\fP Optional TCTI context to select TPM to use\&. .RE .PP \fBReturn values\fP .RS 4 \fI0\fP on success\&. .br \fI-1\fP on undefined/general failure\&. .br \fITSS2_RC\fP response code for failures relayed from the TSS library\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for tpm2-totp from the source code\&.