[coreboot-gerrit] New patch to review for coreboot: tpm2: add TPM_Clear command processing
Martin Roth (martinroth@google.com)
gerrit at coreboot.org
Tue Jul 12 22:06:34 CEST 2016
Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15634
-gerrit
commit 6b9fe2840225ebb8a260d46479c9de57f323975f
Author: Vadim Bendebury <vbendeb at chromium.org>
Date: Thu Jun 30 20:50:49 2016 -0700
tpm2: add TPM_Clear command processing
The command is sent in session mode, but has no parameters associated
with it.
BRANCH=none
BUG=chrome-os-partner:50645
TEST=with the following patches verified that TPM_Clear command is
handled successfully by the TPM.
Change-Id: I3c9151e336084160acd3bb1f36f45b4d5efd4a33
Signed-off-by: Martin Roth <martinroth at chromium.org>
Original-Commit-Id: 503ad5e72fd5bd902325d74fd680c17c7c590e36
Original-Change-Id: Ida19e75166e1282732810cf45be21e59515d88e2
Original-Signed-off-by: Vadim Bendebury <vbendeb at chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/357973
Original-Reviewed-by: Aaron Durbin <adurbin at chromium.org>
---
src/lib/tpm2_marshaling.c | 14 ++++++++++++++
src/lib/tpm2_tlcl_structures.h | 1 +
2 files changed, 15 insertions(+)
diff --git a/src/lib/tpm2_marshaling.c b/src/lib/tpm2_marshaling.c
index 5aad276..9565aea 100644
--- a/src/lib/tpm2_marshaling.c
+++ b/src/lib/tpm2_marshaling.c
@@ -315,6 +315,15 @@ static void marshal_nv_read(void **buffer,
marshal_u16(buffer, command_body->offset, buffer_space);
}
+/* TPM2_Clear command does not require paramaters. */
+static void marshal_clear(void **buffer, size_t *buffer_space)
+{
+ const uint32_t handle[] = { TPM_RH_PLATFORM };
+
+ marshal_common_session_header(buffer, handle,
+ ARRAY_SIZE(handle), buffer_space);
+}
+
static void marshal_selftest(void **buffer,
struct tpm2_self_test *command_body,
size_t *buffer_space)
@@ -359,6 +368,10 @@ int tpm_marshal_command(TPM_CC command, void *tpm_command_body,
marshal_selftest(&cmd_body, tpm_command_body, &body_size);
break;
+ case TPM2_Clear:
+ marshal_clear(&cmd_body, &body_size);
+ break;
+
default:
body_size = 0;
printk(BIOS_INFO, "%s:%d:Request to marshal unsupported command %#x\n",
@@ -517,6 +530,7 @@ struct tpm2_response *tpm_unmarshal_response(TPM_CC command,
&tpm2_resp.nvr);
break;
+ case TPM2_Clear:
case TPM2_NV_DefineSpace:
case TPM2_NV_Write:
/* Session data included in response can be safely ignored. */
diff --git a/src/lib/tpm2_tlcl_structures.h b/src/lib/tpm2_tlcl_structures.h
index d05c564..8e51858 100644
--- a/src/lib/tpm2_tlcl_structures.h
+++ b/src/lib/tpm2_tlcl_structures.h
@@ -56,6 +56,7 @@ struct tpm_header {
} __attribute__((packed));
/* TPM command codes. */
+#define TPM2_Clear ((TPM_CC)0x00000126)
#define TPM2_NV_DefineSpace ((TPM_CC)0x0000012A)
#define TPM2_NV_Write ((TPM_CC)0x00000137)
#define TPM2_SelfTest ((TPM_CC)0x00000143)
More information about the coreboot-gerrit
mailing list