| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 Command* BuildPPAssertCommand(void) { | 173 Command* BuildPPAssertCommand(void) { |
| 174 int size = kTpmRequestHeaderLength + sizeof(TPM_PHYSICAL_PRESENCE); | 174 int size = kTpmRequestHeaderLength + sizeof(TPM_PHYSICAL_PRESENCE); |
| 175 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); | 175 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); |
| 176 cmd->name = "tpm_ppassert_cmd"; | 176 cmd->name = "tpm_ppassert_cmd"; |
| 177 AddInitializedField(cmd, kTpmRequestHeaderLength, | 177 AddInitializedField(cmd, kTpmRequestHeaderLength, |
| 178 sizeof(TPM_PHYSICAL_PRESENCE), | 178 sizeof(TPM_PHYSICAL_PRESENCE), |
| 179 TPM_PHYSICAL_PRESENCE_PRESENT); | 179 TPM_PHYSICAL_PRESENCE_PRESENT); |
| 180 return cmd; | 180 return cmd; |
| 181 } | 181 } |
| 182 | 182 |
| 183 Command* BuildPPEnableCommand(void) { |
| 184 int size = kTpmRequestHeaderLength + sizeof(TPM_PHYSICAL_PRESENCE); |
| 185 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); |
| 186 cmd->name = "tpm_ppenable_cmd"; |
| 187 AddInitializedField(cmd, kTpmRequestHeaderLength, |
| 188 sizeof(TPM_PHYSICAL_PRESENCE), |
| 189 TPM_PHYSICAL_PRESENCE_CMD_ENABLE); |
| 190 return cmd; |
| 191 } |
| 192 |
| 183 Command* BuildPPLockCommand(void) { | 193 Command* BuildPPLockCommand(void) { |
| 184 int size = kTpmRequestHeaderLength + sizeof(TPM_PHYSICAL_PRESENCE); | 194 int size = kTpmRequestHeaderLength + sizeof(TPM_PHYSICAL_PRESENCE); |
| 185 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); | 195 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); |
| 186 cmd->name = "tpm_pplock_cmd"; | 196 cmd->name = "tpm_pplock_cmd"; |
| 187 AddInitializedField(cmd, kTpmRequestHeaderLength, | 197 AddInitializedField(cmd, kTpmRequestHeaderLength, |
| 188 sizeof(TPM_PHYSICAL_PRESENCE), | 198 sizeof(TPM_PHYSICAL_PRESENCE), |
| 189 TPM_PHYSICAL_PRESENCE_LOCK); | 199 TPM_PHYSICAL_PRESENCE_LOCK); |
| 190 return cmd; | 200 return cmd; |
| 191 } | 201 } |
| 192 | 202 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 printf("};\n\n"); | 419 printf("};\n\n"); |
| 410 } | 420 } |
| 411 OutputCommands(cmd->next); | 421 OutputCommands(cmd->next); |
| 412 } | 422 } |
| 413 | 423 |
| 414 Command* (*builders[])(void) = { | 424 Command* (*builders[])(void) = { |
| 415 BuildDefineSpaceCommand, | 425 BuildDefineSpaceCommand, |
| 416 BuildWriteCommand, | 426 BuildWriteCommand, |
| 417 BuildReadCommand, | 427 BuildReadCommand, |
| 418 BuildPPAssertCommand, | 428 BuildPPAssertCommand, |
| 429 BuildPPEnableCommand, |
| 419 BuildPPLockCommand, | 430 BuildPPLockCommand, |
| 420 BuildStartupCommand, | 431 BuildStartupCommand, |
| 421 BuildSelftestfullCommand, | 432 BuildSelftestfullCommand, |
| 422 BuildContinueSelfTestCommand, | 433 BuildContinueSelfTestCommand, |
| 423 BuildReadPubekCommand, | 434 BuildReadPubekCommand, |
| 424 BuildForceClearCommand, | 435 BuildForceClearCommand, |
| 425 BuildPhysicalDisableCommand, | 436 BuildPhysicalDisableCommand, |
| 426 BuildPhysicalEnableCommand, | 437 BuildPhysicalEnableCommand, |
| 427 BuildPhysicalSetDeactivatedCommand, | 438 BuildPhysicalSetDeactivatedCommand, |
| 428 BuildGetFlagsCommand, | 439 BuildGetFlagsCommand, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 OutputCommands(commands); | 472 OutputCommands(commands); |
| 462 printf("const int kWriteInfoLength = %d;\n", (int) sizeof(TPM_WRITE_INFO)); | 473 printf("const int kWriteInfoLength = %d;\n", (int) sizeof(TPM_WRITE_INFO)); |
| 463 printf("const int kNvDataPublicPermissionsOffset = %d;\n", | 474 printf("const int kNvDataPublicPermissionsOffset = %d;\n", |
| 464 (int) (offsetof(TPM_NV_DATA_PUBLIC, permission) + | 475 (int) (offsetof(TPM_NV_DATA_PUBLIC, permission) + |
| 465 2 * PCR_SELECTION_FIX + | 476 2 * PCR_SELECTION_FIX + |
| 466 offsetof(TPM_NV_ATTRIBUTES, attributes))); | 477 offsetof(TPM_NV_ATTRIBUTES, attributes))); |
| 467 | 478 |
| 468 FreeCommands(commands); | 479 FreeCommands(commands); |
| 469 return 0; | 480 return 0; |
| 470 } | 481 } |
| OLD | NEW |