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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 Command* BuildPPEnableCommand(void) { | 183 Command* BuildPPEnableCommand(void) { |
184 int size = kTpmRequestHeaderLength + sizeof(TPM_PHYSICAL_PRESENCE); | 184 int size = kTpmRequestHeaderLength + sizeof(TPM_PHYSICAL_PRESENCE); |
185 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); | 185 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); |
186 cmd->name = "tpm_ppenable_cmd"; | 186 cmd->name = "tpm_ppenable_cmd"; |
187 AddInitializedField(cmd, kTpmRequestHeaderLength, | 187 AddInitializedField(cmd, kTpmRequestHeaderLength, |
188 sizeof(TPM_PHYSICAL_PRESENCE), | 188 sizeof(TPM_PHYSICAL_PRESENCE), |
189 TPM_PHYSICAL_PRESENCE_CMD_ENABLE); | 189 TPM_PHYSICAL_PRESENCE_CMD_ENABLE); |
190 return cmd; | 190 return cmd; |
191 } | 191 } |
192 | 192 |
| 193 Command* BuildFinalizePPCommand(void) { |
| 194 int size = kTpmRequestHeaderLength + sizeof(TPM_PHYSICAL_PRESENCE); |
| 195 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); |
| 196 cmd->name = "tpm_finalizepp_cmd"; |
| 197 AddInitializedField(cmd, kTpmRequestHeaderLength, |
| 198 sizeof(TPM_PHYSICAL_PRESENCE), |
| 199 TPM_PHYSICAL_PRESENCE_CMD_ENABLE | |
| 200 TPM_PHYSICAL_PRESENCE_HW_DISABLE | |
| 201 TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK); |
| 202 return cmd; |
| 203 } |
| 204 |
193 Command* BuildPPLockCommand(void) { | 205 Command* BuildPPLockCommand(void) { |
194 int size = kTpmRequestHeaderLength + sizeof(TPM_PHYSICAL_PRESENCE); | 206 int size = kTpmRequestHeaderLength + sizeof(TPM_PHYSICAL_PRESENCE); |
195 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); | 207 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); |
196 cmd->name = "tpm_pplock_cmd"; | 208 cmd->name = "tpm_pplock_cmd"; |
197 AddInitializedField(cmd, kTpmRequestHeaderLength, | 209 AddInitializedField(cmd, kTpmRequestHeaderLength, |
198 sizeof(TPM_PHYSICAL_PRESENCE), | 210 sizeof(TPM_PHYSICAL_PRESENCE), |
199 TPM_PHYSICAL_PRESENCE_LOCK); | 211 TPM_PHYSICAL_PRESENCE_LOCK); |
200 return cmd; | 212 return cmd; |
201 } | 213 } |
202 | 214 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 OutputCommands(cmd->next); | 433 OutputCommands(cmd->next); |
422 } | 434 } |
423 | 435 |
424 Command* (*builders[])(void) = { | 436 Command* (*builders[])(void) = { |
425 BuildDefineSpaceCommand, | 437 BuildDefineSpaceCommand, |
426 BuildWriteCommand, | 438 BuildWriteCommand, |
427 BuildReadCommand, | 439 BuildReadCommand, |
428 BuildPPAssertCommand, | 440 BuildPPAssertCommand, |
429 BuildPPEnableCommand, | 441 BuildPPEnableCommand, |
430 BuildPPLockCommand, | 442 BuildPPLockCommand, |
| 443 BuildFinalizePPCommand, |
431 BuildStartupCommand, | 444 BuildStartupCommand, |
432 BuildSelftestfullCommand, | 445 BuildSelftestfullCommand, |
433 BuildContinueSelfTestCommand, | 446 BuildContinueSelfTestCommand, |
434 BuildReadPubekCommand, | 447 BuildReadPubekCommand, |
435 BuildForceClearCommand, | 448 BuildForceClearCommand, |
436 BuildPhysicalDisableCommand, | 449 BuildPhysicalDisableCommand, |
437 BuildPhysicalEnableCommand, | 450 BuildPhysicalEnableCommand, |
438 BuildPhysicalSetDeactivatedCommand, | 451 BuildPhysicalSetDeactivatedCommand, |
439 BuildGetFlagsCommand, | 452 BuildGetFlagsCommand, |
440 BuildGetSTClearFlagsCommand, | 453 BuildGetSTClearFlagsCommand, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 OutputCommands(commands); | 485 OutputCommands(commands); |
473 printf("const int kWriteInfoLength = %d;\n", (int) sizeof(TPM_WRITE_INFO)); | 486 printf("const int kWriteInfoLength = %d;\n", (int) sizeof(TPM_WRITE_INFO)); |
474 printf("const int kNvDataPublicPermissionsOffset = %d;\n", | 487 printf("const int kNvDataPublicPermissionsOffset = %d;\n", |
475 (int) (offsetof(TPM_NV_DATA_PUBLIC, permission) + | 488 (int) (offsetof(TPM_NV_DATA_PUBLIC, permission) + |
476 2 * PCR_SELECTION_FIX + | 489 2 * PCR_SELECTION_FIX + |
477 offsetof(TPM_NV_ATTRIBUTES, attributes))); | 490 offsetof(TPM_NV_ATTRIBUTES, attributes))); |
478 | 491 |
479 FreeCommands(commands); | 492 FreeCommands(commands); |
480 return 0; | 493 return 0; |
481 } | 494 } |
OLD | NEW |