Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1137)

Unified Diff: src/tlcl/generator.c

Issue 2719006: Added TPM command to read space permissions, and a correctness test. (Closed) Base URL: ssh://git@chromiumos-git/tpm_lite.git
Patch Set: Alphabetize. Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/testsuite/spaceperm.c ('k') | src/tlcl/tlcl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/testsuite/spaceperm.c ('k') | src/tlcl/tlcl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698