]>
Commit | Line | Data |
---|---|---|
085dcf01 ED |
1 | /** @file\r |
2 | Public API for the Tcg Core library to perform the lowest level TCG Data encoding.\r | |
b3548d32 | 3 | \r |
4b806739 | 4 | (TCG Storage Architecture Core Specification, Version 2.01, Revision 1.00,\r |
4b8552d7 | 5 | https://trustedcomputinggroup.org/tcg-storage-architecture-core-specification/)\r |
085dcf01 | 6 | \r |
4b806739 ED |
7 | Check http://trustedcomputinggroup.org for latest specification updates.\r |
8 | \r | |
9 | Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
289b714b | 10 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
085dcf01 ED |
11 | \r |
12 | **/\r | |
13 | \r | |
14 | #ifndef _TCG_CORE_H_\r | |
15 | #define _TCG_CORE_H_\r | |
16 | \r | |
17 | #include <IndustryStandard/TcgStorageCore.h>\r | |
18 | \r | |
d939a25d MK |
19 | #define ERROR_CHECK(arg) \\r |
20 | { \\r | |
21 | TCG_RESULT ret = (arg); \\r | |
22 | if (ret != TcgResultSuccess) { \\r | |
23 | DEBUG ((DEBUG_INFO, "ERROR_CHECK failed at %a:%u\n", __FILE__, DEBUG_LINE_NUMBER)); \\r | |
24 | return ret; \\r | |
25 | } \\r | |
085dcf01 ED |
26 | }\r |
27 | \r | |
28 | #define METHOD_STATUS_ERROR_CHECK(arg, failRet) \\r | |
29 | if ((arg) != TCG_METHOD_STATUS_CODE_SUCCESS) { \\r | |
0ca81c0d | 30 | DEBUG ((DEBUG_INFO, "Method Status error: 0x%02X (%a)\n", arg, TcgMethodStatusString(arg))); \\r |
085dcf01 ED |
31 | return (failRet); \\r |
32 | }\r | |
33 | \r | |
d939a25d MK |
34 | #define NULL_CHECK(arg) \\r |
35 | do { \\r | |
36 | if ((arg) == NULL) { \\r | |
37 | DEBUG ((DEBUG_INFO, "NULL_CHECK(%a) failed at %a:%u\n", #arg, __FILE__, DEBUG_LINE_NUMBER)); \\r | |
38 | return TcgResultFailureNullPointer; \\r | |
39 | } \\r | |
085dcf01 ED |
40 | } while (0)\r |
41 | \r | |
42 | #pragma pack(1)\r | |
43 | \r | |
44 | /**\r | |
45 | Tcg result codes.\r | |
46 | \r | |
47 | The result code indicates if the Tcg function call was successful or not\r | |
48 | **/\r | |
49 | typedef enum {\r | |
50 | //\r | |
51 | // This is the return result upon successful completion of a Tcg function call\r | |
52 | //\r | |
53 | TcgResultSuccess,\r | |
54 | \r | |
55 | //\r | |
56 | // This is the return "catchall" result for the failure of a Tcg function call\r | |
57 | //\r | |
58 | TcgResultFailure,\r | |
59 | \r | |
60 | //\r | |
61 | // This is the return result if a required parameter was Null for a Tcg function call\r | |
62 | //\r | |
63 | TcgResultFailureNullPointer,\r | |
64 | \r | |
65 | //\r | |
66 | // This is the return result if a required buffersize was 0 for a Tcg function call\r | |
67 | //\r | |
68 | TcgResultFailureZeroSize,\r | |
69 | \r | |
70 | //\r | |
71 | // This is the return result if a Tcg function call was executed out of order.\r | |
72 | // For instance, starting a Tcg subpacket before starting its Tcg packet.\r | |
73 | //\r | |
74 | TcgResultFailureInvalidAction,\r | |
75 | \r | |
76 | //\r | |
77 | // This is the return result if the buffersize provided is not big enough to add a requested Tcg encoded item.\r | |
78 | //\r | |
79 | TcgResultFailureBufferTooSmall,\r | |
80 | \r | |
81 | //\r | |
82 | // This is the return result for a Tcg parse function if the end of the parsed Buffer is reached, yet Data is still attempted to be retrieved.\r | |
83 | // For instance, attempting to retrieve another Tcg token from the Buffer after it has reached the end of the Tcg subpacket payload.\r | |
84 | //\r | |
85 | TcgResultFailureEndBuffer,\r | |
86 | \r | |
87 | //\r | |
88 | // This is the return result for a Tcg parse function if the Tcg Token item requested is not the expected type.\r | |
89 | // For instance, the caller requested to receive an integer and the Tcg token was a byte sequence.\r | |
90 | //\r | |
91 | TcgResultFailureInvalidType,\r | |
92 | } TCG_RESULT;\r | |
93 | \r | |
94 | //\r | |
95 | // Structure that is used to build the Tcg ComPacket. It contains the start Buffer pointer and the current position of the\r | |
96 | // Tcg ComPacket, current Tcg Packet and Tcg SubPacket. This structure must be initialized\r | |
97 | // by calling tcgInitTcgCreateStruct before it is used as parameter to any other Tcg function.\r | |
98 | // This structure should NOT be directly modified by the client of this library.\r | |
99 | //\r | |
100 | // NOTE: WE MAY MAKE THIS AN ABSTRACT STRUCTURE WITH A DEFINED SIZE AND KEEP THE VARIABLES\r | |
101 | // INTERNAL AND ONLY KNOWN TO THE TCG LIBRARY\r | |
102 | //\r | |
103 | // tcgInitTcgCreateStruct\r | |
104 | //\r | |
105 | typedef struct {\r | |
106 | //\r | |
107 | // Buffer allocated and freed by the client of the Tcg library.\r | |
108 | // This is the Buffer that shall contain the final Tcg encoded compacket.\r | |
109 | //\r | |
110 | VOID *Buffer;\r | |
111 | \r | |
112 | //\r | |
113 | // Size of the Buffer provided.\r | |
114 | //\r | |
115 | UINT32 BufferSize;\r | |
116 | \r | |
117 | //\r | |
c411b485 | 118 | // Pointer to the start of the Tcg ComPacket. It should point to a location within Buffer.\r |
085dcf01 ED |
119 | //\r |
120 | TCG_COM_PACKET *ComPacket;\r | |
121 | \r | |
122 | //\r | |
123 | // Current Tcg Packet that is being created. It should point to a location within Buffer.\r | |
124 | //\r | |
125 | TCG_PACKET *CurPacket;\r | |
126 | \r | |
127 | //\r | |
128 | // Current Tcg SubPacket that is being created. It should point to a location within Buffer.\r | |
129 | //\r | |
130 | TCG_SUB_PACKET *CurSubPacket;\r | |
131 | \r | |
132 | //\r | |
133 | // Flag used to indicate if the Buffer of the structure should be filled out.\r | |
134 | // This is intended to be used to support a use-case where the client of library\r | |
135 | // can perform all the desired tcg calls to determine what the actual Size of the final compacket will be.\r | |
136 | // Then the client can allocate the required Buffer Size and re-run the tcg calls.\r | |
137 | // THIS MAY NOT BE IMPLEMENTED... REQUIRES MORE THOUGHT BECAUSE YOU CANNOT SOLVE ISSUE FOR RECEIVE\r | |
138 | //\r | |
c411b485 | 139 | BOOLEAN DryRun;\r |
085dcf01 ED |
140 | } TCG_CREATE_STRUCT;\r |
141 | \r | |
142 | //\r | |
143 | // Structure that is used to parse the Tcg response received. It contains the response Buffer pointer\r | |
144 | // and the current position of the Tcg ComPacket, current Tcg Packet and Tcg SubPacket being parsed.\r | |
145 | // This structure must be initialized by calling tcgInitTcgParseStruct before it is used as parameter to any other Tcg parse function.\r | |
146 | // This structure should NOT be directly modified by the client of this library.\r | |
147 | //\r | |
148 | // NOTE: WE MAY MAKE THIS AN ABSTRACT STRUCTURE WITH A DEFINED SIZE AND KEEP THE VARIABLES\r | |
149 | // INTERNAL AND ONLY KNOWN TO THE TCG LIBRARY\r | |
150 | //\r | |
151 | // @sa tcgInitTcgParseStruct\r | |
152 | //\r | |
153 | typedef struct {\r | |
154 | //\r | |
155 | // Buffer allocated and freed by the client of the Tcg library.\r | |
156 | // This is the Buffer that contains the Tcg response to decode/parse.\r | |
157 | //\r | |
c411b485 | 158 | const VOID *Buffer;\r |
085dcf01 ED |
159 | \r |
160 | //\r | |
c411b485 | 161 | // Size of the Buffer provided.\r |
085dcf01 | 162 | //\r |
c411b485 | 163 | UINT32 BufferSize;\r |
085dcf01 ED |
164 | \r |
165 | //\r | |
166 | // Pointer to the start of the Tcg ComPacket. It should point to a location within Buffer.\r | |
167 | //\r | |
c411b485 | 168 | TCG_COM_PACKET *ComPacket;\r |
085dcf01 ED |
169 | \r |
170 | //\r | |
171 | // Current Tcg Packet that is being created. It should point to a location within Buffer.\r | |
172 | //\r | |
c411b485 | 173 | TCG_PACKET *CurPacket;\r |
085dcf01 ED |
174 | \r |
175 | //\r | |
176 | // Current Tcg SubPacket that is being created. It should point to a location within Buffer.\r | |
177 | //\r | |
c411b485 | 178 | TCG_SUB_PACKET *CurSubPacket;\r |
085dcf01 ED |
179 | \r |
180 | //\r | |
181 | // Current pointer within the current subpacket payload.\r | |
182 | //\r | |
c411b485 MK |
183 | UINT8 *CurPtr;\r |
184 | } TCG_PARSE_STRUCT;\r | |
085dcf01 ED |
185 | \r |
186 | //\r | |
187 | // Structure that is used to represent a Tcg Token that is retrieved by Tcg parse functions.\r | |
188 | //\r | |
189 | typedef struct {\r | |
190 | //\r | |
191 | // Describes the type of Tcg token the Hdr start points to.\r | |
192 | //\r | |
193 | TCG_TOKEN_TYPE Type;\r | |
194 | \r | |
195 | //\r | |
196 | // Pointer to the beginning of the Header of the Tcg token\r | |
197 | //\r | |
198 | UINT8 *HdrStart;\r | |
c411b485 | 199 | } TCG_TOKEN;\r |
085dcf01 ED |
200 | \r |
201 | /**\r | |
202 | \r | |
203 | Required to be called before calling any other Tcg functions with the TCG_CREATE_STRUCT.\r | |
204 | Initializes the packet variables to NULL. Additionally, the buffer will be memset.\r | |
205 | \r | |
206 | @param[in/out] CreateStruct Structure to initialize\r | |
207 | @param[in] Buffer Buffer allocated by client of library. It will contain the Tcg encoded packet. This cannot be null.\r | |
208 | @param[in] BufferSize Size of buffer provided. It cannot be 0.\r | |
209 | \r | |
210 | **/\r | |
211 | TCG_RESULT\r | |
212 | EFIAPI\r | |
c411b485 MK |
213 | TcgInitTcgCreateStruct (\r |
214 | TCG_CREATE_STRUCT *CreateStruct,\r | |
215 | VOID *Buffer,\r | |
216 | UINT32 BufferSize\r | |
085dcf01 ED |
217 | );\r |
218 | \r | |
085dcf01 ED |
219 | /**\r |
220 | \r | |
221 | Encodes the ComPacket header to the data structure.\r | |
222 | \r | |
223 | @param[in/out] CreateStruct Structure to initialize\r | |
224 | @param[in] ComId ComID of the Tcg ComPacket.\r | |
225 | @param[in] ComIdExtension ComID Extension of the Tcg ComPacket.\r | |
226 | \r | |
227 | **/\r | |
228 | TCG_RESULT\r | |
229 | EFIAPI\r | |
c411b485 MK |
230 | TcgStartComPacket (\r |
231 | TCG_CREATE_STRUCT *CreateStruct,\r | |
232 | UINT16 ComId,\r | |
233 | UINT16 ComIdExtension\r | |
085dcf01 ED |
234 | );\r |
235 | \r | |
085dcf01 ED |
236 | /**\r |
237 | \r | |
238 | Starts a new ComPacket in the Data structure.\r | |
239 | \r | |
240 | @param[in/out] CreateStruct Structure used to add Tcg Packet\r | |
241 | @param[in] Tsn Packet Tper session number\r | |
242 | @param[in] Hsn Packet Host session number\r | |
243 | @param[in] SeqNumber Packet Sequence Number\r | |
244 | @param[in] AckType Packet Acknowledge Type\r | |
245 | @param[in] Ack Packet Acknowledge\r | |
246 | \r | |
247 | **/\r | |
248 | TCG_RESULT\r | |
249 | EFIAPI\r | |
c411b485 MK |
250 | TcgStartPacket (\r |
251 | TCG_CREATE_STRUCT *CreateStruct,\r | |
252 | UINT32 Tsn,\r | |
253 | UINT32 Hsn,\r | |
254 | UINT32 SeqNumber,\r | |
255 | UINT16 AckType,\r | |
256 | UINT32 Ack\r | |
085dcf01 ED |
257 | );\r |
258 | \r | |
259 | /**\r | |
260 | \r | |
261 | Starts a new SubPacket in the Data structure.\r | |
262 | \r | |
263 | @param[in/out] CreateStruct Structure used to start Tcg SubPacket\r | |
264 | @param[in] Kind SubPacket kind\r | |
265 | \r | |
266 | **/\r | |
267 | TCG_RESULT\r | |
268 | EFIAPI\r | |
c411b485 MK |
269 | TcgStartSubPacket (\r |
270 | TCG_CREATE_STRUCT *CreateStruct,\r | |
271 | UINT16 Kind\r | |
085dcf01 ED |
272 | );\r |
273 | \r | |
085dcf01 ED |
274 | /**\r |
275 | \r | |
276 | Ends the current SubPacket in the Data structure. This function will also perform the 4-byte padding\r | |
277 | required for Subpackets.\r | |
278 | \r | |
279 | @param[in/out] CreateStruct Structure used to end the current Tcg SubPacket\r | |
280 | \r | |
281 | **/\r | |
282 | TCG_RESULT\r | |
283 | EFIAPI\r | |
c411b485 MK |
284 | TcgEndSubPacket (\r |
285 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
286 | );\r |
287 | \r | |
085dcf01 ED |
288 | /**\r |
289 | \r | |
290 | Ends the current Packet in the Data structure.\r | |
291 | \r | |
292 | @param[in/out] CreateStruct Structure used to end the current Tcg Packet\r | |
293 | \r | |
294 | **/\r | |
295 | TCG_RESULT\r | |
296 | EFIAPI\r | |
c411b485 MK |
297 | TcgEndPacket (\r |
298 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
299 | );\r |
300 | \r | |
085dcf01 ED |
301 | /**\r |
302 | \r | |
303 | Ends the ComPacket in the Data structure and ret\r | |
304 | \r | |
305 | @param[in/out] CreateStruct Structure used to end the Tcg ComPacket\r | |
306 | @param[in/out] Size Describes the Size of the entire ComPacket (Header and payload). Filled out by function.\r | |
307 | \r | |
308 | **/\r | |
309 | TCG_RESULT\r | |
310 | EFIAPI\r | |
c411b485 MK |
311 | TcgEndComPacket (\r |
312 | TCG_CREATE_STRUCT *CreateStruct,\r | |
313 | UINT32 *Size\r | |
085dcf01 ED |
314 | );\r |
315 | \r | |
316 | /**\r | |
317 | Adds a single raw token byte to the Data structure.\r | |
318 | \r | |
319 | @param[in/out] CreateStruct Structure used to add the byte\r | |
320 | @param [in] Byte Byte to add\r | |
321 | \r | |
322 | **/\r | |
323 | TCG_RESULT\r | |
324 | EFIAPI\r | |
c411b485 | 325 | TcgAddRawByte (\r |
085dcf01 ED |
326 | TCG_CREATE_STRUCT *CreateStruct,\r |
327 | UINT8 Byte\r | |
328 | );\r | |
329 | \r | |
085dcf01 ED |
330 | /**\r |
331 | \r | |
332 | Adds the Data parameter as a byte sequence to the Data structure.\r | |
333 | \r | |
334 | @param [in/out] CreateStruct Structure used to add the byte sequence\r | |
335 | @param[in] Data Byte sequence that will be encoded and copied into Data structure\r | |
336 | @param[in] DataSize Length of Data provided\r | |
337 | @param[in] Continued TRUE if byte sequence is continued or\r | |
338 | FALSE if the Data contains the entire byte sequence to be encoded\r | |
339 | \r | |
340 | **/\r | |
341 | TCG_RESULT\r | |
342 | EFIAPI\r | |
c411b485 MK |
343 | TcgAddByteSequence (\r |
344 | TCG_CREATE_STRUCT *CreateStruct,\r | |
345 | const VOID *Data,\r | |
346 | UINT32 DataSize,\r | |
347 | BOOLEAN Continued\r | |
085dcf01 ED |
348 | );\r |
349 | \r | |
085dcf01 ED |
350 | /**\r |
351 | \r | |
352 | Adds an arbitrary-Length integer to the Data structure.\r | |
353 | \r | |
354 | The integer will be encoded using the shortest possible atom.\r | |
355 | \r | |
356 | @param[in/out] CreateStruct Structure used to add the integer\r | |
357 | @param[in] Data Integer in host byte order that will be encoded and copied into Data structure\r | |
358 | @param[in] DataSize Length in bytes of the Data provided\r | |
359 | @param[in] SignedInteger TRUE if the integer is signed or FALSE if the integer is unsigned\r | |
360 | \r | |
361 | **/\r | |
362 | TCG_RESULT\r | |
363 | EFIAPI\r | |
c411b485 | 364 | TcgAddInteger (\r |
085dcf01 ED |
365 | TCG_CREATE_STRUCT *CreateStruct,\r |
366 | const VOID *Data,\r | |
367 | UINT32 DataSize,\r | |
368 | BOOLEAN SignedInteger\r | |
369 | );\r | |
370 | \r | |
085dcf01 ED |
371 | /**\r |
372 | Adds an 8-bit unsigned integer to the Data structure.\r | |
373 | \r | |
374 | @param[in/out] CreateStruct Structure used to add the integer\r | |
375 | @param[in] Value Integer Value to add\r | |
376 | \r | |
377 | **/\r | |
378 | TCG_RESULT\r | |
379 | EFIAPI\r | |
c411b485 MK |
380 | TcgAddUINT8 (\r |
381 | TCG_CREATE_STRUCT *CreateStruct,\r | |
382 | UINT8 Value\r | |
085dcf01 ED |
383 | );\r |
384 | \r | |
385 | /**\r | |
386 | \r | |
387 | Adds a 16-bit unsigned integer to the Data structure.\r | |
388 | \r | |
389 | @param[in/out] CreateStruct Structure used to add the integer\r | |
390 | @param[in] Value Integer Value to add\r | |
391 | \r | |
392 | **/\r | |
393 | TCG_RESULT\r | |
394 | EFIAPI\r | |
395 | TcgAddUINT16 (\r | |
c411b485 MK |
396 | TCG_CREATE_STRUCT *CreateStruct,\r |
397 | UINT16 Value\r | |
085dcf01 ED |
398 | );\r |
399 | \r | |
400 | /**\r | |
401 | \r | |
402 | Adds a 32-bit unsigned integer to the Data structure.\r | |
403 | \r | |
404 | @param[in/out] CreateStruct Structure used to add the integer\r | |
405 | @param[in] Value Integer Value to add\r | |
406 | \r | |
407 | **/\r | |
408 | TCG_RESULT\r | |
409 | EFIAPI\r | |
c411b485 MK |
410 | TcgAddUINT32 (\r |
411 | TCG_CREATE_STRUCT *CreateStruct,\r | |
412 | UINT32 Value\r | |
085dcf01 ED |
413 | );\r |
414 | \r | |
085dcf01 ED |
415 | /**\r |
416 | \r | |
417 | Adds a 64-bit unsigned integer to the Data structure.\r | |
418 | \r | |
419 | @param[in/out] CreateStruct Structure used to add the integer\r | |
420 | @param[in] Value Integer Value to add\r | |
421 | \r | |
422 | **/\r | |
423 | TCG_RESULT\r | |
424 | EFIAPI\r | |
c411b485 MK |
425 | TcgAddUINT64 (\r |
426 | TCG_CREATE_STRUCT *CreateStruct,\r | |
427 | UINT64 Value\r | |
085dcf01 ED |
428 | );\r |
429 | \r | |
430 | /**\r | |
431 | Adds a BOOLEAN to the Data structure.\r | |
432 | \r | |
433 | @param[in/out] CreateStruct Structure used to add the integer\r | |
434 | @param[in] Value BOOLEAN Value to add\r | |
435 | \r | |
436 | **/\r | |
437 | TCG_RESULT\r | |
438 | EFIAPI\r | |
c411b485 MK |
439 | TcgAddBOOLEAN (\r |
440 | TCG_CREATE_STRUCT *CreateStruct,\r | |
441 | BOOLEAN Value\r | |
085dcf01 ED |
442 | );\r |
443 | \r | |
444 | /**\r | |
445 | Add tcg uid info.\r | |
446 | \r | |
447 | @param [in/out] CreateStruct Structure used to add the integer\r | |
448 | @param Uid Input uid info.\r | |
449 | \r | |
450 | @retval return the action result.\r | |
451 | \r | |
452 | **/\r | |
453 | TCG_RESULT\r | |
454 | EFIAPI\r | |
c411b485 MK |
455 | TcgAddTcgUid (\r |
456 | TCG_CREATE_STRUCT *CreateStruct,\r | |
457 | TCG_UID Uid\r | |
085dcf01 ED |
458 | );\r |
459 | \r | |
460 | /**\r | |
461 | Adds a Start List token to the Data structure.\r | |
462 | \r | |
463 | @param[in/out] CreateStruct Structure used to add the token\r | |
464 | \r | |
465 | **/\r | |
466 | TCG_RESULT\r | |
467 | EFIAPI\r | |
c411b485 MK |
468 | TcgAddStartList (\r |
469 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
470 | );\r |
471 | \r | |
085dcf01 ED |
472 | /**\r |
473 | \r | |
474 | Adds an End List token to the Data structure.\r | |
475 | \r | |
476 | @param [in/out] CreateStruct Structure used to add the token\r | |
477 | \r | |
478 | **/\r | |
479 | TCG_RESULT\r | |
480 | EFIAPI\r | |
c411b485 MK |
481 | TcgAddEndList (\r |
482 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
483 | );\r |
484 | \r | |
085dcf01 ED |
485 | /**\r |
486 | Adds a Start Name token to the Data structure.\r | |
487 | \r | |
488 | @param[in/out] CreateStruct Structure used to add the token\r | |
489 | \r | |
490 | **/\r | |
491 | TCG_RESULT\r | |
492 | EFIAPI\r | |
c411b485 MK |
493 | TcgAddStartName (\r |
494 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
495 | );\r |
496 | \r | |
085dcf01 ED |
497 | /**\r |
498 | \r | |
499 | Adds an End Name token to the Data structure.\r | |
500 | \r | |
501 | @param [in/out] CreateStruct Structure used to add the token\r | |
502 | \r | |
503 | **/\r | |
504 | TCG_RESULT\r | |
505 | EFIAPI\r | |
c411b485 MK |
506 | TcgAddEndName (\r |
507 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
508 | );\r |
509 | \r | |
085dcf01 ED |
510 | /**\r |
511 | Adds a Call token to the Data structure.\r | |
512 | \r | |
513 | @param [in/out] CreateStruct Structure used to add the token\r | |
514 | \r | |
515 | **/\r | |
516 | TCG_RESULT\r | |
517 | EFIAPI\r | |
c411b485 MK |
518 | TcgAddCall (\r |
519 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
520 | );\r |
521 | \r | |
085dcf01 ED |
522 | /**\r |
523 | \r | |
524 | Adds an End of Data token to the Data structure.\r | |
525 | \r | |
526 | @param[in/out] CreateStruct Structure used to add the token\r | |
527 | \r | |
528 | **/\r | |
529 | TCG_RESULT\r | |
530 | EFIAPI\r | |
c411b485 MK |
531 | TcgAddEndOfData (\r |
532 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
533 | );\r |
534 | \r | |
085dcf01 ED |
535 | /**\r |
536 | \r | |
537 | Adds an End of Session token to the Data structure.\r | |
538 | \r | |
539 | @param [in/out] CreateStruct Structure used to add the token\r | |
540 | \r | |
541 | **/\r | |
542 | TCG_RESULT\r | |
543 | EFIAPI\r | |
c411b485 MK |
544 | TcgAddEndOfSession (\r |
545 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
546 | );\r |
547 | \r | |
085dcf01 ED |
548 | /**\r |
549 | Adds a Start Transaction token to the Data structure.\r | |
550 | \r | |
551 | @param [in/out] CreateStruct Structure used to add the token\r | |
552 | \r | |
553 | **/\r | |
554 | TCG_RESULT\r | |
555 | EFIAPI\r | |
c411b485 MK |
556 | TcgAddStartTransaction (\r |
557 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
558 | );\r |
559 | \r | |
085dcf01 ED |
560 | /**\r |
561 | Adds an End Transaction token to the Data structure.\r | |
562 | \r | |
563 | @param[in/out] CreateStruct Structure used to add the token\r | |
564 | \r | |
565 | **/\r | |
566 | TCG_RESULT\r | |
567 | EFIAPI\r | |
c411b485 MK |
568 | TcgAddEndTransaction (\r |
569 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
570 | );\r |
571 | \r | |
572 | /**\r | |
dd40a1f8 | 573 | Initial the tcg parse structure.\r |
085dcf01 ED |
574 | \r |
575 | @param ParseStruct Input parse structure.\r | |
576 | @param Buffer Input buffer data.\r | |
577 | @param BufferSize Input buffer size.\r | |
578 | \r | |
579 | @retval return the action result.\r | |
580 | \r | |
581 | **/\r | |
582 | TCG_RESULT\r | |
583 | EFIAPI\r | |
c411b485 MK |
584 | TcgInitTcgParseStruct (\r |
585 | TCG_PARSE_STRUCT *ParseStruct,\r | |
586 | const VOID *Buffer,\r | |
587 | UINT32 BufferSize\r | |
085dcf01 ED |
588 | );\r |
589 | \r | |
590 | /**\r | |
591 | Get next token info.\r | |
592 | \r | |
593 | @param ParseStruct Input parse structure info.\r | |
594 | @param TcgToken return the tcg token info.\r | |
595 | \r | |
596 | @retval return the action result.\r | |
597 | \r | |
598 | **/\r | |
599 | TCG_RESULT\r | |
600 | EFIAPI\r | |
c411b485 MK |
601 | TcgGetNextToken (\r |
602 | TCG_PARSE_STRUCT *ParseStruct,\r | |
603 | TCG_TOKEN *TcgToken\r | |
085dcf01 ED |
604 | );\r |
605 | \r | |
606 | /**\r | |
607 | Get next token Type.\r | |
608 | \r | |
609 | @param ParseStruct Input parse structure.\r | |
610 | @param Type Input the type need to check.\r | |
611 | \r | |
612 | @retval return the action result.\r | |
613 | \r | |
614 | **/\r | |
615 | TCG_RESULT\r | |
616 | EFIAPI\r | |
c411b485 MK |
617 | TcgGetNextTokenType (\r |
618 | TCG_PARSE_STRUCT *ParseStruct,\r | |
619 | TCG_TOKEN_TYPE Type\r | |
085dcf01 ED |
620 | );\r |
621 | \r | |
622 | /**\r | |
623 | Get atom info.\r | |
624 | \r | |
625 | @param TcgToken Input token info.\r | |
626 | @param HeaderLength return the header length.\r | |
627 | @param DataLength return the data length.\r | |
628 | @param ByteOrInt return the atom Type.\r | |
629 | @param SignOrCont return the sign or count info.\r | |
630 | \r | |
631 | @retval return the action result.\r | |
632 | \r | |
633 | **/\r | |
634 | TCG_RESULT\r | |
635 | EFIAPI\r | |
c411b485 MK |
636 | TcgGetAtomInfo (\r |
637 | const TCG_TOKEN *TcgToken,\r | |
638 | UINT32 *HeaderLength,\r | |
639 | UINT32 *DataLength,\r | |
640 | UINT8 *ByteOrInt,\r | |
641 | UINT8 *SignOrCont\r | |
085dcf01 ED |
642 | );\r |
643 | \r | |
644 | /**\r | |
645 | Get token byte sequence.\r | |
646 | \r | |
647 | @param TcgToken Input token info.\r | |
648 | @param Length Input the length info.\r | |
649 | \r | |
650 | @retval Return the value data.\r | |
651 | \r | |
652 | **/\r | |
c411b485 | 653 | UINT8 *\r |
085dcf01 | 654 | EFIAPI\r |
c411b485 MK |
655 | TcgGetTokenByteSequence (\r |
656 | const TCG_TOKEN *TcgToken,\r | |
657 | UINT32 *Length\r | |
085dcf01 ED |
658 | );\r |
659 | \r | |
660 | /**\r | |
661 | Get token specified value.\r | |
662 | \r | |
663 | @param TcgToken Input token info.\r | |
664 | @param Value return the value.\r | |
665 | \r | |
666 | @retval return the action result.\r | |
667 | \r | |
668 | **/\r | |
669 | TCG_RESULT\r | |
670 | EFIAPI\r | |
c411b485 MK |
671 | TcgGetTokenUINT64 (\r |
672 | const TCG_TOKEN *TcgToken,\r | |
673 | UINT64 *Value\r | |
085dcf01 ED |
674 | );\r |
675 | \r | |
085dcf01 ED |
676 | /**\r |
677 | Get next specify value.\r | |
678 | \r | |
679 | @param ParseStruct Input parse structure.\r | |
d6b926e7 | 680 | @param Value Return value.\r |
085dcf01 ED |
681 | \r |
682 | @retval return the action result.\r | |
683 | \r | |
684 | **/\r | |
685 | TCG_RESULT\r | |
686 | EFIAPI\r | |
c411b485 MK |
687 | TcgGetNextUINT8 (\r |
688 | TCG_PARSE_STRUCT *ParseStruct,\r | |
689 | UINT8 *Value\r | |
085dcf01 ED |
690 | );\r |
691 | \r | |
085dcf01 ED |
692 | /**\r |
693 | Get next specify value.\r | |
694 | \r | |
695 | @param ParseStruct Input parse structure.\r | |
d6b926e7 | 696 | @param Value Return value.\r |
085dcf01 ED |
697 | \r |
698 | @retval return the action result.\r | |
699 | \r | |
700 | **/\r | |
701 | TCG_RESULT\r | |
702 | EFIAPI\r | |
c411b485 MK |
703 | TcgGetNextUINT16 (\r |
704 | TCG_PARSE_STRUCT *ParseStruct,\r | |
705 | UINT16 *Value\r | |
085dcf01 ED |
706 | );\r |
707 | \r | |
708 | /**\r | |
709 | Get next specify value.\r | |
710 | \r | |
711 | @param ParseStruct Input parse structure.\r | |
d6b926e7 | 712 | @param Value Return value.\r |
085dcf01 ED |
713 | \r |
714 | @retval return the action result.\r | |
715 | \r | |
716 | **/\r | |
717 | TCG_RESULT\r | |
718 | EFIAPI\r | |
c411b485 MK |
719 | TcgGetNextUINT32 (\r |
720 | TCG_PARSE_STRUCT *ParseStruct,\r | |
721 | UINT32 *Value\r | |
085dcf01 ED |
722 | );\r |
723 | \r | |
724 | /**\r | |
725 | Get next specify value.\r | |
726 | \r | |
727 | @param ParseStruct Input parse structure.\r | |
d6b926e7 | 728 | @param Value Return value.\r |
085dcf01 ED |
729 | \r |
730 | @retval return the action result.\r | |
731 | \r | |
732 | **/\r | |
733 | TCG_RESULT\r | |
734 | EFIAPI\r | |
c411b485 MK |
735 | TcgGetNextUINT64 (\r |
736 | TCG_PARSE_STRUCT *ParseStruct,\r | |
737 | UINT64 *Value\r | |
085dcf01 ED |
738 | );\r |
739 | \r | |
740 | /**\r | |
741 | Get next specify value.\r | |
742 | \r | |
743 | @param ParseStruct Input parse structure.\r | |
d6b926e7 | 744 | @param Value Return value.\r |
085dcf01 ED |
745 | \r |
746 | @retval return the action result.\r | |
747 | \r | |
748 | **/\r | |
749 | TCG_RESULT\r | |
750 | EFIAPI\r | |
c411b485 MK |
751 | TcgGetNextBOOLEAN (\r |
752 | TCG_PARSE_STRUCT *ParseStruct,\r | |
753 | BOOLEAN *Value\r | |
085dcf01 ED |
754 | );\r |
755 | \r | |
756 | /**\r | |
757 | Get next tcg uid info.\r | |
758 | \r | |
759 | @param ParseStruct Input parse structure.\r | |
760 | @param Uid Get the uid info.\r | |
761 | \r | |
762 | @retval return the action result.\r | |
763 | \r | |
764 | **/\r | |
765 | TCG_RESULT\r | |
766 | EFIAPI\r | |
c411b485 MK |
767 | TcgGetNextTcgUid (\r |
768 | TCG_PARSE_STRUCT *ParseStruct,\r | |
769 | TCG_UID *Uid\r | |
085dcf01 ED |
770 | );\r |
771 | \r | |
772 | /**\r | |
773 | Get next byte sequence.\r | |
774 | \r | |
775 | @param ParseStruct Input parse structure.\r | |
776 | @param Data return the data.\r | |
777 | @param Length return the length.\r | |
778 | \r | |
779 | @retval return the action result.\r | |
780 | \r | |
781 | **/\r | |
782 | TCG_RESULT\r | |
783 | EFIAPI\r | |
c411b485 MK |
784 | TcgGetNextByteSequence (\r |
785 | TCG_PARSE_STRUCT *ParseStruct,\r | |
786 | const VOID **Data,\r | |
787 | UINT32 *Length\r | |
085dcf01 ED |
788 | );\r |
789 | \r | |
790 | /**\r | |
791 | Get next start list.\r | |
792 | \r | |
793 | @param ParseStruct Input parse structure.\r | |
794 | \r | |
795 | @retval return the action result.\r | |
796 | \r | |
797 | **/\r | |
798 | TCG_RESULT\r | |
799 | EFIAPI\r | |
c411b485 MK |
800 | TcgGetNextStartList (\r |
801 | TCG_PARSE_STRUCT *ParseStruct\r | |
085dcf01 ED |
802 | );\r |
803 | \r | |
804 | /**\r | |
805 | Get next end list.\r | |
806 | \r | |
807 | @param ParseStruct Input parse structure.\r | |
808 | \r | |
809 | @retval return the action result.\r | |
810 | \r | |
811 | **/\r | |
812 | TCG_RESULT\r | |
813 | EFIAPI\r | |
c411b485 MK |
814 | TcgGetNextEndList (\r |
815 | TCG_PARSE_STRUCT *ParseStruct\r | |
085dcf01 ED |
816 | );\r |
817 | \r | |
818 | /**\r | |
819 | Get next start name.\r | |
820 | \r | |
821 | @param ParseStruct Input parse structure.\r | |
822 | \r | |
823 | @retval return the action result.\r | |
824 | \r | |
825 | **/\r | |
826 | TCG_RESULT\r | |
827 | EFIAPI\r | |
c411b485 MK |
828 | TcgGetNextStartName (\r |
829 | TCG_PARSE_STRUCT *ParseStruct\r | |
085dcf01 ED |
830 | );\r |
831 | \r | |
832 | /**\r | |
833 | Get next end name.\r | |
834 | \r | |
835 | @param ParseStruct Input parse structure.\r | |
836 | \r | |
837 | @retval return the action result.\r | |
838 | \r | |
839 | **/\r | |
840 | TCG_RESULT\r | |
841 | EFIAPI\r | |
c411b485 MK |
842 | TcgGetNextEndName (\r |
843 | TCG_PARSE_STRUCT *ParseStruct\r | |
085dcf01 ED |
844 | );\r |
845 | \r | |
846 | /**\r | |
847 | Get next call.\r | |
848 | \r | |
849 | @param ParseStruct Input parse structure.\r | |
850 | \r | |
851 | @retval return the action result.\r | |
852 | \r | |
853 | **/\r | |
854 | TCG_RESULT\r | |
855 | EFIAPI\r | |
c411b485 MK |
856 | TcgGetNextCall (\r |
857 | TCG_PARSE_STRUCT *ParseStruct\r | |
085dcf01 ED |
858 | );\r |
859 | \r | |
860 | /**\r | |
861 | Get next end data.\r | |
862 | \r | |
863 | @param ParseStruct Input parse structure.\r | |
864 | \r | |
865 | @retval return the action result.\r | |
866 | \r | |
867 | **/\r | |
868 | TCG_RESULT\r | |
869 | EFIAPI\r | |
c411b485 MK |
870 | TcgGetNextEndOfData (\r |
871 | TCG_PARSE_STRUCT *ParseStruct\r | |
085dcf01 ED |
872 | );\r |
873 | \r | |
874 | /**\r | |
875 | Get next end of session.\r | |
876 | \r | |
877 | @param ParseStruct Input parse structure.\r | |
878 | \r | |
879 | @retval return the action result.\r | |
880 | \r | |
881 | **/\r | |
882 | TCG_RESULT\r | |
883 | EFIAPI\r | |
c411b485 MK |
884 | TcgGetNextEndOfSession (\r |
885 | TCG_PARSE_STRUCT *ParseStruct\r | |
085dcf01 ED |
886 | );\r |
887 | \r | |
888 | /**\r | |
889 | Get next start transaction.\r | |
890 | \r | |
891 | @param ParseStruct Input parse structure.\r | |
892 | \r | |
893 | @retval return the action result.\r | |
894 | \r | |
895 | **/\r | |
896 | TCG_RESULT\r | |
897 | EFIAPI\r | |
c411b485 MK |
898 | TcgGetNextStartTransaction (\r |
899 | TCG_PARSE_STRUCT *ParseStruct\r | |
085dcf01 ED |
900 | );\r |
901 | \r | |
902 | /**\r | |
903 | Get next end transaction.\r | |
904 | \r | |
905 | @param ParseStruct Input parse structure.\r | |
906 | \r | |
907 | @retval return the action result.\r | |
908 | \r | |
909 | **/\r | |
910 | TCG_RESULT\r | |
911 | EFIAPI\r | |
c411b485 MK |
912 | TcgGetNextEndTransaction (\r |
913 | TCG_PARSE_STRUCT *ParseStruct\r | |
085dcf01 ED |
914 | );\r |
915 | \r | |
916 | // end of parse functions\r | |
917 | \r | |
085dcf01 ED |
918 | typedef\r |
919 | BOOLEAN\r | |
c411b485 | 920 | (EFIAPI *TCG_LEVEL0_ENUM_CALLBACK)(\r |
085dcf01 ED |
921 | const TCG_LEVEL0_DISCOVERY_HEADER *DiscoveryHeader,\r |
922 | TCG_LEVEL0_FEATURE_DESCRIPTOR_HEADER *Feature,\r | |
923 | UINTN FeatureSize, // includes header\r | |
924 | VOID *Context\r | |
c411b485 | 925 | );\r |
085dcf01 ED |
926 | \r |
927 | /**\r | |
928 | Adds call token and method Header (invoking id, and method id).\r | |
929 | \r | |
930 | @param CreateStruct The input create structure.\r | |
931 | @param InvokingId Invoking id.\r | |
932 | @param MethodId Method id.\r | |
933 | \r | |
934 | **/\r | |
935 | TCG_RESULT\r | |
936 | EFIAPI\r | |
c411b485 MK |
937 | TcgStartMethodCall (\r |
938 | TCG_CREATE_STRUCT *CreateStruct,\r | |
939 | TCG_UID InvokingId,\r | |
940 | TCG_UID MethodId\r | |
085dcf01 ED |
941 | );\r |
942 | \r | |
943 | /**\r | |
944 | Adds START LIST token.\r | |
945 | \r | |
946 | @param CreateStruct The input create structure.\r | |
947 | \r | |
948 | **/\r | |
949 | TCG_RESULT\r | |
950 | EFIAPI\r | |
c411b485 MK |
951 | TcgStartParameters (\r |
952 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
953 | );\r |
954 | \r | |
955 | /**\r | |
956 | Adds END LIST token.\r | |
957 | \r | |
958 | @param CreateStruct The input create structure.\r | |
959 | \r | |
960 | **/\r | |
961 | TCG_RESULT\r | |
962 | EFIAPI\r | |
c411b485 MK |
963 | TcgEndParameters (\r |
964 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
965 | );\r |
966 | \r | |
967 | /**\r | |
968 | Adds END Data token and method list.\r | |
969 | \r | |
970 | @param CreateStruct The input create structure.\r | |
971 | \r | |
972 | **/\r | |
973 | TCG_RESULT\r | |
974 | EFIAPI\r | |
c411b485 MK |
975 | TcgEndMethodCall (\r |
976 | TCG_CREATE_STRUCT *CreateStruct\r | |
085dcf01 ED |
977 | );\r |
978 | \r | |
979 | /**\r | |
980 | \r | |
981 | Adds Start Session call to the data structure. This creates the entire ComPacket structure and\r | |
982 | returns the size of the entire compacket in the size parameter.\r | |
983 | \r | |
984 | @param [in/out] CreateStruct Structure used to add the start session call\r | |
985 | @param [in/out] Size Describes the size of the entire ComPacket (header and payload). Filled out by function.\r | |
986 | @param [in] ComId ComID for the ComPacket\r | |
987 | @param [in] ComIdExtension Extended ComID for the ComPacket\r | |
988 | @param [in] HostSessionId Host Session ID\r | |
989 | @param [in] SpId Security Provider to start session with\r | |
990 | @param [in] Write Write option for start session. TRUE = start session requests write access\r | |
991 | @param [in] HostChallengeLength Length of the host challenge. Length should be 0 if hostChallenge is NULL\r | |
992 | @param [in] HostChallenge Host challenge for Host Signing Authority. If NULL, then no Host Challenge shall be sent.\r | |
993 | @param [in] HostSigningAuthority Host Signing Authority used for start session. If NULL, then no Host Signing Authority shall be sent.\r | |
994 | \r | |
995 | **/\r | |
996 | TCG_RESULT\r | |
997 | EFIAPI\r | |
c411b485 MK |
998 | TcgCreateStartSession (\r |
999 | TCG_CREATE_STRUCT *CreateStruct,\r | |
1000 | UINT32 *Size,\r | |
1001 | UINT16 ComId,\r | |
1002 | UINT16 ComIdExtension,\r | |
1003 | UINT32 HostSessionId,\r | |
1004 | TCG_UID SpId,\r | |
1005 | BOOLEAN Write,\r | |
1006 | UINT32 HostChallengeLength,\r | |
1007 | const VOID *HostChallenge,\r | |
1008 | TCG_UID HostSigningAuthority\r | |
085dcf01 ED |
1009 | );\r |
1010 | \r | |
1011 | /**\r | |
1012 | Creates ComPacket with a Method call that sets the PIN column for the row specified.\r | |
1013 | This assumes a start session has already been opened with the desired SP.\r | |
1014 | \r | |
1015 | @param [in/out] CreateStruct Structure used to add method call.\r | |
1016 | @param [in/out] Size Describes the size of the entire ComPacket (header and payload). Filled out by function.\r | |
1017 | @param [in] ComId ComID for the ComPacket\r | |
1018 | @param [in] ComIdExtension Extended ComID for the ComPacket\r | |
1019 | @param [in] TperSession Tper Session ID for the Packet\r | |
1020 | @param [in] HostSession Host Session ID for the Packet\r | |
1021 | @param [in] SidRow UID of row of current SP to set PIN column\r | |
1022 | @param [in] Password value of PIN to set\r | |
1023 | @param [in] PasswordSize Size of PIN\r | |
1024 | \r | |
1025 | **/\r | |
1026 | TCG_RESULT\r | |
1027 | EFIAPI\r | |
c411b485 MK |
1028 | TcgCreateSetCPin (\r |
1029 | TCG_CREATE_STRUCT *CreateStruct,\r | |
1030 | UINT32 *Size,\r | |
1031 | UINT16 ComId,\r | |
1032 | UINT16 ComIdExtension,\r | |
1033 | UINT32 TperSession,\r | |
1034 | UINT32 HostSession,\r | |
1035 | TCG_UID SidRow,\r | |
1036 | const VOID *Password,\r | |
1037 | UINT32 PasswordSize\r | |
085dcf01 ED |
1038 | );\r |
1039 | \r | |
1040 | /**\r | |
1041 | Creates ComPacket with a Method call that sets the "Enabled" column for the row specified using the value specified.\r | |
1042 | This assumes a start session has already been opened with the desired SP.\r | |
1043 | \r | |
1044 | @param [in/out] CreateStruct Structure used to add method call\r | |
1045 | @param [in/out] Size Describes the size of the entire ComPacket (header and payload). Filled out by function.\r | |
1046 | @param [in] ComId ComID for the ComPacket\r | |
1047 | @param [in] ComIdExtension Extended ComID for the ComPacket\r | |
1048 | @param [in] TperSession Tper Session ID for the Packet\r | |
1049 | @param [in] HostSession Host Session ID for the Packet\r | |
1050 | @param [in] AuthorityUid Authority UID to modify the "Enabled" column for\r | |
1051 | @param [in] Enabled Value to set the "Enabled" column to\r | |
1052 | \r | |
1053 | **/\r | |
1054 | TCG_RESULT\r | |
1055 | EFIAPI\r | |
c411b485 MK |
1056 | TcgSetAuthorityEnabled (\r |
1057 | TCG_CREATE_STRUCT *CreateStruct,\r | |
1058 | UINT32 *Size,\r | |
1059 | UINT16 ComId,\r | |
1060 | UINT16 ComIdExtension,\r | |
1061 | UINT32 TperSession,\r | |
1062 | UINT32 HostSession,\r | |
1063 | TCG_UID AuthorityUid,\r | |
1064 | BOOLEAN Enabled\r | |
085dcf01 ED |
1065 | );\r |
1066 | \r | |
1067 | /**\r | |
1068 | \r | |
1069 | Creates ComPacket with EndSession.\r | |
1070 | This assumes a start session has already been opened.\r | |
1071 | \r | |
1072 | @param [in/out] CreateStruct Structure used to add Endsession\r | |
1073 | @param [in/out] Size Describes the size of the entire ComPacket (header and payload). Filled out by function.\r | |
1074 | @param [in] ComId ComID for the ComPacket\r | |
1075 | @param [in] ComIdExtension Extended ComID for the ComPacket\r | |
1076 | @param [in] HostSessionId Host Session ID for the Packet\r | |
1077 | @param [in] TpSessionId Tper Session ID for the Packet\r | |
1078 | \r | |
1079 | **/\r | |
1080 | TCG_RESULT\r | |
1081 | EFIAPI\r | |
c411b485 MK |
1082 | TcgCreateEndSession (\r |
1083 | TCG_CREATE_STRUCT *CreateStruct,\r | |
1084 | UINT32 *Size,\r | |
1085 | UINT16 ComId,\r | |
1086 | UINT16 ComIdExtension,\r | |
1087 | UINT32 HostSessionId,\r | |
1088 | UINT32 TpSessionId\r | |
085dcf01 ED |
1089 | );\r |
1090 | \r | |
085dcf01 ED |
1091 | /**\r |
1092 | \r | |
1093 | Retrieves human-readable token type name.\r | |
1094 | \r | |
1095 | @param[in] Type Token type to retrieve\r | |
1096 | \r | |
1097 | **/\r | |
c411b485 | 1098 | CHAR8 *\r |
085dcf01 | 1099 | EFIAPI\r |
c411b485 | 1100 | TcgTokenTypeString (\r |
085dcf01 ED |
1101 | TCG_TOKEN_TYPE Type\r |
1102 | );\r | |
1103 | \r | |
1104 | /**\r | |
1105 | Returns the method status of the current subpacket. Does not affect the current position\r | |
1106 | in the ComPacket. In other words, it can be called whenever you have a valid SubPacket.\r | |
1107 | \r | |
1108 | @param [in/out] ParseStruct Structure used to parse received TCG response\r | |
1109 | @param [in/out] MethodStatus Method status retrieved of the current SubPacket\r | |
1110 | \r | |
1111 | **/\r | |
1112 | TCG_RESULT\r | |
1113 | EFIAPI\r | |
c411b485 MK |
1114 | TcgGetMethodStatus (\r |
1115 | const TCG_PARSE_STRUCT *ParseStruct,\r | |
1116 | UINT8 *MethodStatus\r | |
085dcf01 ED |
1117 | );\r |
1118 | \r | |
1119 | /**\r | |
1120 | Returns a human-readable string representing a method status return code.\r | |
1121 | \r | |
1122 | @param[in] MethodStatus Method status to translate to a string\r | |
1123 | \r | |
1124 | \r | |
1125 | @retval return the string info.\r | |
1126 | **/\r | |
c411b485 | 1127 | CHAR8 *\r |
085dcf01 | 1128 | EFIAPI\r |
c411b485 MK |
1129 | TcgMethodStatusString (\r |
1130 | UINT8 MethodStatus\r | |
085dcf01 ED |
1131 | );\r |
1132 | \r | |
085dcf01 ED |
1133 | /**\r |
1134 | Retrieves the comID and Extended comID of the ComPacket in the Tcg response.\r | |
1135 | It is intended to be used to confirm the received Tcg response is intended for user that received it.\r | |
1136 | \r | |
1137 | @param [in] ParseStruct Structure used to parse received TCG response.\r | |
1138 | @param [in/out] ComId comID retrieved from received ComPacket.\r | |
1139 | @param [in/out] ComIdExtension Extended comID retrieved from received ComPacket\r | |
1140 | \r | |
1141 | **/\r | |
1142 | TCG_RESULT\r | |
1143 | EFIAPI\r | |
c411b485 MK |
1144 | TcgGetComIds (\r |
1145 | const TCG_PARSE_STRUCT *ParseStruct,\r | |
1146 | UINT16 *ComId,\r | |
1147 | UINT16 *ComIdExtension\r | |
085dcf01 ED |
1148 | );\r |
1149 | \r | |
1150 | /**\r | |
1151 | Checks if the ComIDs of the response match the expected values.\r | |
1152 | \r | |
1153 | @param[in] ParseStruct Structure used to parse received TCG response\r | |
1154 | @param[in] ExpectedComId Expected comID\r | |
1155 | @param[in] ExpectedComIdExtension Expected extended comID\r | |
1156 | \r | |
1157 | **/\r | |
1158 | TCG_RESULT\r | |
1159 | EFIAPI\r | |
c411b485 MK |
1160 | TcgCheckComIds (\r |
1161 | const TCG_PARSE_STRUCT *ParseStruct,\r | |
1162 | UINT16 ExpectedComId,\r | |
1163 | UINT16 ExpectedComIdExtension\r | |
085dcf01 ED |
1164 | );\r |
1165 | \r | |
1166 | /**\r | |
1167 | Parses the Sync Session response contained in the parseStruct to retrieve Tper session ID. If the Sync Session response\r | |
1168 | parameters do not match the comID, extended ComID and host session ID then a failure is returned.\r | |
1169 | \r | |
1170 | @param[in/out] ParseStruct Structure used to parse received TCG response, contains Sync Session response.\r | |
1171 | @param[in] ComId Expected ComID that is compared to actual ComID of response\r | |
1172 | @param[in] ComIdExtension Expected Extended ComID that is compared to actual Extended ComID of response\r | |
1173 | @param[in] HostSessionId Expected Host Session ID that is compared to actual Host Session ID of response\r | |
1174 | @param[in/out] TperSessionId Tper Session ID retrieved from the Sync Session response.\r | |
1175 | \r | |
1176 | **/\r | |
1177 | TCG_RESULT\r | |
1178 | EFIAPI\r | |
c411b485 | 1179 | TcgParseSyncSession (\r |
085dcf01 ED |
1180 | const TCG_PARSE_STRUCT *ParseStruct,\r |
1181 | UINT16 ComId,\r | |
1182 | UINT16 ComIdExtension,\r | |
1183 | UINT32 HostSessionId,\r | |
1184 | UINT32 *TperSessionId\r | |
1185 | );\r | |
1186 | \r | |
1187 | /**\r | |
1188 | Create set ace.\r | |
1189 | \r | |
1190 | @param CreateStruct Input create structure.\r | |
1191 | @param Size size info.\r | |
1192 | @param ComId ComId info.\r | |
1193 | @param ComIdExtension ComId extension info.\r | |
1194 | @param TperSession Tper session data.\r | |
1195 | @param HostSession Host session data.\r | |
1196 | @param AceRow Ace row info.\r | |
1197 | @param Authority1 Authority 1 info.\r | |
dd40a1f8 | 1198 | @param LogicalOperator Logical operator info.\r |
085dcf01 ED |
1199 | @param Authority2 Authority 2 info.\r |
1200 | \r | |
1201 | @retval Return the action result.\r | |
1202 | \r | |
1203 | **/\r | |
1204 | TCG_RESULT\r | |
1205 | EFIAPI\r | |
c411b485 MK |
1206 | TcgCreateSetAce (\r |
1207 | TCG_CREATE_STRUCT *CreateStruct,\r | |
1208 | UINT32 *Size,\r | |
1209 | UINT16 ComId,\r | |
1210 | UINT16 ComIdExtension,\r | |
1211 | UINT32 TperSession,\r | |
1212 | UINT32 HostSession,\r | |
1213 | TCG_UID AceRow,\r | |
1214 | TCG_UID Authority1,\r | |
1215 | BOOLEAN LogicalOperator,\r | |
1216 | TCG_UID Authority2\r | |
085dcf01 ED |
1217 | );\r |
1218 | \r | |
1219 | /**\r | |
1220 | Enum level 0 discovery.\r | |
1221 | \r | |
1222 | @param DiscoveryHeader Discovery header.\r | |
1223 | @param Callback Callback function.\r | |
1224 | @param Context The context for the function.\r | |
1225 | \r | |
1226 | @retval return true if the callback return TRUE, else return FALSE.\r | |
1227 | \r | |
1228 | **/\r | |
1229 | BOOLEAN\r | |
1230 | EFIAPI\r | |
c411b485 | 1231 | TcgEnumLevel0Discovery (\r |
085dcf01 ED |
1232 | const TCG_LEVEL0_DISCOVERY_HEADER *DiscoveryHeader,\r |
1233 | TCG_LEVEL0_ENUM_CALLBACK Callback,\r | |
1234 | VOID *Context\r | |
1235 | );\r | |
1236 | \r | |
1237 | /**\r | |
1238 | Get Feature code from the header.\r | |
1239 | \r | |
1240 | @param DiscoveryHeader The discovery header.\r | |
d6b926e7 | 1241 | @param FeatureCode return the Feature code.\r |
085dcf01 ED |
1242 | @param FeatureSize return the Feature size.\r |
1243 | \r | |
1244 | @retval return the Feature code data.\r | |
1245 | **/\r | |
c411b485 | 1246 | TCG_LEVEL0_FEATURE_DESCRIPTOR_HEADER *\r |
085dcf01 | 1247 | EFIAPI\r |
c411b485 | 1248 | TcgGetFeature (\r |
085dcf01 ED |
1249 | const TCG_LEVEL0_DISCOVERY_HEADER *DiscoveryHeader,\r |
1250 | UINT16 FeatureCode,\r | |
1251 | UINTN *FeatureSize\r | |
1252 | );\r | |
1253 | \r | |
1254 | /**\r | |
1255 | Determines if the protocol provided is part of the provided supported protocol list.\r | |
1256 | \r | |
1257 | @param[in] ProtocolList Supported protocol list to investigate\r | |
1258 | @param[in] Protocol Protocol value to determine if supported\r | |
1259 | \r | |
1260 | @return TRUE = protocol is supported, FALSE = protocol is not supported\r | |
1261 | **/\r | |
1262 | BOOLEAN\r | |
1263 | EFIAPI\r | |
c411b485 MK |
1264 | TcgIsProtocolSupported (\r |
1265 | const TCG_SUPPORTED_SECURITY_PROTOCOLS *ProtocolList,\r | |
1266 | UINT16 Protocol\r | |
085dcf01 ED |
1267 | );\r |
1268 | \r | |
1269 | /**\r | |
1270 | Determines if the Locking Feature "Locked" bit is set in the level 0 discovery response.\r | |
1271 | \r | |
1272 | @param[in] Discovery Level 0 discovery response\r | |
1273 | \r | |
1274 | @return TRUE = Locked is set, FALSE = Locked is false\r | |
1275 | \r | |
1276 | **/\r | |
1277 | BOOLEAN\r | |
1278 | EFIAPI\r | |
c411b485 MK |
1279 | TcgIsLocked (\r |
1280 | const TCG_LEVEL0_DISCOVERY_HEADER *Discovery\r | |
085dcf01 ED |
1281 | );\r |
1282 | \r | |
1283 | #pragma pack()\r | |
1284 | \r | |
085dcf01 | 1285 | #endif // _TCG_CORE_H_\r |