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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 Command* BuildStartupCommand(void) { | 215 Command* BuildStartupCommand(void) { |
216 int size = kTpmRequestHeaderLength + sizeof(TPM_STARTUP_TYPE); | 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* BuildSaveStateCommand(void) { |
| 226 int size = kTpmRequestHeaderLength; |
| 227 Command* cmd = newCommand(TPM_ORD_SaveState, size); |
| 228 cmd->name = "tpm_savestate_cmd"; |
| 229 return cmd; |
| 230 } |
| 231 |
225 Command* BuildResumeCommand(void) { | 232 Command* BuildResumeCommand(void) { |
226 int size = kTpmRequestHeaderLength + sizeof(TPM_STARTUP_TYPE); | 233 int size = kTpmRequestHeaderLength + sizeof(TPM_STARTUP_TYPE); |
227 Command* cmd = newCommand(TPM_ORD_Startup, size); | 234 Command* cmd = newCommand(TPM_ORD_Startup, size); |
228 cmd->name = "tpm_resume_cmd"; | 235 cmd->name = "tpm_resume_cmd"; |
229 AddInitializedField(cmd, kTpmRequestHeaderLength, | 236 AddInitializedField(cmd, kTpmRequestHeaderLength, |
230 sizeof(TPM_STARTUP_TYPE), | 237 sizeof(TPM_STARTUP_TYPE), |
231 TPM_ST_STATE); | 238 TPM_ST_STATE); |
232 return cmd; | 239 return cmd; |
233 } | 240 } |
234 | 241 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 | 452 |
446 Command* (*builders[])(void) = { | 453 Command* (*builders[])(void) = { |
447 BuildDefineSpaceCommand, | 454 BuildDefineSpaceCommand, |
448 BuildWriteCommand, | 455 BuildWriteCommand, |
449 BuildReadCommand, | 456 BuildReadCommand, |
450 BuildPPAssertCommand, | 457 BuildPPAssertCommand, |
451 BuildPPEnableCommand, | 458 BuildPPEnableCommand, |
452 BuildPPLockCommand, | 459 BuildPPLockCommand, |
453 BuildFinalizePPCommand, | 460 BuildFinalizePPCommand, |
454 BuildStartupCommand, | 461 BuildStartupCommand, |
| 462 BuildSaveStateCommand, |
455 BuildResumeCommand, | 463 BuildResumeCommand, |
456 BuildSelftestfullCommand, | 464 BuildSelftestfullCommand, |
457 BuildContinueSelfTestCommand, | 465 BuildContinueSelfTestCommand, |
458 BuildReadPubekCommand, | 466 BuildReadPubekCommand, |
459 BuildForceClearCommand, | 467 BuildForceClearCommand, |
460 BuildPhysicalDisableCommand, | 468 BuildPhysicalDisableCommand, |
461 BuildPhysicalEnableCommand, | 469 BuildPhysicalEnableCommand, |
462 BuildPhysicalSetDeactivatedCommand, | 470 BuildPhysicalSetDeactivatedCommand, |
463 BuildGetFlagsCommand, | 471 BuildGetFlagsCommand, |
464 BuildGetSTClearFlagsCommand, | 472 BuildGetSTClearFlagsCommand, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 OutputCommands(commands); | 504 OutputCommands(commands); |
497 printf("const int kWriteInfoLength = %d;\n", (int) sizeof(TPM_WRITE_INFO)); | 505 printf("const int kWriteInfoLength = %d;\n", (int) sizeof(TPM_WRITE_INFO)); |
498 printf("const int kNvDataPublicPermissionsOffset = %d;\n", | 506 printf("const int kNvDataPublicPermissionsOffset = %d;\n", |
499 (int) (offsetof(TPM_NV_DATA_PUBLIC, permission) + | 507 (int) (offsetof(TPM_NV_DATA_PUBLIC, permission) + |
500 2 * PCR_SELECTION_FIX + | 508 2 * PCR_SELECTION_FIX + |
501 offsetof(TPM_NV_ATTRIBUTES, attributes))); | 509 offsetof(TPM_NV_ATTRIBUTES, attributes))); |
502 | 510 |
503 FreeCommands(commands); | 511 FreeCommands(commands); |
504 return 0; | 512 return 0; |
505 } | 513 } |
OLD | NEW |