| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 /* This program generates partially filled TPM datagrams and other compile-time | 6 /* This program generates partially filled TPM datagrams and other compile-time |
| 7 * constants (e.g. structure sizes and offsets). Compile this file---and ONLY | 7 * constants (e.g. structure sizes and offsets). Compile this file---and ONLY |
| 8 * this file---with -fpack-struct. We take advantage of the fact that the | 8 * this file---with -fpack-struct. We take advantage of the fact that the |
| 9 * (packed) TPM structures layout (mostly) match the TPM request and response | 9 * (packed) TPM structures layout (mostly) match the TPM request and response |
| 10 * datagram layout. When they don't completely match, some fixing is necessary | 10 * datagram layout. When they don't completely match, some fixing is necessary |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 int size = kTpmRequestHeaderLength + sizeof(TPM_PHYSICAL_PRESENCE); | 206 int size = kTpmRequestHeaderLength + sizeof(TPM_PHYSICAL_PRESENCE); |
| 207 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); | 207 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); |
| 208 cmd->name = "tpm_pplock_cmd"; | 208 cmd->name = "tpm_pplock_cmd"; |
| 209 AddInitializedField(cmd, kTpmRequestHeaderLength, | 209 AddInitializedField(cmd, kTpmRequestHeaderLength, |
| 210 sizeof(TPM_PHYSICAL_PRESENCE), | 210 sizeof(TPM_PHYSICAL_PRESENCE), |
| 211 TPM_PHYSICAL_PRESENCE_LOCK); | 211 TPM_PHYSICAL_PRESENCE_LOCK); |
| 212 return cmd; | 212 return cmd; |
| 213 } | 213 } |
| 214 | 214 |
| 215 Command* BuildStartupCommand(void) { | 215 Command* BuildStartupCommand(void) { |
| 216 int size = kTpmRequestHeaderLength + sizeof(TPM_PHYSICAL_PRESENCE); | 216 int size = kTpmRequestHeaderLength + sizeof(TPM_STARTUP_TYPE); |
| 217 Command* cmd = newCommand(TPM_ORD_Startup, size); | 217 Command* cmd = newCommand(TPM_ORD_Startup, size); |
| 218 cmd->name = "tpm_startup_cmd"; | 218 cmd->name = "tpm_startup_cmd"; |
| 219 AddInitializedField(cmd, kTpmRequestHeaderLength, | 219 AddInitializedField(cmd, kTpmRequestHeaderLength, |
| 220 sizeof(TPM_STARTUP_TYPE), | 220 sizeof(TPM_STARTUP_TYPE), |
| 221 TPM_ST_CLEAR); | 221 TPM_ST_CLEAR); |
| 222 return cmd; | 222 return cmd; |
| 223 } | 223 } |
| 224 | 224 |
| 225 Command* BuildResumeCommand(void) { |
| 226 int size = kTpmRequestHeaderLength + sizeof(TPM_STARTUP_TYPE); |
| 227 Command* cmd = newCommand(TPM_ORD_Startup, size); |
| 228 cmd->name = "tpm_resume_cmd"; |
| 229 AddInitializedField(cmd, kTpmRequestHeaderLength, |
| 230 sizeof(TPM_STARTUP_TYPE), |
| 231 TPM_ST_STATE); |
| 232 return cmd; |
| 233 } |
| 234 |
| 225 Command* BuildSelftestfullCommand(void) { | 235 Command* BuildSelftestfullCommand(void) { |
| 226 int size = kTpmRequestHeaderLength; | 236 int size = kTpmRequestHeaderLength; |
| 227 Command* cmd = newCommand(TPM_ORD_SelfTestFull, size); | 237 Command* cmd = newCommand(TPM_ORD_SelfTestFull, size); |
| 228 cmd->name = "tpm_selftestfull_cmd"; | 238 cmd->name = "tpm_selftestfull_cmd"; |
| 229 return cmd; | 239 return cmd; |
| 230 } | 240 } |
| 231 | 241 |
| 232 Command* BuildContinueSelfTestCommand(void) { | 242 Command* BuildContinueSelfTestCommand(void) { |
| 233 int size = kTpmRequestHeaderLength; | 243 int size = kTpmRequestHeaderLength; |
| 234 Command* cmd = newCommand(TPM_ORD_ContinueSelfTest, size); | 244 Command* cmd = newCommand(TPM_ORD_ContinueSelfTest, size); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 | 445 |
| 436 Command* (*builders[])(void) = { | 446 Command* (*builders[])(void) = { |
| 437 BuildDefineSpaceCommand, | 447 BuildDefineSpaceCommand, |
| 438 BuildWriteCommand, | 448 BuildWriteCommand, |
| 439 BuildReadCommand, | 449 BuildReadCommand, |
| 440 BuildPPAssertCommand, | 450 BuildPPAssertCommand, |
| 441 BuildPPEnableCommand, | 451 BuildPPEnableCommand, |
| 442 BuildPPLockCommand, | 452 BuildPPLockCommand, |
| 443 BuildFinalizePPCommand, | 453 BuildFinalizePPCommand, |
| 444 BuildStartupCommand, | 454 BuildStartupCommand, |
| 455 BuildResumeCommand, |
| 445 BuildSelftestfullCommand, | 456 BuildSelftestfullCommand, |
| 446 BuildContinueSelfTestCommand, | 457 BuildContinueSelfTestCommand, |
| 447 BuildReadPubekCommand, | 458 BuildReadPubekCommand, |
| 448 BuildForceClearCommand, | 459 BuildForceClearCommand, |
| 449 BuildPhysicalDisableCommand, | 460 BuildPhysicalDisableCommand, |
| 450 BuildPhysicalEnableCommand, | 461 BuildPhysicalEnableCommand, |
| 451 BuildPhysicalSetDeactivatedCommand, | 462 BuildPhysicalSetDeactivatedCommand, |
| 452 BuildGetFlagsCommand, | 463 BuildGetFlagsCommand, |
| 453 BuildGetSTClearFlagsCommand, | 464 BuildGetSTClearFlagsCommand, |
| 454 BuildGetPermissionsCommand, | 465 BuildGetPermissionsCommand, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 485 OutputCommands(commands); | 496 OutputCommands(commands); |
| 486 printf("const int kWriteInfoLength = %d;\n", (int) sizeof(TPM_WRITE_INFO)); | 497 printf("const int kWriteInfoLength = %d;\n", (int) sizeof(TPM_WRITE_INFO)); |
| 487 printf("const int kNvDataPublicPermissionsOffset = %d;\n", | 498 printf("const int kNvDataPublicPermissionsOffset = %d;\n", |
| 488 (int) (offsetof(TPM_NV_DATA_PUBLIC, permission) + | 499 (int) (offsetof(TPM_NV_DATA_PUBLIC, permission) + |
| 489 2 * PCR_SELECTION_FIX + | 500 2 * PCR_SELECTION_FIX + |
| 490 offsetof(TPM_NV_ATTRIBUTES, attributes))); | 501 offsetof(TPM_NV_ATTRIBUTES, attributes))); |
| 491 | 502 |
| 492 FreeCommands(commands); | 503 FreeCommands(commands); |
| 493 return 0; | 504 return 0; |
| 494 } | 505 } |
| OLD | NEW |