diff options
Diffstat (limited to 'drivers/char/tpm/tpm.h')
-rw-r--r-- | drivers/char/tpm/tpm.h | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 8e30df4a4388..8e00b4ddd083 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/miscdevice.h> | 26 | #include <linux/miscdevice.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | #include <linux/tpm.h> | ||
29 | 30 | ||
30 | enum tpm_timeout { | 31 | enum tpm_timeout { |
31 | TPM_TIMEOUT = 5, /* msecs */ | 32 | TPM_TIMEOUT = 5, /* msecs */ |
@@ -123,6 +124,147 @@ static inline void tpm_write_index(int base, int index, int value) | |||
123 | outb(index, base); | 124 | outb(index, base); |
124 | outb(value & 0xFF, base+1); | 125 | outb(value & 0xFF, base+1); |
125 | } | 126 | } |
127 | struct tpm_input_header { | ||
128 | __be16 tag; | ||
129 | __be32 length; | ||
130 | __be32 ordinal; | ||
131 | }__attribute__((packed)); | ||
132 | |||
133 | struct tpm_output_header { | ||
134 | __be16 tag; | ||
135 | __be32 length; | ||
136 | __be32 return_code; | ||
137 | }__attribute__((packed)); | ||
138 | |||
139 | struct stclear_flags_t { | ||
140 | __be16 tag; | ||
141 | u8 deactivated; | ||
142 | u8 disableForceClear; | ||
143 | u8 physicalPresence; | ||
144 | u8 physicalPresenceLock; | ||
145 | u8 bGlobalLock; | ||
146 | }__attribute__((packed)); | ||
147 | |||
148 | struct tpm_version_t { | ||
149 | u8 Major; | ||
150 | u8 Minor; | ||
151 | u8 revMajor; | ||
152 | u8 revMinor; | ||
153 | }__attribute__((packed)); | ||
154 | |||
155 | struct tpm_version_1_2_t { | ||
156 | __be16 tag; | ||
157 | u8 Major; | ||
158 | u8 Minor; | ||
159 | u8 revMajor; | ||
160 | u8 revMinor; | ||
161 | }__attribute__((packed)); | ||
162 | |||
163 | struct timeout_t { | ||
164 | __be32 a; | ||
165 | __be32 b; | ||
166 | __be32 c; | ||
167 | __be32 d; | ||
168 | }__attribute__((packed)); | ||
169 | |||
170 | struct duration_t { | ||
171 | __be32 tpm_short; | ||
172 | __be32 tpm_medium; | ||
173 | __be32 tpm_long; | ||
174 | }__attribute__((packed)); | ||
175 | |||
176 | struct permanent_flags_t { | ||
177 | __be16 tag; | ||
178 | u8 disable; | ||
179 | u8 ownership; | ||
180 | u8 deactivated; | ||
181 | u8 readPubek; | ||
182 | u8 disableOwnerClear; | ||
183 | u8 allowMaintenance; | ||
184 | u8 physicalPresenceLifetimeLock; | ||
185 | u8 physicalPresenceHWEnable; | ||
186 | u8 physicalPresenceCMDEnable; | ||
187 | u8 CEKPUsed; | ||
188 | u8 TPMpost; | ||
189 | u8 TPMpostLock; | ||
190 | u8 FIPS; | ||
191 | u8 operator; | ||
192 | u8 enableRevokeEK; | ||
193 | u8 nvLocked; | ||
194 | u8 readSRKPub; | ||
195 | u8 tpmEstablished; | ||
196 | u8 maintenanceDone; | ||
197 | u8 disableFullDALogicInfo; | ||
198 | }__attribute__((packed)); | ||
199 | |||
200 | typedef union { | ||
201 | struct permanent_flags_t perm_flags; | ||
202 | struct stclear_flags_t stclear_flags; | ||
203 | bool owned; | ||
204 | __be32 num_pcrs; | ||
205 | struct tpm_version_t tpm_version; | ||
206 | struct tpm_version_1_2_t tpm_version_1_2; | ||
207 | __be32 manufacturer_id; | ||
208 | struct timeout_t timeout; | ||
209 | struct duration_t duration; | ||
210 | } cap_t; | ||
211 | |||
212 | struct tpm_getcap_params_in { | ||
213 | __be32 cap; | ||
214 | __be32 subcap_size; | ||
215 | __be32 subcap; | ||
216 | }__attribute__((packed)); | ||
217 | |||
218 | struct tpm_getcap_params_out { | ||
219 | __be32 cap_size; | ||
220 | cap_t cap; | ||
221 | }__attribute__((packed)); | ||
222 | |||
223 | struct tpm_readpubek_params_out { | ||
224 | u8 algorithm[4]; | ||
225 | u8 encscheme[2]; | ||
226 | u8 sigscheme[2]; | ||
227 | u8 parameters[12]; /*assuming RSA*/ | ||
228 | __be32 keysize; | ||
229 | u8 modulus[256]; | ||
230 | u8 checksum[20]; | ||
231 | }__attribute__((packed)); | ||
232 | |||
233 | typedef union { | ||
234 | struct tpm_input_header in; | ||
235 | struct tpm_output_header out; | ||
236 | } tpm_cmd_header; | ||
237 | |||
238 | #define TPM_DIGEST_SIZE 20 | ||
239 | struct tpm_pcrread_out { | ||
240 | u8 pcr_result[TPM_DIGEST_SIZE]; | ||
241 | }__attribute__((packed)); | ||
242 | |||
243 | struct tpm_pcrread_in { | ||
244 | __be32 pcr_idx; | ||
245 | }__attribute__((packed)); | ||
246 | |||
247 | struct tpm_pcrextend_in { | ||
248 | __be32 pcr_idx; | ||
249 | u8 hash[TPM_DIGEST_SIZE]; | ||
250 | }__attribute__((packed)); | ||
251 | |||
252 | typedef union { | ||
253 | struct tpm_getcap_params_out getcap_out; | ||
254 | struct tpm_readpubek_params_out readpubek_out; | ||
255 | u8 readpubek_out_buffer[sizeof(struct tpm_readpubek_params_out)]; | ||
256 | struct tpm_getcap_params_in getcap_in; | ||
257 | struct tpm_pcrread_in pcrread_in; | ||
258 | struct tpm_pcrread_out pcrread_out; | ||
259 | struct tpm_pcrextend_in pcrextend_in; | ||
260 | } tpm_cmd_params; | ||
261 | |||
262 | struct tpm_cmd_t { | ||
263 | tpm_cmd_header header; | ||
264 | tpm_cmd_params params; | ||
265 | }__attribute__((packed)); | ||
266 | |||
267 | ssize_t tpm_getcap(struct device *, __be32, cap_t *, const char *); | ||
126 | 268 | ||
127 | extern void tpm_get_timeouts(struct tpm_chip *); | 269 | extern void tpm_get_timeouts(struct tpm_chip *); |
128 | extern void tpm_gen_interrupt(struct tpm_chip *); | 270 | extern void tpm_gen_interrupt(struct tpm_chip *); |