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

Side by Side Diff: utility/tlcl_generator.c

Issue 3116025: Added new commands and reactivated full rebuild after fixing for ARM ebuild. (Closed) Base URL: ssh://git@chromiumos-git/vboot_reference.git
Patch Set: move to new build flow (no changes expected) Created 10 years, 3 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 unified diff | Download patch
« no previous file with comments | « utility/Makefile ('k') | utility/tpmc.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 * (see PCR_SELECTION_FIX below). 11 * (see PCR_SELECTION_FIX below).
12 */ 12 */
13 13
14 #include <assert.h> 14 #include <assert.h>
15 #include <stddef.h> 15 #include <stddef.h>
16 #include <stdio.h> 16 #include <stdio.h>
17 #include <stdlib.h> 17 #include <stdlib.h>
18 #include <tss/tcs.h> 18 #include <tss/tcs.h>
19 19
20 #include "tlcl.h" 20 #include "sysincludes.h"
21 #include "tlcl_internal.h" 21 #include "tlcl_internal.h"
22 #include "tpmextras.h" 22 #include "tpmextras.h"
23 23
24 /* See struct Command below. This structure represent a field in a TPM 24 /* See struct Command below. This structure represent a field in a TPM
25 * command. [name] is the field name. [visible] is 1 if the field is 25 * command. [name] is the field name. [visible] is 1 if the field is
26 * modified by the run-time. Non-visible fields are initialized at build time 26 * modified by the run-time. Non-visible fields are initialized at build time
27 * and remain constant. [size] is the field size in bytes. [value] is the 27 * and remain constant. [size] is the field size in bytes. [value] is the
28 * fixed value of non-visible fields. 28 * fixed value of non-visible fields.
29 */ 29 */
30 typedef struct Field { 30 typedef struct Field {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 sizeof(TPM_CAPABILITY_AREA), TPM_CAP_FLAG); 271 sizeof(TPM_CAPABILITY_AREA), TPM_CAP_FLAG);
272 AddInitializedField(cmd, kTpmRequestHeaderLength + 272 AddInitializedField(cmd, kTpmRequestHeaderLength +
273 sizeof(TPM_CAPABILITY_AREA), 273 sizeof(TPM_CAPABILITY_AREA),
274 sizeof(uint32_t), sizeof(uint32_t)); 274 sizeof(uint32_t), sizeof(uint32_t));
275 AddInitializedField(cmd, kTpmRequestHeaderLength + 275 AddInitializedField(cmd, kTpmRequestHeaderLength +
276 sizeof(TPM_CAPABILITY_AREA) + sizeof(uint32_t), 276 sizeof(TPM_CAPABILITY_AREA) + sizeof(uint32_t),
277 sizeof(uint32_t), TPM_CAP_FLAG_PERMANENT); 277 sizeof(uint32_t), TPM_CAP_FLAG_PERMANENT);
278 return cmd; 278 return cmd;
279 } 279 }
280 280
281 Command* BuildGetSTClearFlagsCommand(void) {
282 int size = (kTpmRequestHeaderLength +
283 sizeof(TPM_CAPABILITY_AREA) + /* capArea */
284 sizeof(uint32_t) + /* subCapSize */
285 sizeof(uint32_t)); /* subCap */
286
287 Command* cmd = newCommand(TPM_ORD_GetCapability, size);
288 cmd->name = "tpm_getstclearflags_cmd";
289 AddInitializedField(cmd, kTpmRequestHeaderLength,
290 sizeof(TPM_CAPABILITY_AREA), TPM_CAP_FLAG);
291 AddInitializedField(cmd, kTpmRequestHeaderLength +
292 sizeof(TPM_CAPABILITY_AREA),
293 sizeof(uint32_t), sizeof(uint32_t));
294 AddInitializedField(cmd, kTpmRequestHeaderLength +
295 sizeof(TPM_CAPABILITY_AREA) + sizeof(uint32_t),
296 sizeof(uint32_t), TPM_CAP_FLAG_VOLATILE);
297 return cmd;
298 }
299
281 Command* BuildGetPermissionsCommand(void) { 300 Command* BuildGetPermissionsCommand(void) {
282 int size = (kTpmRequestHeaderLength + 301 int size = (kTpmRequestHeaderLength +
283 sizeof(TPM_CAPABILITY_AREA) + /* capArea */ 302 sizeof(TPM_CAPABILITY_AREA) + /* capArea */
284 sizeof(uint32_t) + /* subCapSize */ 303 sizeof(uint32_t) + /* subCapSize */
285 sizeof(uint32_t)); /* subCap */ 304 sizeof(uint32_t)); /* subCap */
286 305
287 Command* cmd = newCommand(TPM_ORD_GetCapability, size); 306 Command* cmd = newCommand(TPM_ORD_GetCapability, size);
288 cmd->name = "tpm_getpermissions_cmd"; 307 cmd->name = "tpm_getpermissions_cmd";
289 AddInitializedField(cmd, kTpmRequestHeaderLength, 308 AddInitializedField(cmd, kTpmRequestHeaderLength,
290 sizeof(TPM_CAPABILITY_AREA), TPM_CAP_NV_INDEX); 309 sizeof(TPM_CAPABILITY_AREA), TPM_CAP_NV_INDEX);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 BuildPPLockCommand, 419 BuildPPLockCommand,
401 BuildStartupCommand, 420 BuildStartupCommand,
402 BuildSelftestfullCommand, 421 BuildSelftestfullCommand,
403 BuildContinueSelfTestCommand, 422 BuildContinueSelfTestCommand,
404 BuildReadPubekCommand, 423 BuildReadPubekCommand,
405 BuildForceClearCommand, 424 BuildForceClearCommand,
406 BuildPhysicalDisableCommand, 425 BuildPhysicalDisableCommand,
407 BuildPhysicalEnableCommand, 426 BuildPhysicalEnableCommand,
408 BuildPhysicalSetDeactivatedCommand, 427 BuildPhysicalSetDeactivatedCommand,
409 BuildGetFlagsCommand, 428 BuildGetFlagsCommand,
429 BuildGetSTClearFlagsCommand,
410 BuildGetPermissionsCommand, 430 BuildGetPermissionsCommand,
411 BuildExtendCommand, 431 BuildExtendCommand,
412 }; 432 };
413 433
414 static void FreeFields(Field* fld) { 434 static void FreeFields(Field* fld) {
415 if (fld != NULL) { 435 if (fld != NULL) {
416 Field* next_field = fld->next; 436 Field* next_field = fld->next;
417 free(fld); 437 free(fld);
418 FreeFields(next_field); 438 FreeFields(next_field);
419 } 439 }
(...skipping 21 matching lines...) Expand all
441 OutputCommands(commands); 461 OutputCommands(commands);
442 printf("const int kWriteInfoLength = %d;\n", (int) sizeof(TPM_WRITE_INFO)); 462 printf("const int kWriteInfoLength = %d;\n", (int) sizeof(TPM_WRITE_INFO));
443 printf("const int kNvDataPublicPermissionsOffset = %d;\n", 463 printf("const int kNvDataPublicPermissionsOffset = %d;\n",
444 (int) (offsetof(TPM_NV_DATA_PUBLIC, permission) + 464 (int) (offsetof(TPM_NV_DATA_PUBLIC, permission) +
445 2 * PCR_SELECTION_FIX + 465 2 * PCR_SELECTION_FIX +
446 offsetof(TPM_NV_ATTRIBUTES, attributes))); 466 offsetof(TPM_NV_ATTRIBUTES, attributes)));
447 467
448 FreeCommands(commands); 468 FreeCommands(commands);
449 return 0; 469 return 0;
450 } 470 }
OLDNEW
« no previous file with comments | « utility/Makefile ('k') | utility/tpmc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698