From 2dc6d97e1edd50634fa9f3dba4746d77cb1b9328 Mon Sep 17 00:00:00 2001 From: Miquel Raynal Date: Tue, 15 May 2018 11:57:13 +0200 Subject: tpm: add TPM2_SelfTest command support Add support for the TPM2_Selftest command. Change the command file and the help accordingly. Signed-off-by: Miquel Raynal Reviewed-by: Simon Glass Reviewed-by: Tom Rini --- lib/tpm-v2.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib') diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c index 1a81177f75..a317e03607 100644 --- a/lib/tpm-v2.c +++ b/lib/tpm-v2.c @@ -30,3 +30,15 @@ u32 tpm2_startup(enum tpm2_startup_types mode) return 0; } + +u32 tpm2_self_test(enum tpm2_yes_no full_test) +{ + const u8 command_v2[12] = { + tpm_u16(TPM2_ST_NO_SESSIONS), + tpm_u32(11), + tpm_u32(TPM2_CC_SELF_TEST), + full_test, + }; + + return tpm_sendrecv_command(command_v2, NULL, NULL); +} -- cgit v1.2.3