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 /* A lightweight TPM command library. | 6 /* A lightweight TPM command library. |
7 * | 7 * |
8 * The general idea is that TPM commands are array of bytes whose fields are | 8 * The general idea is that TPM commands are array of bytes whose fields are |
9 * mostly compile-time constant. The goal is to build much of the commands at | 9 * mostly compile-time constant. The goal is to build much of the commands at |
10 * compile time (or build time) and change some of the fields at run time as | 10 * compile time (or build time) and change some of the fields at run time as |
11 * needed. The code in generator.c builds structures containing the commands, | 11 * needed. The code in generator.c builds structures containing the commands, |
12 * as well as the offsets of the fields that need to be set at run time. | 12 * as well as the offsets of the fields that need to be set at run time. |
13 */ | 13 */ |
14 | 14 |
15 #include "tlcl.h" | 15 #include "tlcl.h" |
16 | 16 |
17 #include <errno.h> | 17 #include <errno.h> |
18 #include <fcntl.h> | 18 #include <fcntl.h> |
19 #include <stdarg.h> | 19 #include <stdarg.h> |
20 #include <stdio.h> | 20 #include <stdio.h> |
21 #include <string.h> | 21 #include <string.h> |
22 #include <sys/time.h> | 22 #include <sys/time.h> |
23 #include <sys/types.h> | 23 #include <sys/types.h> |
24 #include <sys/stat.h> | 24 #include <sys/stat.h> |
25 #include <unistd.h> | 25 #include <unistd.h> |
26 | 26 |
27 #ifdef FIRMWARE | 27 #ifdef FIRMWARE |
28 #include "saved-structures.h" | |
29 #include "tss_constants.h" | 28 #include "tss_constants.h" |
30 #else | 29 #else |
31 #include <tss/tcs.h> | 30 #include <tss/tcs.h> |
32 #include "structures.h" | |
33 #include "tpmextras.h" | 31 #include "tpmextras.h" |
34 #endif /* FIRMWARE */ | 32 #endif /* FIRMWARE */ |
35 | 33 |
| 34 #include "structures.h" |
36 #include "tlcl_internal.h" | 35 #include "tlcl_internal.h" |
| 36 #include "version.h" |
37 | 37 |
38 #if USE_TPM_EMULATOR | 38 #if USE_TPM_EMULATOR |
39 #include "tpmemu.h" | 39 #include "tpmemu.h" |
40 #endif | 40 #endif |
41 | 41 |
42 /* The file descriptor for the TPM device. | 42 /* The file descriptor for the TPM device. |
43 */ | 43 */ |
44 int tpm_fd = -1; | 44 int tpm_fd = -1; |
45 | 45 |
46 /* Log level. 0 is quietest. Be verbose by default. | 46 /* Log level. 0 is quietest. Be verbose by default. |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 ToTpmUint32(tpm_getpermissions_cmd.index, index); | 387 ToTpmUint32(tpm_getpermissions_cmd.index, index); |
388 SendReceive(tpm_getpermissions_cmd.buffer, response, sizeof(response)); | 388 SendReceive(tpm_getpermissions_cmd.buffer, response, sizeof(response)); |
389 result = TpmReturnCode(response); | 389 result = TpmReturnCode(response); |
390 if (result != TPM_SUCCESS) { | 390 if (result != TPM_SUCCESS) { |
391 return result; | 391 return result; |
392 } | 392 } |
393 nvdata = response + kTpmResponseHeaderLength + sizeof(size); | 393 nvdata = response + kTpmResponseHeaderLength + sizeof(size); |
394 FromTpmUint32(nvdata + kNvDataPublicPermissionsOffset, permissions); | 394 FromTpmUint32(nvdata + kNvDataPublicPermissionsOffset, permissions); |
395 return result; | 395 return result; |
396 } | 396 } |
OLD | NEW |