aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDhananjay Phadke <dphadke@linux.microsoft.com>2020-06-04 16:43:59 -0700
committerTom Rini <trini@konsulko.com>2020-07-08 15:38:32 -0400
commit06bea4980980c05106944b0192f24700fe479f0b (patch)
tree0feb96f70938679a0660d432605521ffbaf36078 /include
parent78cc3fcf089b8fcaa4d9f21fcd1728bb32d9f5b7 (diff)
downloadu-boot-06bea4980980c05106944b0192f24700fe479f0b.zip
u-boot-06bea4980980c05106944b0192f24700fe479f0b.tar.gz
u-boot-06bea4980980c05106944b0192f24700fe479f0b.tar.bz2
tpm: add TPM2_GetRandom command support
Add support for TPM2 GetRandom command Signed-off-by: Dhananjay Phadke <dphadke@linux.microsoft.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/tpm-v2.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/tpm-v2.h b/include/tpm-v2.h
index d53d2e4..f6c045d 100644
--- a/include/tpm-v2.h
+++ b/include/tpm-v2.h
@@ -70,6 +70,7 @@ enum tpm2_handles {
* @TPM2_CC_DAM_RESET: TPM2_DictionaryAttackLockReset().
* @TPM2_CC_DAM_PARAMETERS: TPM2_DictionaryAttackParameters().
* @TPM2_CC_GET_CAPABILITY: TPM2_GetCapibility().
+ * @TPM2_CC_GET_RANDOM: TPM2_GetRandom().
* @TPM2_CC_PCR_READ: TPM2_PCR_Read().
* @TPM2_CC_PCR_EXTEND: TPM2_PCR_Extend().
* @TPM2_CC_PCR_SETAUTHVAL: TPM2_PCR_SetAuthValue().
@@ -85,6 +86,7 @@ enum tpm2_command_codes {
TPM2_CC_DAM_PARAMETERS = 0x013A,
TPM2_CC_NV_READ = 0x014E,
TPM2_CC_GET_CAPABILITY = 0x017A,
+ TPM2_CC_GET_RANDOM = 0x017B,
TPM2_CC_PCR_READ = 0x017E,
TPM2_CC_PCR_EXTEND = 0x0182,
TPM2_CC_PCR_SETAUTHVAL = 0x0183,
@@ -339,4 +341,15 @@ u32 tpm2_pcr_setauthvalue(struct udevice *dev, const char *pw,
const ssize_t pw_sz, u32 index, const char *key,
const ssize_t key_sz);
+/**
+ * Issue a TPM2_GetRandom command.
+ *
+ * @dev TPM device
+ * @param data output buffer for the random bytes
+ * @param count size of output buffer
+ *
+ * @return return code of the operation
+ */
+u32 tpm2_get_random(struct udevice *dev, void *data, u32 count);
+
#endif /* __TPM_V2_H */