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

Side by Side Diff: utility/tlcl_generator.c

Issue 3271006: Make TPM datagrams const, since they cannot be modified in the RO firmware. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « firmware/version.c ('k') | no next file » | 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
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 } 424 }
425 } 425 }
426 } 426 }
427 427
428 /* Outputs the structure initializers for all commands. 428 /* Outputs the structure initializers for all commands.
429 */ 429 */
430 void OutputCommands(Command* cmd) { 430 void OutputCommands(Command* cmd) {
431 if (cmd == NULL) { 431 if (cmd == NULL) {
432 return; 432 return;
433 } else { 433 } else {
434 printf("struct s_%s{\n uint8_t buffer[%d];\n", 434 printf("const struct s_%s{\n uint8_t buffer[%d];\n",
435 cmd->name, cmd->size == 0 ? cmd->max_size : cmd->size); 435 cmd->name, cmd->size == 0 ? cmd->max_size : cmd->size);
436 OutputFields(cmd->fields); 436 OutputFields(cmd->fields);
437 printf("} %s = {{", cmd->name); 437 printf("} %s = {{", cmd->name);
438 OutputBytes(cmd); 438 OutputBytes(cmd);
439 printf("},\n"); 439 printf("},\n");
440 OutputFieldPointers(cmd, cmd->fields); 440 OutputFieldPointers(cmd, cmd->fields);
441 printf("};\n\n"); 441 printf("};\n\n");
442 } 442 }
443 OutputCommands(cmd->next); 443 OutputCommands(cmd->next);
444 } 444 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 OutputCommands(commands); 496 OutputCommands(commands);
497 printf("const int kWriteInfoLength = %d;\n", (int) sizeof(TPM_WRITE_INFO)); 497 printf("const int kWriteInfoLength = %d;\n", (int) sizeof(TPM_WRITE_INFO));
498 printf("const int kNvDataPublicPermissionsOffset = %d;\n", 498 printf("const int kNvDataPublicPermissionsOffset = %d;\n",
499 (int) (offsetof(TPM_NV_DATA_PUBLIC, permission) + 499 (int) (offsetof(TPM_NV_DATA_PUBLIC, permission) +
500 2 * PCR_SELECTION_FIX + 500 2 * PCR_SELECTION_FIX +
501 offsetof(TPM_NV_ATTRIBUTES, attributes))); 501 offsetof(TPM_NV_ATTRIBUTES, attributes)));
502 502
503 FreeCommands(commands); 503 FreeCommands(commands);
504 return 0; 504 return 0;
505 } 505 }
OLDNEW
« no previous file with comments | « firmware/version.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698