summaryrefslogtreecommitdiff
path: root/include/tpm-v2.h
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2018-05-15 11:57:20 +0200
committerTom Rini <trini@konsulko.com>2018-05-25 20:12:59 -0400
commitb9dd4fabbeed0fcb8bb1811044266d13df8d379f (patch)
tree10551c2cac00b17f6b62b5b605cacc0faf7dd625 /include/tpm-v2.h
parentdc26e913a8d1a62bd4112f41232e0273ee66423d (diff)
tpm: add PCR authentication commands support
Add support for the TPM2_PCR_SetAuthPolicy and TPM2_PCR_SetAuthValue commands. Change the command file and the help accordingly. Note: These commands could not be tested because the TPMs available do not support them, however they could be useful for someone else. The user is warned by the command help. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'include/tpm-v2.h')
-rw-r--r--include/tpm-v2.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/tpm-v2.h b/include/tpm-v2.h
index be1aa2c705..780e061975 100644
--- a/include/tpm-v2.h
+++ b/include/tpm-v2.h
@@ -80,11 +80,13 @@ enum tpm2_command_codes {
TPM2_CC_CLEAR = 0x0126,
TPM2_CC_CLEARCONTROL = 0x0127,
TPM2_CC_HIERCHANGEAUTH = 0x0129,
+ TPM2_CC_PCR_SETAUTHPOL = 0x012C,
TPM2_CC_DAM_RESET = 0x0139,
TPM2_CC_DAM_PARAMETERS = 0x013A,
TPM2_CC_GET_CAPABILITY = 0x017A,
TPM2_CC_PCR_READ = 0x017E,
TPM2_CC_PCR_EXTEND = 0x0182,
+ TPM2_CC_PCR_SETAUTHVAL = 0x0183,
};
/**
@@ -230,4 +232,31 @@ u32 tpm2_dam_parameters(const char *pw, const ssize_t pw_sz,
int tpm2_change_auth(u32 handle, const char *newpw, const ssize_t newpw_sz,
const char *oldpw, const ssize_t oldpw_sz);
+/**
+ * Issue a TPM_PCR_SetAuthPolicy command.
+ *
+ * @pw Platform password
+ * @pw_sz Length of the password
+ * @index Index of the PCR
+ * @digest New key to access the PCR
+ *
+ * @return code of the operation
+ */
+u32 tpm2_pcr_setauthpolicy(const char *pw, const ssize_t pw_sz, u32 index,
+ const char *key);
+
+/**
+ * Issue a TPM_PCR_SetAuthValue command.
+ *
+ * @pw Platform password
+ * @pw_sz Length of the password
+ * @index Index of the PCR
+ * @digest New key to access the PCR
+ * @key_sz Length of the new key
+ *
+ * @return code of the operation
+ */
+u32 tpm2_pcr_setauthvalue(const char *pw, const ssize_t pw_sz, u32 index,
+ const char *key, const ssize_t key_sz);
+
#endif /* __TPM_V2_H */