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 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 /* Logs to stdout. Arguments like printf. | 58 /* Logs to stdout. Arguments like printf. |
59 */ | 59 */ |
60 void TlclLog(char* format, ...); | 60 void TlclLog(char* format, ...); |
61 | 61 |
62 /* Sets the log level. 0 is quietest. | 62 /* Sets the log level. 0 is quietest. |
63 */ | 63 */ |
64 void TlclSetLogLevel(int level); | 64 void TlclSetLogLevel(int level); |
65 | 65 |
66 /* Sends a TPM_Startup(ST_CLEAR). Note that this is a no-op for the emulator, | 66 /* Sends a TPM_Startup(ST_CLEAR). Note that this is a no-op for the emulator, |
67 * because it runs this command during initialization. | 67 * because it runs this command during initialization. The TPM error code is |
| 68 * returned (0 for success). |
68 */ | 69 */ |
69 void TlclStartup(void); | 70 uint32_t TlclStartup(void); |
70 | 71 |
71 /* Run the self test. Note---this is synchronous. To run this in parallel | 72 /* Run the self test. Note---this is synchronous. To run this in parallel |
72 * with other firmware, use ContinueSelfTest. | 73 * with other firmware, use ContinueSelfTest. The TPM error code is returned. |
73 */ | 74 */ |
74 void TlclSelftestfull(void); | 75 uint32_t TlclSelftestfull(void); |
75 | 76 |
76 /* Defines a space with permission [perm]. [index] is the index for the space, | 77 /* Defines a space with permission [perm]. [index] is the index for the space, |
77 * [size] the usable data size. Errors are ignored. | 78 * [size] the usable data size. The TPM error code is returned. |
78 */ | 79 */ |
79 void TlclDefineSpace(uint32_t index, uint32_t perm, uint32_t size); | 80 uint32_t TlclDefineSpace(uint32_t index, uint32_t perm, uint32_t size); |
80 | 81 |
81 /* Writes [length] bytes of [data] to space at [index]. The TPM error code is | 82 /* Writes [length] bytes of [data] to space at [index]. The TPM error code is |
82 * returned (0 for success). | 83 * returned. |
83 */ | 84 */ |
84 uint32_t TlclWrite(uint32_t index, uint8_t *data, uint32_t length); | 85 uint32_t TlclWrite(uint32_t index, uint8_t *data, uint32_t length); |
85 | 86 |
86 /* Reads [length] bytes from space at [index] into [data]. The TPM error code | 87 /* Reads [length] bytes from space at [index] into [data]. The TPM error code |
87 * is returned (0 for success). | 88 * is returned. |
88 */ | 89 */ |
89 uint32_t TlclRead(uint32_t index, uint8_t *data, uint32_t length); | 90 uint32_t TlclRead(uint32_t index, uint8_t *data, uint32_t length); |
90 | 91 |
91 /* Write-locks space at [index]. | 92 /* Write-locks space at [index]. The TPM error code is returned. |
92 */ | 93 */ |
93 void TlclWriteLock(uint32_t index); | 94 uint32_t TlclWriteLock(uint32_t index); |
94 | 95 |
95 /* Read-locks space at [index]. | 96 /* Read-locks space at [index]. The TPM error code is returned. |
96 */ | 97 */ |
97 void TlclReadLock(uint32_t index); | 98 uint32_t TlclReadLock(uint32_t index); |
98 | 99 |
99 /* Asserts physical presence in software. | 100 /* Asserts physical presence in software. The TPM error code is returned. |
100 */ | 101 */ |
101 void TlclAssertPhysicalPresence(void); | 102 uint32_t TlclAssertPhysicalPresence(void); |
102 | 103 |
103 /* Turns off physical presence and locks it off until next reboot. | 104 /* Turns off physical presence and locks it off until next reboot. The TPM |
| 105 * error code is returned. |
104 */ | 106 */ |
105 uint32_t TlclLockPhysicalPresence(void); | 107 uint32_t TlclLockPhysicalPresence(void); |
106 | 108 |
107 /* Sets the nvLocked bit. | 109 /* Sets the nvLocked bit. The TPM error code is returned. |
108 */ | 110 */ |
109 void TlclSetNvLocked(void); | 111 uint32_t TlclSetNvLocked(void); |
110 | 112 |
111 /* Returns 1 if the TPM is owned, 0 otherwise. | 113 /* Returns 1 if the TPM is owned, 0 otherwise. |
112 */ | 114 */ |
113 int TlclIsOwned(void); | 115 int TlclIsOwned(void); |
114 | 116 |
115 /* Issues a ForceClear. | 117 /* Issues a ForceClear. The TPM error code is returned. |
116 */ | 118 */ |
117 void TlclForceClear(void); | 119 uint32_t TlclForceClear(void); |
118 | 120 |
119 /* Issues a SetEnable. | 121 /* Issues a SetEnable. The TPM error code is returned. |
120 */ | 122 */ |
121 void TlclSetEnable(void); | 123 uint32_t TlclSetEnable(void); |
122 | 124 |
123 /* Issues a SetDeactivated. Pass 0 to activate. Returns result code. | 125 /* Issues a SetDeactivated. Pass 0 to activate. Returns result code. |
124 */ | 126 */ |
125 int TlclSetDeactivated(uint8_t flag); | 127 uint32_t TlclSetDeactivated(uint8_t flag); |
126 | 128 |
127 /* Gets flags of interest. (Add more here as needed.) | 129 /* Gets flags of interest. (Add more here as needed.) The TPM error code is |
| 130 * returned. |
128 */ | 131 */ |
129 int TlclGetFlags(uint8_t* disable, uint8_t* deactivated); | 132 uint32_t TlclGetFlags(uint8_t* disable, uint8_t* deactivated); |
130 | 133 |
131 /* Sets the bGlobalLock flag, which only a reboot can clear. | 134 /* Sets the bGlobalLock flag, which only a reboot can clear. The TPM error |
| 135 * code is returned. |
132 */ | 136 */ |
133 uint32_t TlclSetGlobalLock(void); | 137 uint32_t TlclSetGlobalLock(void); |
134 | 138 |
135 #endif /* TPM_LITE_TLCL_H_ */ | 139 #endif /* TPM_LITE_TLCL_H_ */ |
OLD | NEW |