Index: src/tlcl/generator.c |
diff --git a/src/tlcl/generator.c b/src/tlcl/generator.c |
index 4a9e89d2d370afcc2d18c22f36cd12c80645f3d1..f5ad7ad6200868f172a212fe88b328032ffa4857 100644 |
--- a/src/tlcl/generator.c |
+++ b/src/tlcl/generator.c |
@@ -252,14 +252,14 @@ Command* BuildExtendCommand(void) { |
return cmd; |
} |
-Command* BuildGetCapabilityCommand(void) { |
+Command* BuildGetFlagsCommand(void) { |
int size = (kTpmRequestHeaderLength + |
sizeof(TPM_CAPABILITY_AREA) + /* capArea */ |
sizeof(uint32_t) + /* subCapSize */ |
- sizeof(uint32_t)); /* subCap */ |
+ sizeof(uint32_t)); /* subCap */ |
Command* cmd = newCommand(TPM_ORD_GetCapability, size); |
- cmd->name = "tpm_getcapability_cmd"; |
+ cmd->name = "tpm_getflags_cmd"; |
AddInitializedField(cmd, kTpmRequestHeaderLength, |
sizeof(TPM_CAPABILITY_AREA), TPM_CAP_FLAG); |
AddInitializedField(cmd, kTpmRequestHeaderLength + |
@@ -271,6 +271,24 @@ Command* BuildGetCapabilityCommand(void) { |
return cmd; |
} |
+Command* BuildGetPermissionsCommand(void) { |
+ int size = (kTpmRequestHeaderLength + |
+ sizeof(TPM_CAPABILITY_AREA) + /* capArea */ |
+ sizeof(uint32_t) + /* subCapSize */ |
+ sizeof(uint32_t)); /* subCap */ |
+ |
+ Command* cmd = newCommand(TPM_ORD_GetCapability, size); |
+ cmd->name = "tpm_getpermissions_cmd"; |
+ AddInitializedField(cmd, kTpmRequestHeaderLength, |
+ sizeof(TPM_CAPABILITY_AREA), TPM_CAP_NV_INDEX); |
+ AddInitializedField(cmd, kTpmRequestHeaderLength + |
+ sizeof(TPM_CAPABILITY_AREA), |
+ sizeof(uint32_t), sizeof(uint32_t)); |
+ AddVisibleField(cmd, "index", kTpmRequestHeaderLength + |
+ sizeof(TPM_CAPABILITY_AREA) + sizeof(uint32_t)); |
+ return cmd; |
+} |
+ |
/* Output the fields of a structure. |
*/ |
void OutputFields(Field* fld) { |
@@ -379,7 +397,8 @@ Command* (*builders[])(void) = { |
BuildForceClearCommand, |
BuildPhysicalEnableCommand, |
BuildPhysicalSetDeactivatedCommand, |
- BuildGetCapabilityCommand, |
+ BuildGetFlagsCommand, |
+ BuildGetPermissionsCommand, |
BuildExtendCommand, |
}; |
@@ -412,6 +431,10 @@ int main(void) { |
printf("/* This file is automatically generated */\n\n"); |
OutputCommands(commands); |
printf("const int kWriteInfoLength = %d;\n", (int) sizeof(TPM_WRITE_INFO)); |
+ printf("const int kNvDataPublicPermissionsOffset = %d;\n", |
+ (int) (offsetof(TPM_NV_DATA_PUBLIC, permission) + |
+ 2 * PCR_SELECTION_FIX + |
+ offsetof(TPM_NV_ATTRIBUTES, attributes))); |
FreeCommands(commands); |
return 0; |