summaryrefslogtreecommitdiff
path: root/utility/tlcl_generator.c
diff options
context:
space:
mode:
authorMattias Nissler <mnissler@chromium.org>2017-12-08 14:13:25 +0100
committerMattias Nissler <mnissler@chromium.org>2018-04-13 10:03:34 +0000
commit2e62620ce740bff57b659905f3a4a929898834f6 (patch)
tree6ec38399fd040fe40b298f7e4acc6643acaa1ec4 /utility/tlcl_generator.c
parentbc5b2db15b93f37820574b8f14a1b2e165012403 (diff)
downloadvboot-2e62620ce740bff57b659905f3a4a929898834f6.tar.gz
tpm_lite: Support delegation family functionality.
Adds two new functions and their corresponding TPM commands to create delegation families and list the delegation family table, respectively. This isn't sufficient to meaningfully manage delegation families, but good enough for the (ab)use case of storing flags in delegation family labels, which we are going to do in order to strengthen encrypted stateful to guarantee recreation of the encrypted file system after TPM clear.. BRANCH=None BUG=chromium:788719 TEST=new unit tests Change-Id: I31beb662784a8fff450b485c7cabc553944d7772 Reviewed-on: https://chromium-review.googlesource.com/817199 Trybot-Ready: Mattias Nissler <mnissler@chromium.org> Tested-by: Mattias Nissler <mnissler@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
Diffstat (limited to 'utility/tlcl_generator.c')
-rw-r--r--utility/tlcl_generator.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/utility/tlcl_generator.c b/utility/tlcl_generator.c
index bb3301f0..c545bed1 100644
--- a/utility/tlcl_generator.c
+++ b/utility/tlcl_generator.c
@@ -495,6 +495,28 @@ Command* BuildTakeOwnershipCommand(void) {
return cmd;
}
+Command* BuildCreateDelegationFamilyCommand(void) {
+ int size = kTpmRequestHeaderLength + 3 * sizeof(uint32_t) + sizeof(uint8_t);
+ Command* cmd = newCommand(TPM_ORD_Delegate_Manage, size);
+ cmd->name = "tpm_create_delegation_family_cmd";
+ AddInitializedField(cmd, kTpmRequestHeaderLength, sizeof(uint32_t),
+ 0 /* familyID */);
+ AddInitializedField(cmd, kTpmRequestHeaderLength + sizeof(uint32_t),
+ sizeof(uint32_t), TPM_FAMILY_CREATE);
+ AddInitializedField(cmd, kTpmRequestHeaderLength + 2 * sizeof(uint32_t),
+ sizeof(uint32_t), sizeof(uint8_t) /* opDataSize */);
+ AddVisibleField(cmd, "familyLabel",
+ kTpmRequestHeaderLength + 3 * sizeof(uint32_t));
+ return cmd;
+}
+
+Command* BuildReadDelegationFamilyTableCommand(void) {
+ Command* cmd =
+ newCommand(TPM_ORD_Delegate_ReadTable, kTpmRequestHeaderLength);
+ cmd->name = "tpm_delegate_read_table_cmd";
+ return cmd;
+}
+
/* Output the fields of a structure.
*/
void OutputFields(Field* fld) {
@@ -621,6 +643,8 @@ Command* (*builders[])(void) = {
BuildOIAPCommand,
BuildOSAPCommand,
BuildTakeOwnershipCommand,
+ BuildCreateDelegationFamilyCommand,
+ BuildReadDelegationFamilyTableCommand,
};
static void FreeFields(Field* fld) {