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 /* TPM Lightweight Command Library. | 6 /* TPM Lightweight Command Library. |
7 * | 7 * |
8 * A low-level library for interfacing to TPM hardware or an emulator. | 8 * A low-level library for interfacing to TPM hardware or an emulator. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef TPM_LITE_TLCL_H_ | 11 #ifndef TPM_LITE_TLCL_H_ |
12 #define TPM_LITE_TLCL_H_ | 12 #define TPM_LITE_TLCL_H_ |
13 | 13 |
14 #include "sysincludes.h" | 14 #include "sysincludes.h" |
15 | 15 |
16 /*****************************************************************************/ | 16 /*****************************************************************************/ |
17 /* Functions to be implemented by the stub library */ | 17 /* Functions to be implemented by the stub library */ |
18 | 18 |
19 /* Initialize the stub library */ | 19 /* Initialize the stub library */ |
20 void TlclStubInit(void); | 20 void TlclStubInit(void); |
21 | 21 |
22 /* Close and open the device. This is needed for running more complex commands | 22 /* Close and open the device. This is needed for running more complex commands |
23 * at user level, such as TPM_TakeOwnership, since the TPM device can be opened | 23 * at user level, such as TPM_TakeOwnership, since the TPM device can be opened |
24 * only by one process at a time. | 24 * only by one process at a time. |
25 */ | 25 */ |
26 void TlclCloseDevice(void); | 26 void TlclCloseDevice(void); |
27 void TlclOpenDevice(void); | 27 void TlclOpenDevice(void); |
28 | 28 |
29 void TlclStubSendReceive(uint8_t* request, int request_length, | 29 /* Send data to the TPM and receive a response. Returns 0 if success, |
30 uint8_t* response, int max_length); | 30 * nonzero if error. */ |
| 31 uint32_t TlclStubSendReceive(uint8_t* request, int request_length, |
| 32 uint8_t* response, int max_length); |
31 | 33 |
32 /*****************************************************************************/ | 34 /*****************************************************************************/ |
33 /* Functions implemented in tlcl.c */ | 35 /* Functions implemented in tlcl.c */ |
34 | 36 |
35 /* Call this first. | 37 /* Call this first. |
36 */ | 38 */ |
37 void TlclLibInit(void); | 39 void TlclLibInit(void); |
38 | 40 |
39 | |
40 /* Logs to stdout. Arguments like printf. | 41 /* Logs to stdout. Arguments like printf. |
41 */ | 42 */ |
42 void TlclLog(char* format, ...); | 43 void TlclLog(char* format, ...); |
43 | 44 |
44 /* Sets the log level. 0 is quietest. | 45 /* Sets the log level. 0 is quietest. |
45 */ | 46 */ |
46 void TlclSetLogLevel(int level); | 47 void TlclSetLogLevel(int level); |
47 | 48 |
48 /* Sends a TPM_Startup(ST_CLEAR). The TPM error code is returned (0 | 49 /* Sends a TPM_Startup(ST_CLEAR). The TPM error code is returned (0 |
49 * for success). | 50 * for success). |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 110 |
110 /* Issues a PhysicalDisable. The TPM error code is returned. | 111 /* Issues a PhysicalDisable. The TPM error code is returned. |
111 */ | 112 */ |
112 uint32_t TlclClearEnable(void); | 113 uint32_t TlclClearEnable(void); |
113 | 114 |
114 /* Issues a SetDeactivated. Pass 0 to activate. Returns result code. | 115 /* Issues a SetDeactivated. Pass 0 to activate. Returns result code. |
115 */ | 116 */ |
116 uint32_t TlclSetDeactivated(uint8_t flag); | 117 uint32_t TlclSetDeactivated(uint8_t flag); |
117 | 118 |
118 /* Gets flags of interest. Pointers for flags you aren't interested in may | 119 /* Gets flags of interest. Pointers for flags you aren't interested in may |
119 * be NULL. The TPM error code is returned. | 120 * be NULL. The TPM error code is returned. |
120 */ | 121 */ |
121 uint32_t TlclGetFlags(uint8_t* disable, uint8_t* deactivated, uint8_t* nvlocked)
; | 122 uint32_t TlclGetFlags(uint8_t* disable, uint8_t* deactivated, uint8_t* nvlocked)
; |
122 | 123 |
123 /* Sets the bGlobalLock flag, which only a reboot can clear. The TPM error | 124 /* Sets the bGlobalLock flag, which only a reboot can clear. The TPM error |
124 * code is returned. | 125 * code is returned. |
125 */ | 126 */ |
126 uint32_t TlclSetGlobalLock(void); | 127 uint32_t TlclSetGlobalLock(void); |
127 | 128 |
128 /* Performs a TPM_Extend. | 129 /* Performs a TPM_Extend. |
129 */ | 130 */ |
130 uint32_t TlclExtend(int pcr_num, uint8_t* in_digest, uint8_t* out_digest); | 131 uint32_t TlclExtend(int pcr_num, uint8_t* in_digest, uint8_t* out_digest); |
131 | 132 |
132 /* Gets the permission bits for the NVRAM space with |index|. | 133 /* Gets the permission bits for the NVRAM space with |index|. |
133 */ | 134 */ |
134 uint32_t TlclGetPermissions(uint32_t index, uint32_t* permissions); | 135 uint32_t TlclGetPermissions(uint32_t index, uint32_t* permissions); |
135 | 136 |
136 #endif /* TPM_LITE_TLCL_H_ */ | 137 #endif /* TPM_LITE_TLCL_H_ */ |
OLD | NEW |