1 /********************************************************************************/
2 /*										*/
3 /*			     Parameter Unmarshaling				*/
4 /*			     Written by Ken Goldman				*/
5 /*		       IBM Thomas J. Watson Research Center			*/
6 /*										*/
7 /* (c) Copyright IBM Corporation 2015 - 2019					*/
8 /*										*/
9 /* All rights reserved.								*/
10 /* 										*/
11 /* Redistribution and use in source and binary forms, with or without		*/
12 /* modification, are permitted provided that the following conditions are	*/
13 /* met:										*/
14 /* 										*/
15 /* Redistributions of source code must retain the above copyright notice,	*/
16 /* this list of conditions and the following disclaimer.			*/
17 /* 										*/
18 /* Redistributions in binary form must reproduce the above copyright		*/
19 /* notice, this list of conditions and the following disclaimer in the		*/
20 /* documentation and/or other materials provided with the distribution.		*/
21 /* 										*/
22 /* Neither the names of the IBM Corporation nor the names of its		*/
23 /* contributors may be used to endorse or promote products derived from		*/
24 /* this software without specific prior written permission.			*/
25 /* 										*/
26 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS		*/
27 /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT		*/
28 /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR	*/
29 /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT		*/
30 /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,	*/
31 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT		*/
32 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,	*/
33 /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY	*/
34 /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT		*/
35 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE	*/
36 /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.		*/
37 /********************************************************************************/
38 
39 #include <string.h>
40 
41 #include <ibmtss/Unmarshal_fp.h>
42 
43 /* The functions with the TSS_ prefix are preferred.  They use an unsigned size.  The functions
44    without the prefix are deprecated.  */
45 
46 /* TPM_TSS_NOCMDCHECK defined strips the unmarshal functions used for command parameter checking
47    TPM_TSS_NODEPRECATED	defines strips the deprecated functions that used a signed size
48 */
49 
50 /* The int and array functions are common to TPM 1.2 and TPM 2.0 */
51 
52 TPM_RC
TSS_UINT8_Unmarshalu(UINT8 * target,BYTE ** buffer,uint32_t * size)53 TSS_UINT8_Unmarshalu(UINT8 *target, BYTE **buffer, uint32_t *size)
54 {
55     if (*size < sizeof(UINT8)) {
56 	return TPM_RC_INSUFFICIENT;
57     }
58     *target = (*buffer)[0];
59     *buffer += sizeof(UINT8);
60     *size -= sizeof(UINT8);
61     return TPM_RC_SUCCESS;
62 }
63 
64 #ifndef TPM_TSS_NOCMDCHECK
65 TPM_RC
TSS_INT8_Unmarshalu(INT8 * target,BYTE ** buffer,uint32_t * size)66 TSS_INT8_Unmarshalu(INT8 *target, BYTE **buffer, uint32_t *size)
67 {
68     return TSS_UINT8_Unmarshalu((UINT8 *)target, buffer, size);
69 }
70 #endif	/* TPM_TSS_NOCMDCHECK */
71 
72 TPM_RC
TSS_UINT16_Unmarshalu(uint16_t * target,BYTE ** buffer,uint32_t * size)73 TSS_UINT16_Unmarshalu(uint16_t *target, BYTE **buffer, uint32_t *size)
74 {
75     if (*size < sizeof(uint16_t)) {
76 	return TPM_RC_INSUFFICIENT;
77     }
78     *target = ((uint16_t)((*buffer)[0]) << 8) |
79 	      ((uint16_t)((*buffer)[1]) << 0);
80     *buffer += sizeof(uint16_t);
81     *size -= sizeof(uint16_t);
82     return TPM_RC_SUCCESS;
83 }
84 
85 TPM_RC
TSS_UINT32_Unmarshalu(UINT32 * target,BYTE ** buffer,uint32_t * size)86 TSS_UINT32_Unmarshalu(UINT32 *target, BYTE **buffer, uint32_t *size)
87 {
88     if (*size < sizeof(uint32_t)) {
89 	return TPM_RC_INSUFFICIENT;
90     }
91     *target = ((uint32_t)((*buffer)[0]) << 24) |
92 	      ((uint32_t)((*buffer)[1]) << 16) |
93 	      ((uint32_t)((*buffer)[2]) <<  8) |
94 	      ((uint32_t)((*buffer)[3]) <<  0);
95     *buffer += sizeof(uint32_t);
96     *size -= sizeof(uint32_t);
97     return TPM_RC_SUCCESS;
98 }
99 
100 #ifndef TPM_TSS_NOCMDCHECK
101 TPM_RC
TSS_INT32_Unmarshalu(INT32 * target,BYTE ** buffer,uint32_t * size)102 TSS_INT32_Unmarshalu(INT32 *target, BYTE **buffer, uint32_t *size)
103 {
104     return TSS_UINT32_Unmarshalu((UINT32 *)target, buffer, size);
105 }
106 #endif	/* TPM_TSS_NOCMDCHECK */
107 
108 TPM_RC
TSS_UINT64_Unmarshalu(UINT64 * target,BYTE ** buffer,uint32_t * size)109 TSS_UINT64_Unmarshalu(UINT64 *target, BYTE **buffer, uint32_t *size)
110 {
111     if (*size < sizeof(UINT64)) {
112 	return TPM_RC_INSUFFICIENT;
113     }
114     *target = ((UINT64)((*buffer)[0]) << 56) |
115 	      ((UINT64)((*buffer)[1]) << 48) |
116 	      ((UINT64)((*buffer)[2]) << 40) |
117 	      ((UINT64)((*buffer)[3]) << 32) |
118 	      ((UINT64)((*buffer)[4]) << 24) |
119 	      ((UINT64)((*buffer)[5]) << 16) |
120 	      ((UINT64)((*buffer)[6]) <<  8) |
121 	      ((UINT64)((*buffer)[7]) <<  0);
122     *buffer += sizeof(UINT64);
123     *size -= sizeof(UINT64);
124     return TPM_RC_SUCCESS;
125 }
126 
127 TPM_RC
TSS_Array_Unmarshalu(BYTE * targetBuffer,uint16_t targetSize,BYTE ** buffer,uint32_t * size)128 TSS_Array_Unmarshalu(BYTE *targetBuffer, uint16_t targetSize, BYTE **buffer, uint32_t *size)
129 {
130     TPM_RC rc = TPM_RC_SUCCESS;
131 
132     if (*size < targetSize) {
133 	rc = TPM_RC_INSUFFICIENT;
134     }
135     else {
136 	memcpy(targetBuffer, *buffer, targetSize);
137 	*buffer += targetSize;
138 	*size -= targetSize;
139     }
140     return rc;
141 }
142 
143 #ifndef TPM_TSS_NODEPRECATED
144 #ifndef TPM_TSS_NOCMDCHECK
UINT8_Unmarshal(UINT8 * target,BYTE ** buffer,INT32 * size)145 TPM_RC UINT8_Unmarshal(UINT8 *target, BYTE **buffer, INT32 *size)
146 {
147     return TSS_UINT8_Unmarshalu(target, buffer, (uint32_t *)size);
148 }
149 
INT8_Unmarshal(INT8 * target,BYTE ** buffer,INT32 * size)150 TPM_RC INT8_Unmarshal(INT8 *target, BYTE **buffer, INT32 *size)
151 {
152     return TSS_INT8_Unmarshalu(target, buffer, (uint32_t *)size);
153 }
154 
UINT16_Unmarshal(UINT16 * target,BYTE ** buffer,INT32 * size)155 TPM_RC UINT16_Unmarshal(UINT16 *target, BYTE **buffer, INT32 *size)
156 {
157     return TSS_UINT16_Unmarshalu(target, buffer, (uint32_t *)size);
158 }
159 
UINT32_Unmarshal(UINT32 * target,BYTE ** buffer,INT32 * size)160 TPM_RC UINT32_Unmarshal(UINT32 *target, BYTE **buffer, INT32 *size)
161 {
162     return TSS_UINT32_Unmarshalu(target, buffer, (uint32_t *)size);
163 }
164 
INT32_Unmarshal(INT32 * target,BYTE ** buffer,INT32 * size)165 TPM_RC INT32_Unmarshal(INT32 *target, BYTE **buffer, INT32 *size)
166 {
167     return TSS_INT32_Unmarshalu(target, buffer, (uint32_t *)size);
168 }
169 
UINT64_Unmarshal(UINT64 * target,BYTE ** buffer,INT32 * size)170 TPM_RC UINT64_Unmarshal(UINT64 *target, BYTE **buffer, INT32 *size)
171 {
172     return TSS_UINT64_Unmarshalu(target, buffer, (uint32_t *)size);
173 }
174 
Array_Unmarshal(BYTE * targetBuffer,UINT16 targetSize,BYTE ** buffer,INT32 * size)175 TPM_RC Array_Unmarshal(BYTE *targetBuffer, UINT16 targetSize, BYTE **buffer, INT32 *size)
176 {
177     return TSS_Array_Unmarshalu(targetBuffer, targetSize, buffer, (uint32_t *)size);
178 }
179 
180 #endif /* TPM_TSS_NOCMDCHECK */
181 #endif /* TPM_TSS_NODEPRECATED */
182 #ifdef TPM_TPM20
183 
184 TPM_RC
TSS_TPM2B_Unmarshalu(TPM2B * target,uint16_t targetSize,BYTE ** buffer,uint32_t * size)185 TSS_TPM2B_Unmarshalu(TPM2B *target, uint16_t targetSize, BYTE **buffer, uint32_t *size)
186 {
187     TPM_RC rc = TPM_RC_SUCCESS;
188 
189     if (rc == TPM_RC_SUCCESS) {
190 	rc = TSS_UINT16_Unmarshalu(&target->size, buffer, size);
191     }
192     if (rc == TPM_RC_SUCCESS) {
193 	if (target->size > targetSize) {
194 	    rc = TPM_RC_SIZE;
195 	}
196     }
197     if (rc == TPM_RC_SUCCESS) {
198 	rc = TSS_Array_Unmarshalu(target->buffer, target->size, buffer, size);
199     }
200     return rc;
201 }
202 
203 /* Table 5 - Definition of Types for Documentation Clarity */
204 
205 TPM_RC
TSS_TPM_KEY_BITS_Unmarshalu(TPM_KEY_BITS * target,BYTE ** buffer,uint32_t * size)206 TSS_TPM_KEY_BITS_Unmarshalu(TPM_KEY_BITS *target, BYTE **buffer, uint32_t *size)
207 {
208     TPM_RC rc = TPM_RC_SUCCESS;
209 
210     if (rc == TPM_RC_SUCCESS) {
211 	rc = TSS_UINT16_Unmarshalu(target, buffer, size);
212     }
213     return rc;
214 }
215 
216 /* Table 7 - Definition of (UINT32) TPM_GENERATED Constants <O> */
217 
218 #ifndef TPM_TSS_NOCMDCHECK
219 TPM_RC
TSS_TPM_GENERATED_Unmarshalu(TPM_GENERATED * target,BYTE ** buffer,uint32_t * size)220 TSS_TPM_GENERATED_Unmarshalu(TPM_GENERATED *target, BYTE **buffer, uint32_t *size)
221 {
222     TPM_RC rc = TPM_RC_SUCCESS;
223 
224     if (rc == TPM_RC_SUCCESS) {
225 	rc = TSS_UINT32_Unmarshalu(target, buffer, size);
226     }
227     if (rc == TPM_RC_SUCCESS) {
228 	if (*target != TPM_GENERATED_VALUE) {
229 	    rc = TPM_RC_VALUE;
230 	}
231     }
232     return rc;
233 }
234 #endif	/* TPM_TSS_NOCMDCHECK */
235 
236 /* Table 9 - Definition of (UINT16) TPM_ALG_ID Constants <IN/OUT, S> */
237 
238 TPM_RC
TSS_TPM_ALG_ID_Unmarshalu(TPM_ALG_ID * target,BYTE ** buffer,uint32_t * size)239 TSS_TPM_ALG_ID_Unmarshalu(TPM_ALG_ID *target, BYTE **buffer, uint32_t *size)
240 {
241     TPM_RC rc = TPM_RC_SUCCESS;
242 
243     if (rc == TPM_RC_SUCCESS) {
244 	rc = TSS_UINT16_Unmarshalu(target, buffer, size);
245     }
246     return rc;
247 }
248 
249 /* Table 10 - Definition of (UINT16) {ECC} TPM_ECC_CURVE Constants <IN/OUT, S> */
250 
251 #ifdef TPM_ALG_ECC
252 TPM_RC
TSS_TPM_ECC_CURVE_Unmarshalu(TPM_ECC_CURVE * target,BYTE ** buffer,uint32_t * size)253 TSS_TPM_ECC_CURVE_Unmarshalu(TPM_ECC_CURVE *target, BYTE **buffer, uint32_t *size)
254 {
255     TPM_RC rc = TPM_RC_SUCCESS;
256 
257     if (rc == TPM_RC_SUCCESS) {
258 	rc = TSS_UINT16_Unmarshalu(target, buffer, size);
259     }
260     return rc;
261 }
262 #endif	/*  TPM_ALG_ECC */
263 
264 /* Table 13 - Definition of (UINT32) TPM_CC Constants (Numeric Order) <IN/OUT, S> */
265 
266 TPM_RC
TSS_TPM_CC_Unmarshalu(TPM_RC * target,BYTE ** buffer,uint32_t * size)267 TSS_TPM_CC_Unmarshalu(TPM_RC *target, BYTE **buffer, uint32_t *size)
268 {
269     TPM_RC rc = TPM_RC_SUCCESS;
270 
271     if (rc == TPM_RC_SUCCESS) {
272 	rc = TSS_UINT32_Unmarshalu(target, buffer, size);
273     }
274     return rc;
275 }
276 
277 /* Table 17 - Definition of (UINT32) TPM_RC Constants (Actions) <OUT> */
278 
279 TPM_RC
TSS_TPM_RC_Unmarshalu(TPM_RC * target,BYTE ** buffer,uint32_t * size)280 TSS_TPM_RC_Unmarshalu(TPM_RC *target, BYTE **buffer, uint32_t *size)
281 {
282     TPM_RC rc = TPM_RC_SUCCESS;
283 
284     if (rc == TPM_RC_SUCCESS) {
285 	rc = TSS_UINT32_Unmarshalu(target, buffer, size);
286     }
287     return rc;
288 }
289 
290 #ifndef TPM_TSS_NOCMDCHECK
291 
292 /* Table 18 - Definition of (INT8) TPM_CLOCK_ADJUST Constants <IN> */
293 
294 TPM_RC
TSS_TPM_CLOCK_ADJUST_Unmarshalu(TPM_CLOCK_ADJUST * target,BYTE ** buffer,uint32_t * size)295 TSS_TPM_CLOCK_ADJUST_Unmarshalu(TPM_CLOCK_ADJUST *target, BYTE **buffer, uint32_t *size)
296 {
297     TPM_RC rc = TPM_RC_SUCCESS;
298 
299     if (rc == TPM_RC_SUCCESS) {
300 	rc = TSS_INT8_Unmarshalu(target, buffer, size);
301     }
302     if (rc == TPM_RC_SUCCESS) {
303 	switch (*target) {
304 	  case TPM_CLOCK_COARSE_SLOWER:
305 	  case TPM_CLOCK_MEDIUM_SLOWER:
306 	  case TPM_CLOCK_FINE_SLOWER:
307 	  case TPM_CLOCK_NO_CHANGE:
308 	  case TPM_CLOCK_FINE_FASTER:
309 	  case TPM_CLOCK_MEDIUM_FASTER:
310 	  case TPM_CLOCK_COARSE_FASTER:
311 	    break;
312 	  default:
313 	    rc = TPM_RC_VALUE;
314 	}
315     }
316     return rc;
317 }
318 
319 /* Table 19 - Definition of (UINT16) TPM_EO Constants <IN/OUT> */
320 
321 TPM_RC
TSS_TPM_EO_Unmarshalu(TPM_EO * target,BYTE ** buffer,uint32_t * size)322 TSS_TPM_EO_Unmarshalu(TPM_EO *target, BYTE **buffer, uint32_t *size)
323 {
324     TPM_RC rc = TPM_RC_SUCCESS;
325 
326     if (rc == TPM_RC_SUCCESS) {
327 	rc = TSS_UINT16_Unmarshalu(target, buffer, size);
328     }
329     if (rc == TPM_RC_SUCCESS) {
330 	switch (*target) {
331 	  case TPM_EO_EQ:
332 	  case TPM_EO_NEQ:
333 	  case TPM_EO_SIGNED_GT:
334 	  case TPM_EO_UNSIGNED_GT:
335 	  case TPM_EO_SIGNED_LT:
336 	  case TPM_EO_UNSIGNED_LT:
337 	  case TPM_EO_SIGNED_GE:
338 	  case TPM_EO_UNSIGNED_GE:
339 	  case TPM_EO_SIGNED_LE:
340 	  case TPM_EO_UNSIGNED_LE:
341 	  case TPM_EO_BITSET:
342 	  case TPM_EO_BITCLEAR:
343 	    break;
344 	  default:
345 	    rc = TPM_RC_VALUE;
346 	}
347     }
348     return rc;
349 }
350 
351 #endif	/* TPM_TSS_NOCMDCHECK */
352 
353 /* Table 20 - Definition of (UINT16) TPM_ST Constants <IN/OUT, S> */
354 
355 TPM_RC
TSS_TPM_ST_Unmarshalu(TPM_ST * target,BYTE ** buffer,uint32_t * size)356 TSS_TPM_ST_Unmarshalu(TPM_ST *target, BYTE **buffer, uint32_t *size)
357 {
358     TPM_RC rc = TPM_RC_SUCCESS;
359 
360     if (rc == TPM_RC_SUCCESS) {
361 	rc = TSS_UINT16_Unmarshalu(target, buffer, size);
362     }
363     return rc;
364 }
365 
366 #ifndef TPM_TSS_NOCMDCHECK
367 /* Table 21 - Definition of (UINT16) TPM_SU Constants <IN> */
368 
369 TPM_RC
TSS_TPM_SU_Unmarshalu(TPM_SU * target,BYTE ** buffer,uint32_t * size)370 TSS_TPM_SU_Unmarshalu(TPM_SU *target, BYTE **buffer, uint32_t *size)
371 {
372     TPM_RC rc = TPM_RC_SUCCESS;
373 
374     if (rc == TPM_RC_SUCCESS) {
375 	rc = TSS_UINT16_Unmarshalu(target, buffer, size);
376     }
377     if (rc == TPM_RC_SUCCESS) {
378 	switch (*target) {
379 	  case TPM_SU_CLEAR:
380 	  case TPM_SU_STATE:
381 	    break;
382 	  default:
383 	    rc = TPM_RC_VALUE;
384 	}
385     }
386     return rc;
387 }
388 
389 #endif	/* TPM_TSS_NOCMDCHECK */
390 
391 /* Table 22 - Definition of (UINT8) TPM_SE Constants <IN> */
392 
393 TPM_RC
TSS_TPM_SE_Unmarshalu(TPM_SE * target,BYTE ** buffer,uint32_t * size)394 TSS_TPM_SE_Unmarshalu(TPM_SE *target, BYTE **buffer, uint32_t *size)
395 {
396     TPM_RC rc = TPM_RC_SUCCESS;
397 
398     if (rc == TPM_RC_SUCCESS) {
399 	rc = TSS_UINT8_Unmarshalu(target, buffer, size);
400     }
401     if (rc == TPM_RC_SUCCESS) {
402 	switch (*target) {
403 	  case TPM_SE_HMAC:
404 	  case TPM_SE_POLICY:
405 	  case TPM_SE_TRIAL:
406 	    break;
407 	  default:
408 	    rc = TPM_RC_VALUE;
409 	}
410     }
411     return rc;
412 }
413 
414 /* Table 23 - Definition of (UINT32) TPM_CAP Constants  */
415 
416 TPM_RC
TSS_TPM_CAP_Unmarshalu(TPM_CAP * target,BYTE ** buffer,uint32_t * size)417 TSS_TPM_CAP_Unmarshalu(TPM_CAP *target, BYTE **buffer, uint32_t *size)
418 {
419     TPM_RC rc = TPM_RC_SUCCESS;
420 
421     if (rc == TPM_RC_SUCCESS) {
422 	rc = TSS_UINT32_Unmarshalu(target, buffer, size);
423     }
424     return rc;
425 }
426 
427 /* Table 24 - Definition of (UINT32) TPM_PT Constants <IN/OUT, S> */
428 
429 TPM_RC
TSS_TPM_PT_Unmarshalu(TPM_HANDLE * target,BYTE ** buffer,uint32_t * size)430 TSS_TPM_PT_Unmarshalu(TPM_HANDLE *target, BYTE **buffer, uint32_t *size)
431 {
432     TPM_RC rc = TPM_RC_SUCCESS;
433 
434     if (rc == TPM_RC_SUCCESS) {
435 	rc = TSS_UINT32_Unmarshalu(target, buffer, size);
436     }
437     return rc;
438 }
439 
440 /* Table 25 - Definition of (UINT32) TPM_PT_PCR Constants <IN/OUT, S> */
441 
442 TPM_RC
TSS_TPM_PT_PCR_Unmarshalu(TPM_PT_PCR * target,BYTE ** buffer,uint32_t * size)443 TSS_TPM_PT_PCR_Unmarshalu(TPM_PT_PCR *target, BYTE **buffer, uint32_t *size)
444 {
445     TPM_RC rc = TPM_RC_SUCCESS;
446 
447     if (rc == TPM_RC_SUCCESS) {
448 	rc = TSS_UINT32_Unmarshalu(target, buffer, size);
449     }
450     return rc;
451 }
452 
453 /* Table 27 - Definition of Types for Handles */
454 
455 TPM_RC
TSS_TPM_HANDLE_Unmarshalu(TPM_HANDLE * target,BYTE ** buffer,uint32_t * size)456 TSS_TPM_HANDLE_Unmarshalu(TPM_HANDLE *target, BYTE **buffer, uint32_t *size)
457 {
458     TPM_RC rc = TPM_RC_SUCCESS;
459 
460     if (rc == TPM_RC_SUCCESS) {
461 	rc = TSS_UINT32_Unmarshalu(target, buffer, size);
462     }
463     return rc;
464 }
465 
466 /* Table 31 - Definition of (UINT32) TPMA_ALGORITHM Bits */
467 
468 TPM_RC
TSS_TPMA_ALGORITHM_Unmarshalu(TPMA_ALGORITHM * target,BYTE ** buffer,uint32_t * size)469 TSS_TPMA_ALGORITHM_Unmarshalu(TPMA_ALGORITHM *target, BYTE **buffer, uint32_t *size)
470 {
471     TPM_RC rc = TPM_RC_SUCCESS;
472 
473     if (rc == TPM_RC_SUCCESS) {
474 	rc = TSS_UINT32_Unmarshalu(&target->val, buffer, size);
475     }
476     if (rc == TPM_RC_SUCCESS) {
477 	if (target->val & TPMA_ALGORITHM_RESERVED) {
478 	    rc = TPM_RC_RESERVED_BITS;
479 	}
480     }
481     return rc;
482 }
483 
484 /* Table 32 - Definition of (UINT32) TPMA_OBJECT Bits */
485 
486 TPM_RC
TSS_TPMA_OBJECT_Unmarshalu(TPMA_OBJECT * target,BYTE ** buffer,uint32_t * size)487 TSS_TPMA_OBJECT_Unmarshalu(TPMA_OBJECT *target, BYTE **buffer, uint32_t *size)
488 {
489     TPM_RC rc = TPM_RC_SUCCESS;
490 
491     if (rc == TPM_RC_SUCCESS) {
492 	rc = TSS_UINT32_Unmarshalu(&target->val, buffer, size);
493     }
494     if (rc == TPM_RC_SUCCESS) {
495 	if (target->val & TPMA_OBJECT_RESERVED) {
496 	    rc = TPM_RC_RESERVED_BITS;
497 	}
498     }
499     return rc;
500 }
501 
502 /* Table 33 - Definition of (UINT8) TPMA_SESSION Bits <IN/OUT> */
503 
504 TPM_RC
TSS_TPMA_SESSION_Unmarshalu(TPMA_SESSION * target,BYTE ** buffer,uint32_t * size)505 TSS_TPMA_SESSION_Unmarshalu(TPMA_SESSION *target, BYTE **buffer, uint32_t *size)
506 {
507     TPM_RC rc = TPM_RC_SUCCESS;
508 
509     if (rc == TPM_RC_SUCCESS) {
510 	rc = TSS_UINT8_Unmarshalu(&target->val, buffer, size);
511     }
512     if (rc == TPM_RC_SUCCESS) {
513 	if (target->val & TPMA_SESSION_RESERVED) {
514 	    rc = TPM_RC_RESERVED_BITS;
515 	}
516     }
517     return rc;
518 }
519 
520 /* Table 34 - Definition of (UINT8) TPMA_LOCALITY Bits <IN/OUT> */
521 
522 TPM_RC
TSS_TPMA_LOCALITY_Unmarshalu(TPMA_LOCALITY * target,BYTE ** buffer,uint32_t * size)523 TSS_TPMA_LOCALITY_Unmarshalu(TPMA_LOCALITY *target, BYTE **buffer, uint32_t *size)
524 {
525     TPM_RC rc = TPM_RC_SUCCESS;
526 
527     if (rc == TPM_RC_SUCCESS) {
528 	rc = TSS_UINT8_Unmarshalu(&target->val, buffer, size);
529     }
530     return rc;
531 }
532 
533 /* Table 38 - Definition of (TPM_CC) TPMA_CC Bits <OUT> */
534 
535 TPM_RC
TSS_TPMA_CC_Unmarshalu(TPMA_CC * target,BYTE ** buffer,uint32_t * size)536 TSS_TPMA_CC_Unmarshalu(TPMA_CC *target, BYTE **buffer, uint32_t *size)
537 {
538     TPM_RC rc = TPM_RC_SUCCESS;
539 
540     if (rc == TPM_RC_SUCCESS) {
541 	rc = TSS_UINT32_Unmarshalu(&target->val, buffer, size);
542     }
543     if (rc == TPM_RC_SUCCESS) {
544 	if (target->val & TPMA_CC_RESERVED) {
545 	    rc = TPM_RC_RESERVED_BITS;
546 	}
547     }
548     return rc;
549 }
550 
551 /* Table 39 - Definition of (BYTE) TPMI_YES_NO Type */
552 
553 TPM_RC
TSS_TPMI_YES_NO_Unmarshalu(TPMI_YES_NO * target,BYTE ** buffer,uint32_t * size)554 TSS_TPMI_YES_NO_Unmarshalu(TPMI_YES_NO *target, BYTE **buffer, uint32_t *size)
555 {
556     TPM_RC rc = TPM_RC_SUCCESS;
557 
558     if (rc == TPM_RC_SUCCESS) {
559 	rc = TSS_UINT8_Unmarshalu(target, buffer, size);
560     }
561     return rc;
562 }
563 
564 /* Table 40 - Definition of (TPM_HANDLE) TPMI_DH_OBJECT Type */
565 
566 TPM_RC
TSS_TPMI_DH_OBJECT_Unmarshalu(TPMI_DH_OBJECT * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)567 TSS_TPMI_DH_OBJECT_Unmarshalu(TPMI_DH_OBJECT *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
568 {
569     TPM_RC rc = TPM_RC_SUCCESS;
570 
571     if (rc == TPM_RC_SUCCESS) {
572 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
573     }
574     if (rc == TPM_RC_SUCCESS) {
575 	BOOL isNotTransient = (*target < TRANSIENT_FIRST) || (*target > TRANSIENT_LAST);
576 	BOOL isNotPersistent = (*target < PERSISTENT_FIRST) || (*target > PERSISTENT_LAST);
577 	BOOL isNotLegalNull = (*target != TPM_RH_NULL) || !allowNull;
578 	if (isNotTransient &&
579 	    isNotPersistent &&
580 	    isNotLegalNull) {
581 	    rc = TPM_RC_VALUE;
582 	}
583     }
584     return rc;
585 }
586 /* Table 41 - Definition of (TPM_HANDLE) TPMI_DH_PERSISTENT Type */
587 
588 #ifndef TPM_TSS_NOCMDCHECK
589 TPM_RC
TSS_TPMI_DH_PERSISTENT_Unmarshalu(TPMI_DH_PERSISTENT * target,BYTE ** buffer,uint32_t * size)590 TSS_TPMI_DH_PERSISTENT_Unmarshalu(TPMI_DH_PERSISTENT *target, BYTE **buffer, uint32_t *size)
591 {
592     TPM_RC rc = TPM_RC_SUCCESS;
593 
594     if (rc == TPM_RC_SUCCESS) {
595 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
596     }
597     if (rc == TPM_RC_SUCCESS) {
598 	BOOL isNotPersistent = (*target < PERSISTENT_FIRST) || (*target > PERSISTENT_LAST);
599 	if (isNotPersistent) {
600 	    rc = TPM_RC_VALUE;
601 	}
602     }
603     return rc;
604 }
605 #endif	/* TPM_TSS_NOCMDCHECK */
606 
607 /* Table 42 - Definition of (TPM_HANDLE) TPMI_DH_ENTITY Type <IN> */
608 
609 TPM_RC
TSS_TPMI_DH_ENTITY_Unmarshalu(TPMI_DH_ENTITY * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)610 TSS_TPMI_DH_ENTITY_Unmarshalu(TPMI_DH_ENTITY *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
611 {
612     TPM_RC rc = TPM_RC_SUCCESS;
613 
614     if (rc == TPM_RC_SUCCESS) {
615 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
616     }
617     if (rc == TPM_RC_SUCCESS) {
618 	BOOL isNotOwner = *target != TPM_RH_OWNER;
619 	BOOL isNotEndorsement = *target != TPM_RH_ENDORSEMENT;
620 	BOOL isNotPlatform = *target != TPM_RH_PLATFORM;
621 	BOOL isNotLockout = *target != TPM_RH_LOCKOUT;
622 	BOOL isNotTransient = (*target < TRANSIENT_FIRST) || (*target > TRANSIENT_LAST);
623 	BOOL isNotPersistent = (*target < PERSISTENT_FIRST) || (*target > PERSISTENT_LAST);
624 	BOOL isNotNv = (*target < NV_INDEX_FIRST) || (*target > NV_INDEX_LAST);
625 	BOOL isNotPcr = (*target > PCR_LAST);
626 	BOOL isNotAuth = (*target < TPM_RH_AUTH_00) || (*target > TPM_RH_AUTH_FF);
627 	BOOL isNotLegalNull = (*target != TPM_RH_NULL) || !allowNull;
628 	if (isNotOwner &&
629 	    isNotEndorsement &&
630 	    isNotPlatform &&
631 	    isNotLockout &&
632 	    isNotTransient &&
633 	    isNotPersistent &&
634 	    isNotNv &&
635 	    isNotPcr &&
636 	    isNotAuth &&
637 	    isNotLegalNull) {
638 	    rc = TPM_RC_VALUE;
639 	}
640     }
641     return rc;
642 }
643 
644 /* Table 43 - Definition of (TPM_HANDLE) TPMI_DH_PCR Type <IN> */
645 
646 #ifndef TPM_TSS_NOCMDCHECK
647 TPM_RC
TSS_TPMI_DH_PCR_Unmarshalu(TPMI_DH_PCR * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)648 TSS_TPMI_DH_PCR_Unmarshalu(TPMI_DH_PCR *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
649 {
650     TPM_RC rc = TPM_RC_SUCCESS;
651 
652     if (rc == TPM_RC_SUCCESS) {
653 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
654     }
655     if (rc == TPM_RC_SUCCESS) {
656 	BOOL isNotPcr = (*target > PCR_LAST);
657 	BOOL isNotLegalNull = (*target != TPM_RH_NULL) || !allowNull;
658 	if (isNotPcr &&
659 	    isNotLegalNull) {
660 	    rc = TPM_RC_VALUE;
661 	}
662     }
663     return rc;
664 }
665 #endif	/* TPM_TSS_NOCMDCHECK */
666 
667 /* Table 44 - Definition of (TPM_HANDLE) TPMI_SH_AUTH_SESSION Type <IN/OUT> */
668 
669 TPM_RC
TSS_TPMI_SH_AUTH_SESSION_Unmarshalu(TPMI_SH_AUTH_SESSION * target,BYTE ** buffer,uint32_t * size,BOOL allowPwd)670 TSS_TPMI_SH_AUTH_SESSION_Unmarshalu(TPMI_SH_AUTH_SESSION *target, BYTE **buffer, uint32_t *size, BOOL allowPwd)
671 {
672     TPM_RC rc = TPM_RC_SUCCESS;
673 
674     if (rc == TPM_RC_SUCCESS) {
675 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
676     }
677     if (rc == TPM_RC_SUCCESS) {
678 	BOOL isNotHmacSession = (*target < HMAC_SESSION_FIRST ) || (*target > HMAC_SESSION_LAST);
679 	BOOL isNotPolicySession = (*target < POLICY_SESSION_FIRST) || (*target > POLICY_SESSION_LAST);
680 	BOOL isNotLegalPwd = (*target != TPM_RS_PW) || !allowPwd;
681 	if (isNotHmacSession &&
682 	    isNotPolicySession &&
683 	    isNotLegalPwd) {
684 	    rc = TPM_RC_VALUE;
685 	}
686     }
687     return rc;
688 }
689 
690 /* Table 45 - Definition of (TPM_HANDLE) TPMI_SH_HMAC Type <IN/OUT> */
691 
692 #ifndef TPM_TSS_NOCMDCHECK
693 TPM_RC
TSS_TPMI_SH_HMAC_Unmarshalu(TPMI_SH_HMAC * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)694 TSS_TPMI_SH_HMAC_Unmarshalu(TPMI_SH_HMAC *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
695 {
696     TPM_RC rc = TPM_RC_SUCCESS;
697     allowNull = allowNull;
698 
699     if (rc == TPM_RC_SUCCESS) {
700 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
701     }
702     if (rc == TPM_RC_SUCCESS) {
703 	BOOL isNotHmacSession = (*target < HMAC_SESSION_FIRST ) || (*target > HMAC_SESSION_LAST);
704 	if (isNotHmacSession) {
705 	    rc = TPM_RC_VALUE;
706 	}
707     }
708     return rc;
709 }
710 
711 /* Table 46 - Definition of (TPM_HANDLE) TPMI_SH_POLICY Type <IN/OUT> */
712 
713 TPM_RC
TSS_TPMI_SH_POLICY_Unmarshalu(TPMI_SH_POLICY * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)714 TSS_TPMI_SH_POLICY_Unmarshalu(TPMI_SH_POLICY *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
715 {
716     TPM_RC rc = TPM_RC_SUCCESS;
717     allowNull = allowNull;
718 
719     if (rc == TPM_RC_SUCCESS) {
720 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
721     }
722     if (rc == TPM_RC_SUCCESS) {
723 	BOOL isNotPolicySession = (*target < POLICY_SESSION_FIRST) || (*target > POLICY_SESSION_LAST);
724 	if (isNotPolicySession) {
725 	    rc = TPM_RC_VALUE;
726 	}
727     }
728     return rc;
729 }
730 #endif	/* TPM_TSS_NOCMDCHECK */
731 
732 /* Table 47 - Definition of (TPM_HANDLE) TPMI_DH_CONTEXT Type  */
733 
734 TPM_RC
TSS_TPMI_DH_CONTEXT_Unmarshalu(TPMI_DH_CONTEXT * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)735 TSS_TPMI_DH_CONTEXT_Unmarshalu(TPMI_DH_CONTEXT *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
736 {
737     TPM_RC rc = TPM_RC_SUCCESS;
738     allowNull = allowNull;
739 
740     if (rc == TPM_RC_SUCCESS) {
741 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
742     }
743     if (rc == TPM_RC_SUCCESS) {
744 	BOOL isNotHmacSession = (*target < HMAC_SESSION_FIRST ) || (*target > HMAC_SESSION_LAST);
745 	BOOL isNotPolicySession = (*target < POLICY_SESSION_FIRST) || (*target > POLICY_SESSION_LAST);
746 	BOOL isNotTransient = (*target < TRANSIENT_FIRST) || (*target > TRANSIENT_LAST);
747 	if (isNotHmacSession &&
748 	    isNotPolicySession &&
749 	    isNotTransient) {
750 	    rc = TPM_RC_VALUE;
751 	}
752     }
753     return rc;
754 }
755 
756 /* Table 49 - Definition of (TPM_HANDLE) TPMI_DH_SAVED Type  */
757 
758 TPM_RC
TSS_TPMI_DH_SAVED_Unmarshalu(TPMI_DH_SAVED * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)759 TSS_TPMI_DH_SAVED_Unmarshalu(TPMI_DH_SAVED *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
760 {
761     TPM_RC rc = TPM_RC_SUCCESS;
762     allowNull = allowNull;
763 
764     if (rc == TPM_RC_SUCCESS) {
765 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
766     }
767     if (rc == TPM_RC_SUCCESS) {
768 	BOOL isNotHmacSession = (*target < HMAC_SESSION_FIRST ) || (*target > HMAC_SESSION_LAST);
769 	BOOL isNotPolicySession = (*target < POLICY_SESSION_FIRST) || (*target > POLICY_SESSION_LAST);
770 	BOOL isNotTransient = (*target != 0x80000000);
771 	BOOL isNotSequence = (*target != 0x80000001);
772 	BOOL isNotTransientStClear = (*target != 0x80000002);
773 
774 	if (isNotHmacSession &&
775 	    isNotPolicySession &&
776 	    isNotTransient &&
777 	    isNotSequence &&
778 	    isNotTransientStClear) {
779 	    rc = TPM_RC_VALUE;
780 	}
781     }
782     return rc;
783 }
784 
785 /* Table 48 - Definition of (TPM_HANDLE) TPMI_RH_HIERARCHY Type  */
786 
787 TPM_RC
TSS_TPMI_RH_HIERARCHY_Unmarshalu(TPMI_RH_HIERARCHY * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)788 TSS_TPMI_RH_HIERARCHY_Unmarshalu(TPMI_RH_HIERARCHY *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
789 {
790     TPM_RC rc = TPM_RC_SUCCESS;
791 
792     if (rc == TPM_RC_SUCCESS) {
793 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
794     }
795     if (rc == TPM_RC_SUCCESS) {
796 	switch (*target) {
797 	  case TPM_RH_OWNER:
798 	  case TPM_RH_PLATFORM:
799 	  case TPM_RH_ENDORSEMENT:
800 	    break;
801 	  case TPM_RH_NULL:
802 	    if (!allowNull) {
803 		rc = TPM_RC_VALUE;
804 	    }
805 	    break;
806 	  default:
807 	    rc = TPM_RC_VALUE;
808 	}
809     }
810     return rc;
811 }
812 /* Table 49 - Definition of (TPM_HANDLE) TPMI_RH_ENABLES Type */
813 
814 #ifndef TPM_TSS_NOCMDCHECK
815 TPM_RC
TSS_TPMI_RH_ENABLES_Unmarshalu(TPMI_RH_ENABLES * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)816 TSS_TPMI_RH_ENABLES_Unmarshalu(TPMI_RH_ENABLES *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
817 {
818     TPM_RC rc = TPM_RC_SUCCESS;
819 
820     if (rc == TPM_RC_SUCCESS) {
821 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
822     }
823     if (rc == TPM_RC_SUCCESS) {
824 	switch (*target) {
825 	  case TPM_RH_OWNER:
826 	  case TPM_RH_PLATFORM:
827 	  case TPM_RH_ENDORSEMENT:
828 	  case TPM_RH_PLATFORM_NV:
829 	    break;
830 	  case TPM_RH_NULL:
831 	    if (!allowNull) {
832 		rc = TPM_RC_VALUE;
833 	    }
834 	    break;
835 	  default:
836 	    rc = TPM_RC_VALUE;
837 	}
838     }
839     return rc;
840 }
841 
842 /* Table 50 - Definition of (TPM_HANDLE) TPMI_RH_HIERARCHY_AUTH Type <IN> */
843 
844 TPM_RC
TSS_TPMI_RH_HIERARCHY_AUTH_Unmarshalu(TPMI_RH_HIERARCHY_AUTH * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)845 TSS_TPMI_RH_HIERARCHY_AUTH_Unmarshalu(TPMI_RH_HIERARCHY_AUTH *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
846 {
847     TPM_RC rc = TPM_RC_SUCCESS;
848     allowNull = allowNull;
849 
850     if (rc == TPM_RC_SUCCESS) {
851 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
852     }
853     if (rc == TPM_RC_SUCCESS) {
854 	switch (*target) {
855 	  case TPM_RH_OWNER:
856 	  case TPM_RH_PLATFORM:
857 	  case TPM_RH_ENDORSEMENT:
858 	  case TPM_RH_LOCKOUT:
859 	    break;
860 	  default:
861 	    rc = TPM_RC_VALUE;
862 	}
863     }
864     return rc;
865 }
866 
867 /* Table 51 - Definition of (TPM_HANDLE) TPMI_RH_PLATFORM Type <IN> */
868 
869 TPM_RC
TSS_TPMI_RH_PLATFORM_Unmarshalu(TPMI_RH_PLATFORM * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)870 TSS_TPMI_RH_PLATFORM_Unmarshalu(TPMI_RH_PLATFORM *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
871 {
872     TPM_RC rc = TPM_RC_SUCCESS;
873     allowNull = allowNull;
874 
875     if (rc == TPM_RC_SUCCESS) {
876 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
877     }
878     if (rc == TPM_RC_SUCCESS) {
879 	switch (*target) {
880 	  case TPM_RH_PLATFORM:
881 	    break;
882 	  default:
883 	    rc = TPM_RC_VALUE;
884 	}
885     }
886     return rc;
887 }
888 
889 /* Table 53 - Definition of (TPM_HANDLE) TPMI_RH_ENDORSEMENT Type <IN> */
890 
891 TPM_RC
TSS_TPMI_RH_ENDORSEMENT_Unmarshalu(TPMI_RH_ENDORSEMENT * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)892 TSS_TPMI_RH_ENDORSEMENT_Unmarshalu(TPMI_RH_ENDORSEMENT *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
893 {
894     TPM_RC rc = TPM_RC_SUCCESS;
895 
896     if (rc == TPM_RC_SUCCESS) {
897 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
898     }
899     if (rc == TPM_RC_SUCCESS) {
900 	switch (*target) {
901 	  case TPM_RH_ENDORSEMENT:
902 	    break;
903 	  case TPM_RH_NULL:
904 	    if (!allowNull) {
905 		rc = TPM_RC_VALUE;
906 	    }
907 	    break;
908 	  default:
909 	    rc = TPM_RC_VALUE;
910 	}
911     }
912     return rc;
913 }
914 
915 /* Table 54 - Definition of (TPM_HANDLE) TPMI_RH_PROVISION Type <IN> */
916 
917 TPM_RC
TSS_TPMI_RH_PROVISION_Unmarshalu(TPMI_RH_PROVISION * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)918 TSS_TPMI_RH_PROVISION_Unmarshalu(TPMI_RH_PROVISION *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
919 {
920     TPM_RC rc = TPM_RC_SUCCESS;
921     allowNull = allowNull;
922 
923     if (rc == TPM_RC_SUCCESS) {
924 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
925     }
926     if (rc == TPM_RC_SUCCESS) {
927 	switch (*target) {
928 	  case TPM_RH_OWNER:
929 	  case TPM_RH_PLATFORM:
930 	    break;
931 	  default:
932 	    rc = TPM_RC_VALUE;
933 	}
934     }
935     return rc;
936 }
937 
938 /* Table 55 - Definition of (TPM_HANDLE) TPMI_RH_CLEAR Type <IN> */
939 
940 TPM_RC
TSS_TPMI_RH_CLEAR_Unmarshalu(TPMI_RH_CLEAR * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)941 TSS_TPMI_RH_CLEAR_Unmarshalu(TPMI_RH_CLEAR *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
942 {
943     TPM_RC rc = TPM_RC_SUCCESS;
944     allowNull = allowNull;
945 
946     if (rc == TPM_RC_SUCCESS) {
947 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
948     }
949     if (rc == TPM_RC_SUCCESS) {
950 	switch (*target) {
951 	  case TPM_RH_LOCKOUT:
952 	  case TPM_RH_PLATFORM:
953 	    break;
954 	  default:
955 	    rc = TPM_RC_VALUE;
956 	}
957     }
958     return rc;
959 }
960 
961 /* Table 56 - Definition of (TPM_HANDLE) TPMI_RH_NV_AUTH Type <IN> */
962 
963 TPM_RC
TSS_TPMI_RH_NV_AUTH_Unmarshalu(TPMI_RH_NV_AUTH * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)964 TSS_TPMI_RH_NV_AUTH_Unmarshalu(TPMI_RH_NV_AUTH *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
965 {
966     TPM_RC rc = TPM_RC_SUCCESS;
967     allowNull = allowNull;
968 
969     if (rc == TPM_RC_SUCCESS) {
970 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
971     }
972     if (rc == TPM_RC_SUCCESS) {
973 	switch (*target) {
974 	  case TPM_RH_OWNER:
975 	  case TPM_RH_PLATFORM:
976 	    break;
977 	  default:
978 	      {
979 		  BOOL isNotNv = (*target < NV_INDEX_FIRST) || (*target > NV_INDEX_LAST);
980 		  if (isNotNv) {
981 		      rc = TPM_RC_VALUE;
982 		  }
983 	      }
984 	}
985     }
986     return rc;
987 }
988 
989 /* Table 57 - Definition of (TPM_HANDLE) TPMI_RH_LOCKOUT Type <IN> */
990 
991 TPM_RC
TSS_TPMI_RH_LOCKOUT_Unmarshalu(TPMI_RH_LOCKOUT * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)992 TSS_TPMI_RH_LOCKOUT_Unmarshalu(TPMI_RH_LOCKOUT *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
993 {
994     TPM_RC rc = TPM_RC_SUCCESS;
995     allowNull = allowNull;
996 
997     if (rc == TPM_RC_SUCCESS) {
998 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
999     }
1000     if (rc == TPM_RC_SUCCESS) {
1001 	switch (*target) {
1002 	  case TPM_RH_LOCKOUT:
1003 	    break;
1004 	  default:
1005 	    rc = TPM_RC_VALUE;
1006 	}
1007     }
1008     return rc;
1009 }
1010 #endif	/* TPM_TSS_NOCMDCHECK */
1011 
1012 /* Table 58 - Definition of (TPM_HANDLE) TPMI_RH_NV_INDEX Type <IN/OUT> */
1013 
1014 TPM_RC
TSS_TPMI_RH_NV_INDEX_Unmarshalu(TPMI_RH_NV_INDEX * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)1015 TSS_TPMI_RH_NV_INDEX_Unmarshalu(TPMI_RH_NV_INDEX *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
1016 {
1017     TPM_RC rc = TPM_RC_SUCCESS;
1018     allowNull = allowNull;
1019 
1020     if (rc == TPM_RC_SUCCESS) {
1021 	rc = TSS_TPM_HANDLE_Unmarshalu(target, buffer, size);
1022     }
1023     if (rc == TPM_RC_SUCCESS) {
1024 	BOOL isNotNv = (*target < NV_INDEX_FIRST) || (*target > NV_INDEX_LAST);
1025 	if (isNotNv) {
1026 	    rc = TPM_RC_VALUE;
1027 	}
1028     }
1029     return rc;
1030 }
1031 
1032 /* Table 59 - Definition of (TPM_ALG_ID) TPMI_ALG_HASH Type  */
1033 
1034 TPM_RC
TSS_TPMI_ALG_HASH_Unmarshalu(TPMI_ALG_HASH * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)1035 TSS_TPMI_ALG_HASH_Unmarshalu(TPMI_ALG_HASH *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
1036 {
1037     TPM_RC rc = TPM_RC_SUCCESS;
1038     allowNull = allowNull;
1039 
1040     if (rc == TPM_RC_SUCCESS) {
1041 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
1042     }
1043     return rc;
1044 }
1045 
1046 /* Table 61 - Definition of (TPM_ALG_ID) TPMI_ALG_SYM Type */
1047 
1048 TPM_RC
TSS_TPMI_ALG_SYM_Unmarshalu(TPMI_ALG_SYM * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)1049 TSS_TPMI_ALG_SYM_Unmarshalu(TPMI_ALG_SYM *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
1050 {
1051     TPM_RC rc = TPM_RC_SUCCESS;
1052     allowNull = allowNull;
1053 
1054     if (rc == TPM_RC_SUCCESS) {
1055 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
1056     }
1057     return rc;
1058 }
1059 
1060 /* Table 62 - Definition of (TPM_ALG_ID) TPMI_ALG_SYM_OBJECT Type */
1061 
1062 TPM_RC
TSS_TPMI_ALG_SYM_OBJECT_Unmarshalu(TPMI_ALG_SYM_OBJECT * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)1063 TSS_TPMI_ALG_SYM_OBJECT_Unmarshalu(TPMI_ALG_SYM_OBJECT *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
1064 {
1065     TPM_RC rc = TPM_RC_SUCCESS;
1066     allowNull = allowNull;
1067 
1068     if (rc == TPM_RC_SUCCESS) {
1069 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
1070     }
1071     return rc;
1072 }
1073 
1074 /* Table 63 - Definition of (TPM_ALG_ID) TPMI_ALG_SYM_MODE Type */
1075 
1076 TPM_RC
TSS_TPMI_ALG_SYM_MODE_Unmarshalu(TPMI_ALG_SYM_MODE * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)1077 TSS_TPMI_ALG_SYM_MODE_Unmarshalu(TPMI_ALG_SYM_MODE *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
1078 {
1079     TPM_RC rc = TPM_RC_SUCCESS;
1080     allowNull = allowNull;
1081 
1082     if (rc == TPM_RC_SUCCESS) {
1083 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
1084     }
1085     return rc;
1086 }
1087 
1088 /* Table 64 - Definition of (TPM_ALG_ID) TPMI_ALG_KDF Type */
1089 
1090 TPM_RC
TSS_TPMI_ALG_KDF_Unmarshalu(TPMI_ALG_KDF * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)1091 TSS_TPMI_ALG_KDF_Unmarshalu(TPMI_ALG_KDF *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
1092 {
1093     TPM_RC rc = TPM_RC_SUCCESS;
1094     allowNull = allowNull;
1095 
1096     if (rc == TPM_RC_SUCCESS) {
1097 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
1098     }
1099     return rc;
1100 }
1101 
1102 /* Table 65 - Definition of (TPM_ALG_ID) TPMI_ALG_SIG_SCHEME Type */
1103 
1104 TPM_RC
TSS_TPMI_ALG_SIG_SCHEME_Unmarshalu(TPMI_ALG_SIG_SCHEME * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)1105 TSS_TPMI_ALG_SIG_SCHEME_Unmarshalu(TPMI_ALG_SIG_SCHEME *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
1106 {
1107     TPM_RC rc = TPM_RC_SUCCESS;
1108     allowNull = allowNull;
1109 
1110     if (rc == TPM_RC_SUCCESS) {
1111 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
1112     }
1113     return rc;
1114 }
1115 
1116 #ifndef TPM_TSS_NOCMDCHECK
1117 
1118 /* Table 66 - Definition of (TPM_ALG_ID) TPMI_ECC_KEY_EXCHANGE Type */
1119 
1120 TPM_RC
TSS_TPMI_ECC_KEY_EXCHANGE_Unmarshalu(TPMI_ECC_KEY_EXCHANGE * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)1121 TSS_TPMI_ECC_KEY_EXCHANGE_Unmarshalu(TPMI_ECC_KEY_EXCHANGE *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
1122 {
1123     TPM_RC rc = TPM_RC_SUCCESS;
1124     allowNull = allowNull;
1125 
1126     if (rc == TPM_RC_SUCCESS) {
1127 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
1128     }
1129     return rc;
1130 }
1131 
1132 /* Table 67 - Definition of (TPM_ST) TPMI_ST_COMMAND_TAG Type */
1133 
1134 TPM_RC
TSS_TPMI_ST_COMMAND_TAG_Unmarshalu(TPMI_ST_COMMAND_TAG * target,BYTE ** buffer,uint32_t * size)1135 TSS_TPMI_ST_COMMAND_TAG_Unmarshalu(TPMI_ST_COMMAND_TAG *target, BYTE **buffer, uint32_t *size)
1136 {
1137     TPM_RC rc = TPM_RC_SUCCESS;
1138 
1139     if (rc == TPM_RC_SUCCESS) {
1140 	rc = TSS_TPM_ST_Unmarshalu(target, buffer, size);
1141     }
1142     if (rc == TPM_RC_SUCCESS) {
1143 	switch (*target) {
1144 	  case TPM_ST_NO_SESSIONS:
1145 	  case TPM_ST_SESSIONS:
1146 	    break;
1147 	  default:
1148 	    rc = TPM_RC_BAD_TAG;
1149 	}
1150     }
1151     return rc;
1152 }
1153 
1154 /* Table 70 TPMI_ALG_MAC_SCHEME */
1155 
1156 TPM_RC
TSS_TPMI_ALG_MAC_SCHEME_Unmarshalu(TPMI_ALG_MAC_SCHEME * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)1157 TSS_TPMI_ALG_MAC_SCHEME_Unmarshalu(TPMI_ALG_MAC_SCHEME *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
1158 {
1159     TPM_RC rc = TPM_RC_SUCCESS;
1160     allowNull = allowNull;
1161 
1162     if (rc == TPM_RC_SUCCESS) {
1163 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
1164     }
1165     return rc;
1166 }
1167 
1168 /* Table 70 TPMI_ALG_CIPHER_MODE */
1169 
1170 TPM_RC
TSS_TPMI_ALG_CIPHER_MODE_Unmarshalu(TPMI_ALG_CIPHER_MODE * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)1171 TSS_TPMI_ALG_CIPHER_MODE_Unmarshalu(TPMI_ALG_CIPHER_MODE*target, BYTE **buffer, uint32_t *size, BOOL allowNull)
1172 {
1173     TPM_RC rc = TPM_RC_SUCCESS;
1174     allowNull = allowNull;
1175 
1176     if (rc == TPM_RC_SUCCESS) {
1177 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
1178     }
1179     return rc;
1180 }
1181 
1182 #endif	/* TPM_TSS_NOCMDCHECK */
1183 
1184 /* Table 68 - Definition of TPMS_EMPTY Structure <IN/OUT> */
1185 
1186 /* NOTE: Marked as const function in header */
1187 
1188 TPM_RC
TSS_TPMS_EMPTY_Unmarshalu(TPMS_EMPTY * target,BYTE ** buffer,uint32_t * size)1189 TSS_TPMS_EMPTY_Unmarshalu(TPMS_EMPTY *target, BYTE **buffer, uint32_t *size)
1190 {
1191     TPM_RC rc = TPM_RC_SUCCESS;
1192     target = target;
1193     buffer = buffer;
1194     size = size;
1195     return rc;
1196 }
1197 
1198 /* Table 70 - Definition of TPMU_HA Union <IN/OUT, S> */
1199 
1200 TPM_RC
TSS_TPMU_HA_Unmarshalu(TPMU_HA * target,BYTE ** buffer,uint32_t * size,uint32_t selector)1201 TSS_TPMU_HA_Unmarshalu(TPMU_HA *target, BYTE **buffer, uint32_t *size, uint32_t selector)
1202 {
1203     TPM_RC rc = TPM_RC_SUCCESS;
1204 
1205     switch (selector) {
1206 #ifdef TPM_ALG_SHA1
1207       case TPM_ALG_SHA1:
1208 	rc = TSS_Array_Unmarshalu(target->sha1, SHA1_DIGEST_SIZE, buffer, size);
1209 	break;
1210 #endif
1211 #ifdef TPM_ALG_SHA256
1212       case TPM_ALG_SHA256:
1213 	rc = TSS_Array_Unmarshalu(target->sha256, SHA256_DIGEST_SIZE, buffer, size);
1214 	break;
1215 #endif
1216 #ifdef TPM_ALG_SHA384
1217       case TPM_ALG_SHA384:
1218 	rc =TSS_Array_Unmarshalu(target->sha384, SHA384_DIGEST_SIZE, buffer, size);
1219 	break;
1220 #endif
1221 #ifdef TPM_ALG_SHA512
1222       case TPM_ALG_SHA512:
1223 	rc = TSS_Array_Unmarshalu(target->sha512, SHA512_DIGEST_SIZE, buffer, size);
1224 	break;
1225 #endif
1226 #ifdef TPM_ALG_SM3_256
1227       case TPM_ALG_SM3_256:
1228 	rc = TSS_Array_Unmarshalu(target->sm3_256, SM3_256_DIGEST_SIZE, buffer, size);
1229 	break;
1230 #endif
1231       case TPM_ALG_NULL:
1232 	break;
1233       default:
1234 	rc = TPM_RC_SELECTOR;
1235     }
1236     return rc;
1237 }
1238 
1239 /* Table 71 - Definition of TPMT_HA Structure <IN/OUT> */
1240 
1241 TPM_RC
TSS_TPMT_HA_Unmarshalu(TPMT_HA * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)1242 TSS_TPMT_HA_Unmarshalu(TPMT_HA *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
1243 {
1244     TPM_RC rc = TPM_RC_SUCCESS;
1245 
1246     if (rc == TPM_RC_SUCCESS) {
1247 	rc = TSS_TPMI_ALG_HASH_Unmarshalu(&target->hashAlg, buffer, size, allowNull);
1248     }
1249     if (rc == TPM_RC_SUCCESS) {
1250 	rc = TSS_TPMU_HA_Unmarshalu(&target->digest, buffer, size, target->hashAlg);
1251     }
1252     return rc;
1253 }
1254 
1255 /* Table 72 - Definition of TPM2B_DIGEST Structure */
1256 
1257 TPM_RC
TSS_TPM2B_DIGEST_Unmarshalu(TPM2B_DIGEST * target,BYTE ** buffer,uint32_t * size)1258 TSS_TPM2B_DIGEST_Unmarshalu(TPM2B_DIGEST *target, BYTE **buffer, uint32_t *size)
1259 {
1260     TPM_RC rc = TPM_RC_SUCCESS;
1261 
1262     if (rc == TPM_RC_SUCCESS) {
1263 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
1264     }
1265     return rc;
1266 }
1267 
1268 /* Table 73 - Definition of TPM2B_DATA Structure */
1269 
1270 TPM_RC
TSS_TPM2B_DATA_Unmarshalu(TPM2B_DATA * target,BYTE ** buffer,uint32_t * size)1271 TSS_TPM2B_DATA_Unmarshalu(TPM2B_DATA *target, BYTE **buffer, uint32_t *size)
1272 {
1273     TPM_RC rc = TPM_RC_SUCCESS;
1274 
1275     if (rc == TPM_RC_SUCCESS) {
1276 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
1277     }
1278     return rc;
1279 }
1280 
1281 /* Table 74 - Definition of Types for TPM2B_NONCE */
1282 
1283 TPM_RC
TSS_TPM2B_NONCE_Unmarshalu(TPM2B_NONCE * target,BYTE ** buffer,uint32_t * size)1284 TSS_TPM2B_NONCE_Unmarshalu(TPM2B_NONCE *target, BYTE **buffer, uint32_t *size)
1285 {
1286     TPM_RC rc = TPM_RC_SUCCESS;
1287 
1288     if (rc == TPM_RC_SUCCESS) {
1289 	rc = TSS_TPM2B_DIGEST_Unmarshalu(target, buffer, size);
1290     }
1291     return rc;
1292 }
1293 
1294 /* Table 75 - Definition of Types for TPM2B_AUTH */
1295 
1296 TPM_RC
TSS_TPM2B_AUTH_Unmarshalu(TPM2B_AUTH * target,BYTE ** buffer,uint32_t * size)1297 TSS_TPM2B_AUTH_Unmarshalu(TPM2B_AUTH *target, BYTE **buffer, uint32_t *size)
1298 {
1299     TPM_RC rc = TPM_RC_SUCCESS;
1300 
1301     if (rc == TPM_RC_SUCCESS) {
1302 	rc = TSS_TPM2B_DIGEST_Unmarshalu(target, buffer, size);
1303     }
1304     return rc;
1305 }
1306 
1307 #ifndef TPM_TSS_NOCMDCHECK
1308 
1309 /* Table 76 - Definition of Types for TPM2B_OPERAND */
1310 
1311 TPM_RC
TSS_TPM2B_OPERAND_Unmarshalu(TPM2B_OPERAND * target,BYTE ** buffer,uint32_t * size)1312 TSS_TPM2B_OPERAND_Unmarshalu(TPM2B_OPERAND *target, BYTE **buffer, uint32_t *size)
1313 {
1314     TPM_RC rc = TPM_RC_SUCCESS;
1315 
1316     if (rc == TPM_RC_SUCCESS) {
1317 	rc = TSS_TPM2B_DIGEST_Unmarshalu(target, buffer, size);
1318     }
1319     return rc;
1320 }
1321 
1322 /* Table 77 - Definition of TPM2B_EVENT Structure */
1323 
1324 TPM_RC
TSS_TPM2B_EVENT_Unmarshalu(TPM2B_EVENT * target,BYTE ** buffer,uint32_t * size)1325 TSS_TPM2B_EVENT_Unmarshalu(TPM2B_EVENT *target, BYTE **buffer, uint32_t *size)
1326 {
1327     TPM_RC rc = TPM_RC_SUCCESS;
1328 
1329     if (rc == TPM_RC_SUCCESS) {
1330 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
1331     }
1332     return rc;
1333 }
1334 
1335 #endif	/* TPM_TSS_NOCMDCHECK */
1336 
1337 /* Table 78 - Definition of TPM2B_MAX_BUFFER Structure */
1338 
1339 TPM_RC
TSS_TPM2B_MAX_BUFFER_Unmarshalu(TPM2B_MAX_BUFFER * target,BYTE ** buffer,uint32_t * size)1340 TSS_TPM2B_MAX_BUFFER_Unmarshalu(TPM2B_MAX_BUFFER *target, BYTE **buffer, uint32_t *size)
1341 {
1342     TPM_RC rc = TPM_RC_SUCCESS;
1343 
1344     if (rc == TPM_RC_SUCCESS) {
1345 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
1346     }
1347     return rc;
1348 }
1349 
1350 /* Table 79 - Definition of TPM2B_MAX_NV_BUFFER Structure */
1351 
1352 TPM_RC
TSS_TPM2B_MAX_NV_BUFFER_Unmarshalu(TPM2B_MAX_NV_BUFFER * target,BYTE ** buffer,uint32_t * size)1353 TSS_TPM2B_MAX_NV_BUFFER_Unmarshalu(TPM2B_MAX_NV_BUFFER *target, BYTE **buffer, uint32_t *size)
1354 {
1355     TPM_RC rc = TPM_RC_SUCCESS;
1356 
1357     if (rc == TPM_RC_SUCCESS) {
1358 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
1359     }
1360     return rc;
1361 }
1362 
1363 /* Table 80 - Definition of TPM2B_TIMEOUT Structure <IN/OUT> */
1364 
1365 TPM_RC
TSS_TPM2B_TIMEOUT_Unmarshalu(TPM2B_TIMEOUT * target,BYTE ** buffer,uint32_t * size)1366 TSS_TPM2B_TIMEOUT_Unmarshalu(TPM2B_TIMEOUT *target, BYTE **buffer, uint32_t *size)
1367 {
1368     TPM_RC rc = TPM_RC_SUCCESS;
1369 
1370     if (rc == TPM_RC_SUCCESS) {
1371 	rc = TSS_TPM2B_DIGEST_Unmarshalu(target, buffer, size);
1372     }
1373     return rc;
1374 }
1375 
1376 /* Table 81 - Definition of TPM2B_IV Structure <IN/OUT> */
1377 
1378 TPM_RC
TSS_TPM2B_IV_Unmarshalu(TPM2B_IV * target,BYTE ** buffer,uint32_t * size)1379 TSS_TPM2B_IV_Unmarshalu(TPM2B_IV *target, BYTE **buffer, uint32_t *size)
1380 {
1381     TPM_RC rc = TPM_RC_SUCCESS;
1382 
1383     if (rc == TPM_RC_SUCCESS) {
1384 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
1385     }
1386     return rc;
1387 }
1388 
1389 /* Table 83 - Definition of TPM2B_NAME Structure */
1390 
1391 TPM_RC
TSS_TPM2B_NAME_Unmarshalu(TPM2B_NAME * target,BYTE ** buffer,uint32_t * size)1392 TSS_TPM2B_NAME_Unmarshalu(TPM2B_NAME *target, BYTE **buffer, uint32_t *size)
1393 {
1394     TPM_RC rc = TPM_RC_SUCCESS;
1395 
1396     if (rc == TPM_RC_SUCCESS) {
1397 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.name), buffer, size);
1398     }
1399     return rc;
1400 }
1401 
1402 /* Table 85 - Definition of TPMS_PCR_SELECTION Structure */
1403 
1404 TPM_RC
TSS_TPMS_PCR_SELECTION_Unmarshalu(TPMS_PCR_SELECTION * target,BYTE ** buffer,uint32_t * size)1405 TSS_TPMS_PCR_SELECTION_Unmarshalu(TPMS_PCR_SELECTION *target, BYTE **buffer, uint32_t *size)
1406 {
1407     TPM_RC rc = TPM_RC_SUCCESS;
1408 
1409     if (rc == TPM_RC_SUCCESS) {
1410 	rc = TSS_TPMI_ALG_HASH_Unmarshalu(&target->hash, buffer, size, NO);
1411     }
1412     if (rc == TPM_RC_SUCCESS) {
1413 	rc = TSS_UINT8_Unmarshalu(&target->sizeofSelect, buffer, size);
1414     }
1415     if (rc == TPM_RC_SUCCESS) {
1416 	if (target->sizeofSelect > PCR_SELECT_MAX) {
1417 	    rc = TPM_RC_VALUE;
1418 	}
1419     }
1420     if (rc == TPM_RC_SUCCESS) {
1421 	rc = TSS_Array_Unmarshalu(target->pcrSelect, target->sizeofSelect, buffer, size);
1422     }
1423     return rc;
1424 }
1425 
1426 /* Table 88 - Definition of TPMT_TK_CREATION Structure */
1427 
1428 TPM_RC
TSS_TPMT_TK_CREATION_Unmarshalu(TPMT_TK_CREATION * target,BYTE ** buffer,uint32_t * size)1429 TSS_TPMT_TK_CREATION_Unmarshalu(TPMT_TK_CREATION *target, BYTE **buffer, uint32_t *size)
1430 {
1431     TPM_RC rc = TPM_RC_SUCCESS;
1432 
1433     if (rc == TPM_RC_SUCCESS) {
1434 	rc = TSS_TPM_ST_Unmarshalu(&target->tag, buffer, size);
1435     }
1436     if (rc == TPM_RC_SUCCESS) {
1437 	if (target->tag != TPM_ST_CREATION) {
1438 	    rc = TPM_RC_TAG;
1439 	}
1440     }
1441     if (rc == TPM_RC_SUCCESS) {
1442 	rc = TSS_TPMI_RH_HIERARCHY_Unmarshalu(&target->hierarchy, buffer, size, YES);
1443     }
1444     if (rc == TPM_RC_SUCCESS) {
1445 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->digest, buffer, size);
1446     }
1447     return rc;
1448 }
1449 
1450 /* Table 89 - Definition of TPMT_TK_VERIFIED Structure */
1451 
1452 TPM_RC
TSS_TPMT_TK_VERIFIED_Unmarshalu(TPMT_TK_VERIFIED * target,BYTE ** buffer,uint32_t * size)1453 TSS_TPMT_TK_VERIFIED_Unmarshalu(TPMT_TK_VERIFIED *target, BYTE **buffer, uint32_t *size)
1454 {
1455     TPM_RC rc = TPM_RC_SUCCESS;
1456 
1457     if (rc == TPM_RC_SUCCESS) {
1458 	rc = TSS_TPM_ST_Unmarshalu(&target->tag, buffer, size);
1459     }
1460     if (rc == TPM_RC_SUCCESS) {
1461 	if (target->tag != TPM_ST_VERIFIED) {
1462 	    rc = TPM_RC_TAG;
1463 	}
1464     }
1465     if (rc == TPM_RC_SUCCESS) {
1466 	rc = TSS_TPMI_RH_HIERARCHY_Unmarshalu(&target->hierarchy, buffer, size, YES);
1467     }
1468     if (rc == TPM_RC_SUCCESS) {
1469 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->digest, buffer, size);
1470     }
1471     return rc;
1472 }
1473 
1474 /* Table 90 - Definition of TPMT_TK_AUTH Structure */
1475 
1476 TPM_RC
TSS_TPMT_TK_AUTH_Unmarshalu(TPMT_TK_AUTH * target,BYTE ** buffer,uint32_t * size)1477 TSS_TPMT_TK_AUTH_Unmarshalu(TPMT_TK_AUTH *target, BYTE **buffer, uint32_t *size)
1478 {
1479     TPM_RC rc = TPM_RC_SUCCESS;
1480 
1481     if (rc == TPM_RC_SUCCESS) {
1482 	rc = TSS_TPM_ST_Unmarshalu(&target->tag, buffer, size);
1483     }
1484     if (rc == TPM_RC_SUCCESS) {
1485 	if ((target->tag != TPM_ST_AUTH_SIGNED) &&
1486 	    (target->tag != TPM_ST_AUTH_SECRET)) {
1487 	    rc = TPM_RC_TAG;
1488 	}
1489     }
1490     if (rc == TPM_RC_SUCCESS) {
1491 	rc = TSS_TPMI_RH_HIERARCHY_Unmarshalu(&target->hierarchy, buffer, size, YES);
1492     }
1493     if (rc == TPM_RC_SUCCESS) {
1494 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->digest, buffer, size);
1495     }
1496     return rc;
1497 }
1498 
1499 /* Table 91 - Definition of TPMT_TK_HASHCHECK Structure */
1500 
1501 TPM_RC
TSS_TPMT_TK_HASHCHECK_Unmarshalu(TPMT_TK_HASHCHECK * target,BYTE ** buffer,uint32_t * size)1502 TSS_TPMT_TK_HASHCHECK_Unmarshalu(TPMT_TK_HASHCHECK *target, BYTE **buffer, uint32_t *size)
1503 {
1504     TPM_RC rc = TPM_RC_SUCCESS;
1505 
1506     if (rc == TPM_RC_SUCCESS) {
1507 	rc = TSS_TPM_ST_Unmarshalu(&target->tag, buffer, size);
1508     }
1509     if (rc == TPM_RC_SUCCESS) {
1510 	if (target->tag != TPM_ST_HASHCHECK) {
1511 	    rc = TPM_RC_TAG;
1512 	}
1513     }
1514     if (rc == TPM_RC_SUCCESS) {
1515 	rc = TSS_TPMI_RH_HIERARCHY_Unmarshalu(&target->hierarchy, buffer, size, YES);
1516     }
1517     if (rc == TPM_RC_SUCCESS) {
1518 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->digest, buffer, size);
1519     }
1520     return rc;
1521 }
1522 
1523 /* Table 92 - Definition of TPMS_ALG_PROPERTY Structure <OUT> */
1524 
1525 TPM_RC
TSS_TPMS_ALG_PROPERTY_Unmarshalu(TPMS_ALG_PROPERTY * target,BYTE ** buffer,uint32_t * size)1526 TSS_TPMS_ALG_PROPERTY_Unmarshalu(TPMS_ALG_PROPERTY *target, BYTE **buffer, uint32_t *size)
1527 {
1528     TPM_RC rc = TPM_RC_SUCCESS;
1529 
1530     if (rc == TPM_RC_SUCCESS) {
1531 	rc = TSS_TPM_ALG_ID_Unmarshalu(&target->alg, buffer, size);
1532     }
1533     if (rc == TPM_RC_SUCCESS) {
1534 	rc = TSS_TPMA_ALGORITHM_Unmarshalu(&target->algProperties, buffer, size);
1535     }
1536     return rc;
1537 }
1538 
1539 /* Table 93 - Definition of TPMS_TAGGED_PROPERTY Structure <OUT> */
1540 
1541 TPM_RC
TSS_TPMS_TAGGED_PROPERTY_Unmarshalu(TPMS_TAGGED_PROPERTY * target,BYTE ** buffer,uint32_t * size)1542 TSS_TPMS_TAGGED_PROPERTY_Unmarshalu(TPMS_TAGGED_PROPERTY *target, BYTE **buffer, uint32_t *size)
1543 {
1544     TPM_RC rc = TPM_RC_SUCCESS;
1545 
1546     if (rc == TPM_RC_SUCCESS) {
1547 	rc = TSS_TPM_PT_Unmarshalu(&target->property, buffer, size);
1548     }
1549     if (rc == TPM_RC_SUCCESS) {
1550 	rc = TSS_UINT32_Unmarshalu(&target->value, buffer, size);
1551     }
1552     return rc;
1553 }
1554 
1555 /* Table 94 - Definition of TPMS_TAGGED_PCR_SELECT Structure <OUT> */
1556 
1557 TPM_RC
TSS_TPMS_TAGGED_PCR_SELECT_Unmarshalu(TPMS_TAGGED_PCR_SELECT * target,BYTE ** buffer,uint32_t * size)1558 TSS_TPMS_TAGGED_PCR_SELECT_Unmarshalu(TPMS_TAGGED_PCR_SELECT *target, BYTE **buffer, uint32_t *size)
1559 {
1560     TPM_RC rc = TPM_RC_SUCCESS;
1561 
1562     if (rc == TPM_RC_SUCCESS) {
1563 	rc = TSS_TPM_PT_PCR_Unmarshalu(&target->tag, buffer, size);
1564     }
1565     if (rc == TPM_RC_SUCCESS) {
1566 	rc = TSS_UINT8_Unmarshalu(&target->sizeofSelect, buffer, size);
1567     }
1568     if (rc == TPM_RC_SUCCESS) {
1569 	rc = TSS_Array_Unmarshalu(target->pcrSelect, target->sizeofSelect, buffer, size);
1570     }
1571     return rc;
1572 }
1573 
1574 /* Table 100 - Definition of TPMS_TAGGED_POLICY Structure <OUT> */
1575 
1576 TPM_RC
TSS_TPMS_TAGGED_POLICY_Unmarshalu(TPMS_TAGGED_POLICY * target,BYTE ** buffer,uint32_t * size)1577 TSS_TPMS_TAGGED_POLICY_Unmarshalu(TPMS_TAGGED_POLICY *target, BYTE **buffer, uint32_t *size)
1578 {
1579     TPM_RC rc = TPM_RC_SUCCESS;
1580 
1581     if (rc == TPM_RC_SUCCESS) {
1582 	rc = TSS_TPM_HANDLE_Unmarshalu(&target->handle, buffer, size);
1583     }
1584     if (rc == TPM_RC_SUCCESS) {
1585 	rc = TSS_TPMT_HA_Unmarshalu(&target->policyHash, buffer, size, YES);
1586     }
1587     return rc;
1588 }
1589 
1590 /* Table 95 - Definition of TPML_CC Structure */
1591 
1592 TPM_RC
TSS_TPML_CC_Unmarshalu(TPML_CC * target,BYTE ** buffer,uint32_t * size)1593 TSS_TPML_CC_Unmarshalu(TPML_CC *target, BYTE **buffer, uint32_t *size)
1594 {
1595     TPM_RC rc = TPM_RC_SUCCESS;
1596 
1597     uint32_t i;
1598     if (rc == TPM_RC_SUCCESS) {
1599 	rc = TSS_UINT32_Unmarshalu(&target->count, buffer, size);
1600     }
1601     if (rc == TPM_RC_SUCCESS) {
1602 	if (target->count > MAX_CAP_CC) {
1603 	    rc = TPM_RC_SIZE;
1604 	}
1605     }
1606     for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
1607 	rc = TSS_TPM_CC_Unmarshalu(&target->commandCodes[i], buffer, size);
1608     }
1609     return rc;
1610 }
1611 
1612 /* Table 96 - Definition of TPML_CCA Structure <OUT> */
1613 
1614 TPM_RC
TSS_TPML_CCA_Unmarshalu(TPML_CCA * target,BYTE ** buffer,uint32_t * size)1615 TSS_TPML_CCA_Unmarshalu(TPML_CCA *target, BYTE **buffer, uint32_t *size)
1616 {
1617     TPM_RC rc = TPM_RC_SUCCESS;
1618 
1619     uint32_t i;
1620     if (rc == TPM_RC_SUCCESS) {
1621 	rc = TSS_UINT32_Unmarshalu(&target->count, buffer, size);
1622     }
1623     if (rc == TPM_RC_SUCCESS) {
1624 	if (target->count > MAX_CAP_CC) {
1625 	    rc = TPM_RC_SIZE;
1626 	}
1627     }
1628     for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
1629 	rc = TSS_TPMA_CC_Unmarshalu(&target->commandAttributes[i], buffer, size);
1630     }
1631     return rc;
1632 }
1633 
1634 /* Table 97 - Definition of TPML_ALG Structure */
1635 
1636 TPM_RC
TSS_TPML_ALG_Unmarshalu(TPML_ALG * target,BYTE ** buffer,uint32_t * size)1637 TSS_TPML_ALG_Unmarshalu(TPML_ALG *target, BYTE **buffer, uint32_t *size)
1638 {
1639     TPM_RC rc = TPM_RC_SUCCESS;
1640 
1641     uint32_t i;
1642     if (rc == TPM_RC_SUCCESS) {
1643 	rc = TSS_UINT32_Unmarshalu(&target->count, buffer, size);
1644     }
1645     if (rc == TPM_RC_SUCCESS) {
1646 	if (target->count > MAX_ALG_LIST_SIZE) {
1647 	    rc = TPM_RC_SIZE;
1648 	}
1649     }
1650     for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
1651 	rc = TSS_TPM_ALG_ID_Unmarshalu(&target->algorithms[i], buffer, size);
1652     }
1653     return rc;
1654 }
1655 
1656 /* Table 98 - Definition of TPML_HANDLE Structure <OUT> */
1657 
1658 TPM_RC
TSS_TPML_HANDLE_Unmarshalu(TPML_HANDLE * target,BYTE ** buffer,uint32_t * size)1659 TSS_TPML_HANDLE_Unmarshalu(TPML_HANDLE *target, BYTE **buffer, uint32_t *size)
1660 {
1661     TPM_RC rc = TPM_RC_SUCCESS;
1662 
1663     uint32_t i;
1664     if (rc == TPM_RC_SUCCESS) {
1665 	rc = TSS_UINT32_Unmarshalu(&target->count, buffer, size);
1666     }
1667     if (rc == TPM_RC_SUCCESS) {
1668 	if (target->count > MAX_CAP_HANDLES) {
1669 	    rc = TPM_RC_SIZE;
1670 	}
1671     }
1672     for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
1673 	rc = TSS_TPM_HANDLE_Unmarshalu(&target->handle[i], buffer, size);
1674     }
1675     return rc;
1676 }
1677 
1678 /* Table 99 - Definition of TPML_DIGEST Structure */
1679 
1680 /* PolicyOr has a restriction of at least a count of two.  This function is also used to unmarshal
1681    PCR_Read, where a count of one is permitted.
1682 */
1683 
1684 TPM_RC
TSS_TPML_DIGEST_Unmarshalu(TPML_DIGEST * target,BYTE ** buffer,uint32_t * size,uint32_t minCount)1685 TSS_TPML_DIGEST_Unmarshalu(TPML_DIGEST *target, BYTE **buffer, uint32_t *size, uint32_t minCount)
1686 {
1687     TPM_RC rc = TPM_RC_SUCCESS;
1688 
1689     uint32_t i;
1690     if (rc == TPM_RC_SUCCESS) {
1691 	rc = TSS_UINT32_Unmarshalu(&target->count, buffer, size);
1692     }
1693     if (rc == TPM_RC_SUCCESS) {
1694 	if (target->count < minCount) {
1695 	    rc = TPM_RC_SIZE;
1696 	}
1697     }
1698     if (rc == TPM_RC_SUCCESS) {
1699 	if (target->count > 8) {
1700 	    rc = TPM_RC_SIZE;
1701 	}
1702     }
1703     for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
1704 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->digests[i], buffer, size);
1705     }
1706     return rc;
1707 }
1708 
1709 /* Table 100 - Definition of TPML_DIGEST_VALUES Structure */
1710 
1711 TPM_RC
TSS_TPML_DIGEST_VALUES_Unmarshalu(TPML_DIGEST_VALUES * target,BYTE ** buffer,uint32_t * size)1712 TSS_TPML_DIGEST_VALUES_Unmarshalu(TPML_DIGEST_VALUES *target, BYTE **buffer, uint32_t *size)
1713 {
1714     TPM_RC rc = TPM_RC_SUCCESS;
1715 
1716     uint32_t i;
1717     if (rc == TPM_RC_SUCCESS) {
1718 	rc = TSS_UINT32_Unmarshalu(&target->count, buffer, size);
1719     }
1720     if (rc == TPM_RC_SUCCESS) {
1721 	if (target->count > HASH_COUNT) {
1722 	    rc = TPM_RC_SIZE;
1723 	}
1724     }
1725     for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
1726 	rc = TSS_TPMT_HA_Unmarshalu(&target->digests[i], buffer, size, NO);
1727     }
1728     return rc;
1729 }
1730 
1731 /* Table 102 - Definition of TPML_PCR_SELECTION Structure */
1732 
1733 TPM_RC
TSS_TPML_PCR_SELECTION_Unmarshalu(TPML_PCR_SELECTION * target,BYTE ** buffer,uint32_t * size)1734 TSS_TPML_PCR_SELECTION_Unmarshalu(TPML_PCR_SELECTION *target, BYTE **buffer, uint32_t *size)
1735 {
1736     TPM_RC rc = TPM_RC_SUCCESS;
1737 
1738     uint32_t i;
1739     if (rc == TPM_RC_SUCCESS) {
1740 	rc = TSS_UINT32_Unmarshalu(&target->count, buffer, size);
1741     }
1742     if (rc == TPM_RC_SUCCESS) {
1743 	if (target->count > HASH_COUNT) {
1744 	    rc = TPM_RC_SIZE;
1745 	}
1746     }
1747     for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
1748 	rc = TSS_TPMS_PCR_SELECTION_Unmarshalu(&target->pcrSelections[i], buffer, size);
1749     }
1750     return rc;
1751 }
1752 
1753 /* Table 103 - Definition of TPML_ALG_PROPERTY Structure <OUT> */
1754 
1755 TPM_RC
TSS_TPML_ALG_PROPERTY_Unmarshalu(TPML_ALG_PROPERTY * target,BYTE ** buffer,uint32_t * size)1756 TSS_TPML_ALG_PROPERTY_Unmarshalu(TPML_ALG_PROPERTY *target, BYTE **buffer, uint32_t *size)
1757 {
1758     TPM_RC rc = TPM_RC_SUCCESS;
1759 
1760     uint32_t i;
1761     if (rc == TPM_RC_SUCCESS) {
1762 	rc = TSS_UINT32_Unmarshalu(&target->count, buffer, size);
1763     }
1764     if (rc == TPM_RC_SUCCESS) {
1765 	if (target->count > MAX_CAP_ALGS) {
1766 	    rc = TPM_RC_SIZE;
1767 	}
1768     }
1769     for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
1770 	rc = TSS_TPMS_ALG_PROPERTY_Unmarshalu(&target->algProperties[i], buffer, size);
1771     }
1772     return rc;
1773 }
1774 
1775 /* Table 104 - Definition of TPML_TAGGED_TPM_PROPERTY Structure <OUT> */
1776 
1777 TPM_RC
TSS_TPML_TAGGED_TPM_PROPERTY_Unmarshalu(TPML_TAGGED_TPM_PROPERTY * target,BYTE ** buffer,uint32_t * size)1778 TSS_TPML_TAGGED_TPM_PROPERTY_Unmarshalu(TPML_TAGGED_TPM_PROPERTY  *target, BYTE **buffer, uint32_t *size)
1779 {
1780     TPM_RC rc = TPM_RC_SUCCESS;
1781 
1782     uint32_t i;
1783     if (rc == TPM_RC_SUCCESS) {
1784 	rc = TSS_UINT32_Unmarshalu(&target->count, buffer, size);
1785     }
1786     if (rc == TPM_RC_SUCCESS) {
1787 	if (target->count > MAX_TPM_PROPERTIES) {
1788 	    rc = TPM_RC_SIZE;
1789 	}
1790     }
1791     for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
1792 	rc = TSS_TPMS_TAGGED_PROPERTY_Unmarshalu(&target->tpmProperty[i], buffer, size);
1793     }
1794     return rc;
1795 }
1796 
1797 /* Table 105 - Definition of TPML_TAGGED_PCR_PROPERTY Structure <OUT> */
1798 
1799 TPM_RC
TSS_TPML_TAGGED_PCR_PROPERTY_Unmarshalu(TPML_TAGGED_PCR_PROPERTY * target,BYTE ** buffer,uint32_t * size)1800 TSS_TPML_TAGGED_PCR_PROPERTY_Unmarshalu(TPML_TAGGED_PCR_PROPERTY *target, BYTE **buffer, uint32_t *size)
1801 {
1802     TPM_RC rc = TPM_RC_SUCCESS;
1803 
1804     uint32_t i;
1805     if (rc == TPM_RC_SUCCESS) {
1806 	rc = TSS_UINT32_Unmarshalu(&target->count, buffer, size);
1807     }
1808     if (rc == TPM_RC_SUCCESS) {
1809 	if (target->count > MAX_PCR_PROPERTIES) {
1810 	    rc = TPM_RC_SIZE;
1811 	}
1812     }
1813     for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
1814 	rc = TSS_TPMS_TAGGED_PCR_SELECT_Unmarshalu(&target->pcrProperty[i], buffer, size);
1815     }
1816     return rc;
1817 }
1818 
1819 /* Table 106 - Definition of {ECC} TPML_ECC_CURVE Structure <OUT> */
1820 
1821 TPM_RC
TSS_TPML_ECC_CURVE_Unmarshalu(TPML_ECC_CURVE * target,BYTE ** buffer,uint32_t * size)1822 TSS_TPML_ECC_CURVE_Unmarshalu(TPML_ECC_CURVE *target, BYTE **buffer, uint32_t *size)
1823 {
1824     TPM_RC rc = TPM_RC_SUCCESS;
1825 
1826     uint32_t i;
1827     if (rc == TPM_RC_SUCCESS) {
1828 	rc = TSS_UINT32_Unmarshalu(&target->count, buffer, size);
1829     }
1830     if (rc == TPM_RC_SUCCESS) {
1831 	if (target->count > MAX_ECC_CURVES) {
1832 	    rc = TPM_RC_SIZE;
1833 	}
1834     }
1835     for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
1836 	rc = TSS_TPM_ECC_CURVE_Unmarshalu(&target->eccCurves[i], buffer, size);
1837     }
1838     return rc;
1839 }
1840 
1841 /* Table 112 - Definition of TPML_TAGGED_POLICY Structure <OUT> */
1842 
1843 TPM_RC
TSS_TPML_TAGGED_POLICY_Unmarshalu(TPML_TAGGED_POLICY * target,BYTE ** buffer,uint32_t * size)1844 TSS_TPML_TAGGED_POLICY_Unmarshalu(TPML_TAGGED_POLICY *target, BYTE **buffer, uint32_t *size)
1845 {
1846     TPM_RC rc = TPM_RC_SUCCESS;
1847 
1848     uint32_t i;
1849     if (rc == TPM_RC_SUCCESS) {
1850 	rc = TSS_UINT32_Unmarshalu(&target->count, buffer, size);
1851     }
1852     if (rc == TPM_RC_SUCCESS) {
1853 	if (target->count > MAX_TAGGED_POLICIES) {
1854 	    rc = TPM_RC_SIZE;
1855 	}
1856     }
1857     for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
1858 	rc = TSS_TPMS_TAGGED_POLICY_Unmarshalu(&target->policies[i], buffer, size);
1859     }
1860     return rc;
1861 }
1862 
1863 /* Table 107 - Definition of TPMU_CAPABILITIES Union <OUT> */
1864 
1865 TPM_RC
TSS_TPMU_CAPABILITIES_Unmarshalu(TPMU_CAPABILITIES * target,BYTE ** buffer,uint32_t * size,uint32_t selector)1866 TSS_TPMU_CAPABILITIES_Unmarshalu(TPMU_CAPABILITIES *target, BYTE **buffer, uint32_t *size, uint32_t selector)
1867 {
1868     TPM_RC rc = TPM_RC_SUCCESS;
1869 
1870     switch (selector) {
1871       case TPM_CAP_ALGS:
1872 	rc = TSS_TPML_ALG_PROPERTY_Unmarshalu(&target->algorithms, buffer, size);
1873 	break;
1874       case TPM_CAP_HANDLES:
1875 	rc = TSS_TPML_HANDLE_Unmarshalu(&target->handles, buffer, size);
1876 	break;
1877       case TPM_CAP_COMMANDS:
1878 	rc = TSS_TPML_CCA_Unmarshalu(&target->command, buffer, size);
1879 	break;
1880       case TPM_CAP_PP_COMMANDS:
1881 	rc = TSS_TPML_CC_Unmarshalu(&target->ppCommands, buffer, size);
1882 	break;
1883       case TPM_CAP_AUDIT_COMMANDS:
1884 	rc = TSS_TPML_CC_Unmarshalu(&target->auditCommands, buffer, size);
1885 	break;
1886       case TPM_CAP_PCRS:
1887 	rc = TSS_TPML_PCR_SELECTION_Unmarshalu(&target->assignedPCR, buffer, size);
1888 	break;
1889       case TPM_CAP_TPM_PROPERTIES:
1890 	rc = TSS_TPML_TAGGED_TPM_PROPERTY_Unmarshalu(&target->tpmProperties, buffer, size);
1891 	break;
1892       case TPM_CAP_PCR_PROPERTIES:
1893 	rc = TSS_TPML_TAGGED_PCR_PROPERTY_Unmarshalu(&target->pcrProperties, buffer, size);
1894 	break;
1895       case TPM_CAP_ECC_CURVES:
1896 	rc = TSS_TPML_ECC_CURVE_Unmarshalu(&target->eccCurves, buffer, size);
1897 	break;
1898       case TPM_CAP_AUTH_POLICIES:
1899 	rc = TSS_TPML_TAGGED_POLICY_Unmarshalu(&target->authPolicies, buffer, size);
1900 	break;
1901       default:
1902 	rc = TPM_RC_SELECTOR;
1903     }
1904     return rc;
1905 }
1906 
1907 /* Table 108 - Definition of TPMS_CAPABILITY_DATA Structure <OUT> */
1908 
1909 TPM_RC
TSS_TPMS_CAPABILITY_DATA_Unmarshalu(TPMS_CAPABILITY_DATA * target,BYTE ** buffer,uint32_t * size)1910 TSS_TPMS_CAPABILITY_DATA_Unmarshalu(TPMS_CAPABILITY_DATA *target, BYTE **buffer, uint32_t *size)
1911 {
1912     TPM_RC rc = TPM_RC_SUCCESS;
1913 
1914     if (rc == TPM_RC_SUCCESS) {
1915 	rc = TSS_TPM_CAP_Unmarshalu(&target->capability, buffer, size);
1916     }
1917     if (rc == TPM_RC_SUCCESS) {
1918 	rc = TSS_TPMU_CAPABILITIES_Unmarshalu(&target->data, buffer, size, target->capability);
1919     }
1920     return rc;
1921 }
1922 
1923 /* Table 109 - Definition of TPMS_CLOCK_INFO Structure */
1924 
1925 TPM_RC
TSS_TPMS_CLOCK_INFO_Unmarshalu(TPMS_CLOCK_INFO * target,BYTE ** buffer,uint32_t * size)1926 TSS_TPMS_CLOCK_INFO_Unmarshalu(TPMS_CLOCK_INFO *target, BYTE **buffer, uint32_t *size)
1927 {
1928     TPM_RC rc = TPM_RC_SUCCESS;
1929 
1930     if (rc == TPM_RC_SUCCESS) {
1931 	rc = TSS_UINT64_Unmarshalu(&target->clock, buffer, size);
1932     }
1933     if (rc == TPM_RC_SUCCESS) {
1934 	rc = TSS_UINT32_Unmarshalu(&target->resetCount, buffer, size);
1935     }
1936     if (rc == TPM_RC_SUCCESS) {
1937 	rc = TSS_UINT32_Unmarshalu(&target->restartCount, buffer, size);
1938     }
1939     if (rc == TPM_RC_SUCCESS) {
1940 	rc = TSS_TPMI_YES_NO_Unmarshalu(&target->safe, buffer, size);
1941     }
1942     return rc;
1943 }
1944 
1945 /* Table 110 - Definition of TPMS_TIME_INFO Structure */
1946 
1947 TPM_RC
TSS_TPMS_TIME_INFO_Unmarshalu(TPMS_TIME_INFO * target,BYTE ** buffer,uint32_t * size)1948 TSS_TPMS_TIME_INFO_Unmarshalu(TPMS_TIME_INFO *target, BYTE **buffer, uint32_t *size)
1949 {
1950     TPM_RC rc = TPM_RC_SUCCESS;
1951 
1952     if (rc == TPM_RC_SUCCESS) {
1953 	rc = TSS_UINT64_Unmarshalu(&target->time, buffer, size);
1954     }
1955     if (rc == TPM_RC_SUCCESS) {
1956 	rc = TSS_TPMS_CLOCK_INFO_Unmarshalu(&target->clockInfo, buffer, size);
1957     }
1958     return rc;
1959 }
1960 
1961 #ifndef TPM_TSS_NOCMDCHECK
1962 
1963 /* Table 111 - Definition of TPMS_TIME_ATTEST_INFO Structure <OUT> */
1964 
1965 TPM_RC
TSS_TPMS_TIME_ATTEST_INFO_Unmarshalu(TPMS_TIME_ATTEST_INFO * target,BYTE ** buffer,uint32_t * size)1966 TSS_TPMS_TIME_ATTEST_INFO_Unmarshalu(TPMS_TIME_ATTEST_INFO *target, BYTE **buffer, uint32_t *size)
1967 {
1968     TPM_RC rc = TPM_RC_SUCCESS;
1969 
1970     if (rc == TPM_RC_SUCCESS) {
1971 	rc = TSS_TPMS_TIME_INFO_Unmarshalu(&target->time, buffer, size);
1972     }
1973     if (rc == TPM_RC_SUCCESS) {
1974 	rc = TSS_UINT64_Unmarshalu(&target->firmwareVersion, buffer, size);
1975     }
1976     return rc;
1977 }
1978 
1979 /* Table 112 - Definition of TPMS_CERTIFY_INFO Structure <OUT> */
1980 
1981 TPM_RC
TSS_TPMS_CERTIFY_INFO_Unmarshalu(TPMS_CERTIFY_INFO * target,BYTE ** buffer,uint32_t * size)1982 TSS_TPMS_CERTIFY_INFO_Unmarshalu(TPMS_CERTIFY_INFO *target, BYTE **buffer, uint32_t *size)
1983 {
1984     TPM_RC rc = TPM_RC_SUCCESS;
1985 
1986     if (rc == TPM_RC_SUCCESS) {
1987 	rc = TSS_TPM2B_NAME_Unmarshalu(&target->name, buffer, size);
1988     }
1989     if (rc == TPM_RC_SUCCESS) {
1990 	rc = TSS_TPM2B_NAME_Unmarshalu(&target->qualifiedName, buffer, size);
1991     }
1992     return rc;
1993 }
1994 
1995 /* Table 113 - Definition of TPMS_QUOTE_INFO Structure <OUT> */
1996 
1997 TPM_RC
TSS_TPMS_QUOTE_INFO_Unmarshalu(TPMS_QUOTE_INFO * target,BYTE ** buffer,uint32_t * size)1998 TSS_TPMS_QUOTE_INFO_Unmarshalu(TPMS_QUOTE_INFO *target, BYTE **buffer, uint32_t *size)
1999 {
2000     TPM_RC rc = TPM_RC_SUCCESS;
2001 
2002     if (rc == TPM_RC_SUCCESS) {
2003 	rc = TSS_TPML_PCR_SELECTION_Unmarshalu(&target->pcrSelect, buffer, size);
2004     }
2005     if (rc == TPM_RC_SUCCESS) {
2006 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->pcrDigest, buffer, size);
2007     }
2008     return rc;
2009 }
2010 
2011 /* Table 114 - Definition of TPMS_COMMAND_AUDIT_INFO Structure <OUT> */
2012 
2013 TPM_RC
TSS_TPMS_COMMAND_AUDIT_INFO_Unmarshalu(TPMS_COMMAND_AUDIT_INFO * target,BYTE ** buffer,uint32_t * size)2014 TSS_TPMS_COMMAND_AUDIT_INFO_Unmarshalu(TPMS_COMMAND_AUDIT_INFO *target, BYTE **buffer, uint32_t *size)
2015 {
2016     TPM_RC rc = TPM_RC_SUCCESS;
2017 
2018     if (rc == TPM_RC_SUCCESS) {
2019 	rc = TSS_UINT64_Unmarshalu(&target->auditCounter, buffer, size);
2020     }
2021     if (rc == TPM_RC_SUCCESS) {
2022 	rc = TSS_TPM_ALG_ID_Unmarshalu(&target->digestAlg, buffer, size);
2023     }
2024     if (rc == TPM_RC_SUCCESS) {
2025 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->auditDigest, buffer, size);
2026     }
2027     if (rc == TPM_RC_SUCCESS) {
2028 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->commandDigest, buffer, size);
2029     }
2030     return rc;
2031 }
2032 
2033 /* Table 115 - Definition of TPMS_SESSION_AUDIT_INFO Structure <OUT> */
2034 
2035 TPM_RC
TSS_TPMS_SESSION_AUDIT_INFO_Unmarshalu(TPMS_SESSION_AUDIT_INFO * target,BYTE ** buffer,uint32_t * size)2036 TSS_TPMS_SESSION_AUDIT_INFO_Unmarshalu(TPMS_SESSION_AUDIT_INFO *target, BYTE **buffer, uint32_t *size)
2037 {
2038     TPM_RC rc = TPM_RC_SUCCESS;
2039 
2040     if (rc == TPM_RC_SUCCESS) {
2041 	rc = TSS_TPMI_YES_NO_Unmarshalu(&target->exclusiveSession, buffer, size);
2042     }
2043     if (rc == TPM_RC_SUCCESS) {
2044 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->sessionDigest, buffer, size);
2045     }
2046     return rc;
2047 }
2048 
2049 /* Table 116 - Definition of TPMS_CREATION_INFO Structure <OUT> */
2050 
2051 TPM_RC
TSS_TPMS_CREATION_INFO_Unmarshalu(TPMS_CREATION_INFO * target,BYTE ** buffer,uint32_t * size)2052 TSS_TPMS_CREATION_INFO_Unmarshalu(TPMS_CREATION_INFO *target, BYTE **buffer, uint32_t *size)
2053 {
2054     TPM_RC rc = TPM_RC_SUCCESS;
2055 
2056     if (rc == TPM_RC_SUCCESS) {
2057 	rc = TSS_TPM2B_NAME_Unmarshalu(&target->objectName, buffer, size);
2058     }
2059     if (rc == TPM_RC_SUCCESS) {
2060 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->creationHash, buffer, size);
2061     }
2062     return rc;
2063 }
2064 
2065 /* Table 117 - Definition of TPMS_NV_CERTIFY_INFO Structure <OUT> */
2066 
2067 TPM_RC
TSS_TPMS_NV_CERTIFY_INFO_Unmarshalu(TPMS_NV_CERTIFY_INFO * target,BYTE ** buffer,uint32_t * size)2068 TSS_TPMS_NV_CERTIFY_INFO_Unmarshalu(TPMS_NV_CERTIFY_INFO *target, BYTE **buffer, uint32_t *size)
2069 {
2070     TPM_RC rc = TPM_RC_SUCCESS;
2071 
2072     if (rc == TPM_RC_SUCCESS) {
2073 	rc = TSS_TPM2B_NAME_Unmarshalu(&target->indexName, buffer, size);
2074     }
2075     if (rc == TPM_RC_SUCCESS) {
2076 	rc = TSS_UINT16_Unmarshalu(&target->offset, buffer, size);
2077     }
2078     if (rc == TPM_RC_SUCCESS) {
2079 	rc = TSS_TPM2B_MAX_NV_BUFFER_Unmarshalu(&target->nvContents, buffer, size);
2080     }
2081     return rc;
2082 }
2083 
2084 /* Table 125 - Definition of TPMS_NV_DIGEST_CERTIFY_INFO Structure <OUT> */
2085 TPM_RC
TSS_TPMS_NV_DIGEST_CERTIFY_INFO_Unmarshalu(TPMS_NV_DIGEST_CERTIFY_INFO * target,BYTE ** buffer,uint32_t * size)2086 TSS_TPMS_NV_DIGEST_CERTIFY_INFO_Unmarshalu(TPMS_NV_DIGEST_CERTIFY_INFO *target, BYTE **buffer, uint32_t *size)
2087 {
2088     TPM_RC rc = TPM_RC_SUCCESS;
2089 
2090     if (rc == TPM_RC_SUCCESS) {
2091 	rc = TSS_TPM2B_NAME_Unmarshalu(&target->indexName, buffer, size);
2092     }
2093     if (rc == TPM_RC_SUCCESS) {
2094 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->nvDigest, buffer, size);
2095     }
2096     return rc;
2097 }
2098 
2099 /* Table 118 - Definition of (TPM_ST) TPMI_ST_ATTEST Type <OUT> */
2100 
2101 TPM_RC
TSS_TPMI_ST_ATTEST_Unmarshalu(TPMI_ST_ATTEST * target,BYTE ** buffer,uint32_t * size)2102 TSS_TPMI_ST_ATTEST_Unmarshalu(TPMI_ST_ATTEST *target, BYTE **buffer, uint32_t *size)
2103 {
2104     TPM_RC rc = TPM_RC_SUCCESS;
2105 
2106     if (rc == TPM_RC_SUCCESS) {
2107 	rc = TSS_TPM_ST_Unmarshalu(target, buffer, size);
2108     }
2109     return rc;
2110 }
2111 
2112 /*  Table 119 - Definition of TPMU_ATTEST Union <OUT> */
2113 
2114 TPM_RC
TSS_TPMU_ATTEST_Unmarshalu(TPMU_ATTEST * target,BYTE ** buffer,uint32_t * size,uint32_t selector)2115 TSS_TPMU_ATTEST_Unmarshalu(TPMU_ATTEST *target, BYTE **buffer, uint32_t *size, uint32_t selector)
2116 {
2117     TPM_RC rc = TPM_RC_SUCCESS;
2118 
2119     switch (selector) {
2120       case TPM_ST_ATTEST_CERTIFY:
2121 	rc = TSS_TPMS_CERTIFY_INFO_Unmarshalu(&target->certify, buffer, size);
2122 	break;
2123       case TPM_ST_ATTEST_CREATION:
2124 	rc = TSS_TPMS_CREATION_INFO_Unmarshalu(&target->creation, buffer, size);
2125 	break;
2126       case TPM_ST_ATTEST_QUOTE:
2127 	rc = TSS_TPMS_QUOTE_INFO_Unmarshalu(&target->quote, buffer, size);
2128 	break;
2129       case TPM_ST_ATTEST_COMMAND_AUDIT:
2130 	rc = TSS_TPMS_COMMAND_AUDIT_INFO_Unmarshalu(&target->commandAudit, buffer, size);
2131 	break;
2132       case TPM_ST_ATTEST_SESSION_AUDIT:
2133 	rc = TSS_TPMS_SESSION_AUDIT_INFO_Unmarshalu(&target->sessionAudit, buffer, size);
2134 	break;
2135       case TPM_ST_ATTEST_TIME:
2136 	rc = TSS_TPMS_TIME_ATTEST_INFO_Unmarshalu(&target->time, buffer, size);
2137 	break;
2138       case TPM_ST_ATTEST_NV:
2139 	rc = TSS_TPMS_NV_CERTIFY_INFO_Unmarshalu(&target->nv, buffer, size);
2140 	break;
2141       case TPM_ST_ATTEST_NV_DIGEST:
2142 	rc = TSS_TPMS_NV_DIGEST_CERTIFY_INFO_Unmarshalu(&target->nvDigest, buffer, size);
2143 	break;
2144       default:
2145 	rc = TPM_RC_SELECTOR;
2146 
2147     }
2148     return rc;
2149 }
2150 
2151 /* Table 120 - Definition of TPMS_ATTEST Structure <OUT> */
2152 
2153 TPM_RC
TSS_TPMS_ATTEST_Unmarshalu(TPMS_ATTEST * target,BYTE ** buffer,uint32_t * size)2154 TSS_TPMS_ATTEST_Unmarshalu(TPMS_ATTEST *target, BYTE **buffer, uint32_t *size)
2155 {
2156     TPM_RC rc = TPM_RC_SUCCESS;
2157 
2158     if (rc == TPM_RC_SUCCESS) {
2159 	rc = TSS_TPM_GENERATED_Unmarshalu(&target->magic, buffer, size);
2160     }
2161     if (rc == TPM_RC_SUCCESS) {
2162 	rc = TSS_TPMI_ST_ATTEST_Unmarshalu(&target->type, buffer, size);
2163     }
2164     if (rc == TPM_RC_SUCCESS) {
2165 	rc = TSS_TPM2B_NAME_Unmarshalu(&target->qualifiedSigner, buffer, size);
2166     }
2167     if (rc == TPM_RC_SUCCESS) {
2168 	rc = TSS_TPM2B_DATA_Unmarshalu(&target->extraData, buffer, size);
2169     }
2170     if (rc == TPM_RC_SUCCESS) {
2171 	rc = TSS_TPMS_CLOCK_INFO_Unmarshalu(&target->clockInfo, buffer, size);
2172     }
2173     if (rc == TPM_RC_SUCCESS) {
2174 	rc = TSS_UINT64_Unmarshalu(&target->firmwareVersion, buffer, size);
2175     }
2176     if (rc == TPM_RC_SUCCESS) {
2177 	rc = TSS_TPMU_ATTEST_Unmarshalu(&target->attested, buffer, size, target->type);
2178     }
2179     return rc;
2180 }
2181 
2182 #endif	/* TPM_TSS_NOCMDCHECK */
2183 
2184 /* Table 121 - Definition of TPM2B_ATTEST Structure <OUT> */
2185 
2186 TPM_RC
TSS_TPM2B_ATTEST_Unmarshalu(TPM2B_ATTEST * target,BYTE ** buffer,uint32_t * size)2187 TSS_TPM2B_ATTEST_Unmarshalu(TPM2B_ATTEST *target, BYTE **buffer, uint32_t *size)
2188 {
2189     TPM_RC rc = TPM_RC_SUCCESS;
2190 
2191     if (rc == TPM_RC_SUCCESS) {
2192 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.attestationData), buffer, size);
2193     }
2194     return rc;
2195 }
2196 
2197 /* Table 123 - Definition of TPMS_AUTH_RESPONSE Structure <OUT> */
2198 
2199 TPM_RC
TSS_TPMS_AUTH_RESPONSE_Unmarshalu(TPMS_AUTH_RESPONSE * target,BYTE ** buffer,uint32_t * size)2200 TSS_TPMS_AUTH_RESPONSE_Unmarshalu(TPMS_AUTH_RESPONSE *target, BYTE **buffer, uint32_t *size)
2201 {
2202     TPM_RC rc = TPM_RC_SUCCESS;
2203 
2204     if (rc == TPM_RC_SUCCESS) {
2205 	rc = TSS_TPM2B_NONCE_Unmarshalu(&target->nonce, buffer, size);
2206     }
2207     if (rc == TPM_RC_SUCCESS) {
2208 	rc = TSS_TPMA_SESSION_Unmarshalu(&target->sessionAttributes, buffer, size);
2209     }
2210     if (rc == TPM_RC_SUCCESS) {
2211 	rc = TSS_TPM2B_AUTH_Unmarshalu(&target->hmac, buffer, size);
2212     }
2213     return rc;
2214 }
2215 
2216 /* Table 124 - Definition of {!ALG.S} (TPM_KEY_BITS) TPMI_!ALG.S_KEY_BITS Type */
2217 
2218 #ifdef TPM_ALG_AES
2219 
2220 TPM_RC
TSS_TPMI_AES_KEY_BITS_Unmarshalu(TPMI_AES_KEY_BITS * target,BYTE ** buffer,uint32_t * size)2221 TSS_TPMI_AES_KEY_BITS_Unmarshalu(TPMI_AES_KEY_BITS *target, BYTE **buffer, uint32_t *size)
2222 {
2223     TPM_RC rc = TPM_RC_SUCCESS;
2224 
2225     if (rc == TPM_RC_SUCCESS) {
2226 	rc = TSS_TPM_KEY_BITS_Unmarshalu(target, buffer, size);
2227     }
2228     return rc;
2229 }
2230 #endif	/* TPM_ALG_AES */
2231 
2232 #ifndef TPM_TSS_NOCMDCHECK
2233 
2234 #ifdef TPM_ALG_CAMELLIA
2235 TPM_RC
TSS_TPMI_CAMELLIA_KEY_BITS_Unmarshalu(TPMI_CAMELLIA_KEY_BITS * target,BYTE ** buffer,uint32_t * size)2236 TSS_TPMI_CAMELLIA_KEY_BITS_Unmarshalu(TPMI_CAMELLIA_KEY_BITS *target, BYTE **buffer, uint32_t *size)
2237 {
2238     TPM_RC rc = TPM_RC_SUCCESS;
2239 
2240     if (rc == TPM_RC_SUCCESS) {
2241 	rc = TSS_TPM_KEY_BITS_Unmarshalu(target, buffer, size);
2242     }
2243     return rc;
2244 }
2245 #endif	/*  TPM_ALG_CAMELLIA */
2246 
2247 #ifdef TPM_ALG_SM4
2248 TPM_RC
TSS_TPMI_SM4_KEY_BITS_Unmarshalu(TPMI_SM4_KEY_BITS * target,BYTE ** buffer,uint32_t * size)2249 TSS_TPMI_SM4_KEY_BITS_Unmarshalu(TPMI_SM4_KEY_BITS *target, BYTE **buffer, uint32_t *size)
2250 {
2251     TPM_RC rc = TPM_RC_SUCCESS;
2252 
2253     if (rc == TPM_RC_SUCCESS) {
2254 	rc = TSS_TPM_KEY_BITS_Unmarshalu(target, buffer, size);
2255     }
2256     return rc;
2257 }
2258 #endif	/* TPM_ALG_SM4 */
2259 #endif	/* TPM_TSS_NOCMDCHECK */
2260 
2261 /* Table 125 - Definition of TPMU_SYM_KEY_BITS Union */
2262 
2263 TPM_RC
TSS_TPMU_SYM_KEY_BITS_Unmarshalu(TPMU_SYM_KEY_BITS * target,BYTE ** buffer,uint32_t * size,uint32_t selector)2264 TSS_TPMU_SYM_KEY_BITS_Unmarshalu(TPMU_SYM_KEY_BITS *target, BYTE **buffer, uint32_t *size, uint32_t selector)
2265 {
2266     TPM_RC rc = TPM_RC_SUCCESS;
2267 
2268     switch (selector) {
2269 #ifdef TPM_ALG_AES
2270       case TPM_ALG_AES:
2271 	rc = TSS_TPMI_AES_KEY_BITS_Unmarshalu(&target->aes, buffer, size);
2272 	break;
2273 #endif
2274 #ifdef TPM_ALG_SM4
2275       case TPM_ALG_SM4:
2276 	rc = TSS_TPMI_SM4_KEY_BITS_Unmarshalu(&target->sm4, buffer, size);
2277 	break;
2278 #endif
2279 #ifdef TPM_ALG_CAMELLIA
2280       case TPM_ALG_CAMELLIA:
2281 	rc = TSS_TPMI_CAMELLIA_KEY_BITS_Unmarshalu(&target->camellia, buffer, size);
2282 	break;
2283 #endif
2284 #ifdef TPM_ALG_XOR
2285       case TPM_ALG_XOR:
2286 	rc = TSS_TPMI_ALG_HASH_Unmarshalu(&target->xorr, buffer, size, NO);
2287 	break;
2288 #endif
2289       case TPM_ALG_NULL:
2290 	break;
2291       default:
2292 	rc = TPM_RC_SELECTOR;
2293     }
2294     return rc;
2295 }
2296 
2297 /* Table 126 - Definition of TPMU_SYM_MODE Union */
2298 
2299 TPM_RC
TSS_TPMU_SYM_MODE_Unmarshalu(TPMU_SYM_MODE * target,BYTE ** buffer,uint32_t * size,uint32_t selector)2300 TSS_TPMU_SYM_MODE_Unmarshalu(TPMU_SYM_MODE *target, BYTE **buffer, uint32_t *size, uint32_t selector)
2301 {
2302     TPM_RC rc = TPM_RC_SUCCESS;
2303 
2304     switch (selector) {
2305 #ifdef TPM_ALG_AES
2306       case TPM_ALG_AES:
2307 	rc = TSS_TPMI_ALG_SYM_MODE_Unmarshalu(&target->aes, buffer, size, YES);
2308 	break;
2309 #endif
2310 #ifdef TPM_ALG_SM4
2311       case TPM_ALG_SM4:
2312 	rc = TSS_TPMI_ALG_SYM_MODE_Unmarshalu(&target->sm4, buffer, size, YES);
2313 	break;
2314 #endif
2315 #ifdef TPM_ALG_CAMELLIA
2316       case TPM_ALG_CAMELLIA:
2317 	rc = TSS_TPMI_ALG_SYM_MODE_Unmarshalu(&target->camellia, buffer, size, YES);
2318 	break;
2319 #endif
2320       case TPM_ALG_XOR:
2321       case TPM_ALG_NULL:
2322 	break;
2323       default:
2324 	rc = TPM_RC_SELECTOR;
2325     }
2326     return rc;
2327 }
2328 
2329 /* Table 128 - Definition of TPMT_SYM_DEF Structure */
2330 
2331 TPM_RC
TSS_TPMT_SYM_DEF_Unmarshalu(TPMT_SYM_DEF * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)2332 TSS_TPMT_SYM_DEF_Unmarshalu(TPMT_SYM_DEF *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
2333 {
2334     TPM_RC rc = TPM_RC_SUCCESS;
2335 
2336     if (rc == TPM_RC_SUCCESS) {
2337 	rc = TSS_TPMI_ALG_SYM_Unmarshalu(&target->algorithm, buffer, size, allowNull);
2338     }
2339     if (rc == TPM_RC_SUCCESS) {
2340 	rc = TSS_TPMU_SYM_KEY_BITS_Unmarshalu(&target->keyBits, buffer, size, target->algorithm);
2341     }
2342     if (rc == TPM_RC_SUCCESS) {
2343 	rc = TSS_TPMU_SYM_MODE_Unmarshalu(&target->mode, buffer, size, target->algorithm);
2344     }
2345     return rc;
2346 }
2347 
2348 /* Table 129 - Definition of TPMT_SYM_DEF_OBJECT Structure */
2349 
2350 TPM_RC
TSS_TPMT_SYM_DEF_OBJECT_Unmarshalu(TPMT_SYM_DEF_OBJECT * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)2351 TSS_TPMT_SYM_DEF_OBJECT_Unmarshalu(TPMT_SYM_DEF_OBJECT *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
2352 {
2353     TPM_RC rc = TPM_RC_SUCCESS;
2354 
2355     if (rc == TPM_RC_SUCCESS) {
2356 	rc = TSS_TPMI_ALG_SYM_OBJECT_Unmarshalu(&target->algorithm, buffer, size, allowNull);
2357     }
2358     if (rc == TPM_RC_SUCCESS) {
2359 	rc = TSS_TPMU_SYM_KEY_BITS_Unmarshalu(&target->keyBits, buffer, size, target->algorithm);
2360     }
2361     if (rc == TPM_RC_SUCCESS) {
2362 	rc = TSS_TPMU_SYM_MODE_Unmarshalu(&target->mode, buffer, size, target->algorithm);
2363     }
2364     return rc;
2365 }
2366 
2367 #ifndef TPM_TSS_NOCMDCHECK
2368 
2369 /* Table 130 - Definition of TPM2B_SYM_KEY Structure */
2370 
2371 TPM_RC
TSS_TPM2B_SYM_KEY_Unmarshalu(TPM2B_SYM_KEY * target,BYTE ** buffer,uint32_t * size)2372 TSS_TPM2B_SYM_KEY_Unmarshalu(TPM2B_SYM_KEY *target, BYTE **buffer, uint32_t *size)
2373 {
2374     TPM_RC rc = TPM_RC_SUCCESS;
2375 
2376     if (rc == TPM_RC_SUCCESS) {
2377 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
2378     }
2379     return rc;
2380 }
2381 
2382 #endif	/* TPM_TSS_NOCMDCHECK */
2383 
2384 /* Table 131 - Definition of TPMS_SYMCIPHER_PARMS Structure */
2385 
2386 TPM_RC
TSS_TPMS_SYMCIPHER_PARMS_Unmarshalu(TPMS_SYMCIPHER_PARMS * target,BYTE ** buffer,uint32_t * size)2387 TSS_TPMS_SYMCIPHER_PARMS_Unmarshalu(TPMS_SYMCIPHER_PARMS *target, BYTE **buffer, uint32_t *size)
2388 {
2389     TPM_RC rc = TPM_RC_SUCCESS;
2390 
2391     if (rc == TPM_RC_SUCCESS) {
2392 	rc = TSS_TPMT_SYM_DEF_OBJECT_Unmarshalu(&target->sym, buffer, size, NO);
2393     }
2394     return rc;
2395 }
2396 
2397 /* Table 132 - Definition of TPM2B_SENSITIVE_DATA Structure */
2398 
2399 TPM_RC
TSS_TPM2B_SENSITIVE_DATA_Unmarshalu(TPM2B_SENSITIVE_DATA * target,BYTE ** buffer,uint32_t * size)2400 TSS_TPM2B_SENSITIVE_DATA_Unmarshalu(TPM2B_SENSITIVE_DATA *target, BYTE **buffer, uint32_t *size)
2401 {
2402     TPM_RC rc = TPM_RC_SUCCESS;
2403 
2404     if (rc == TPM_RC_SUCCESS) {
2405 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
2406     }
2407     return rc;
2408 }
2409 
2410 #ifndef TPM_TSS_NOCMDCHECK
2411 
2412 /* Table 133 - Definition of TPMS_SENSITIVE_CREATE Structure <IN> */
2413 
2414 TPM_RC
TSS_TPMS_SENSITIVE_CREATE_Unmarshalu(TPMS_SENSITIVE_CREATE * target,BYTE ** buffer,uint32_t * size)2415 TSS_TPMS_SENSITIVE_CREATE_Unmarshalu(TPMS_SENSITIVE_CREATE *target, BYTE **buffer, uint32_t *size)
2416 {
2417     TPM_RC rc = TPM_RC_SUCCESS;
2418 
2419     if (rc == TPM_RC_SUCCESS) {
2420 	rc = TSS_TPM2B_AUTH_Unmarshalu(&target->userAuth, buffer, size);
2421     }
2422     if (rc == TPM_RC_SUCCESS) {
2423 	rc = TSS_TPM2B_SENSITIVE_DATA_Unmarshalu(&target->data, buffer, size);
2424     }
2425     return rc;
2426 }
2427 
2428 /* Table 134 - Definition of TPM2B_SENSITIVE_CREATE Structure <IN, S> */
2429 
2430 TPM_RC
TSS_TPM2B_SENSITIVE_CREATE_Unmarshalu(TPM2B_SENSITIVE_CREATE * target,BYTE ** buffer,uint32_t * size)2431 TSS_TPM2B_SENSITIVE_CREATE_Unmarshalu(TPM2B_SENSITIVE_CREATE *target, BYTE **buffer, uint32_t *size)
2432 {
2433     TPM_RC rc = TPM_RC_SUCCESS;
2434     uint32_t startSize = 0;
2435 
2436     if (rc == TPM_RC_SUCCESS) {
2437 	rc = TSS_UINT16_Unmarshalu(&target->size, buffer, size);
2438     }
2439     if (rc == TPM_RC_SUCCESS) {
2440 	if (target->size == 0) {
2441 	    rc = TPM_RC_SIZE;
2442 	}
2443     }
2444     if (rc == TPM_RC_SUCCESS) {
2445 	startSize = *size;
2446     }
2447     if (rc == TPM_RC_SUCCESS) {
2448 	rc = TSS_TPMS_SENSITIVE_CREATE_Unmarshalu(&target->sensitive, buffer, size);
2449     }
2450     if (rc == TPM_RC_SUCCESS) {
2451 	if (target->size != startSize - *size) {
2452 	    rc = TPM_RC_SIZE;
2453 	}
2454     }
2455     return rc;
2456 }
2457 
2458 #endif	/* TPM_TSS_NOCMDCHECK */
2459 
2460 /* Table 135 - Definition of TPMS_SCHEME_HASH Structure */
2461 
2462 TPM_RC
TSS_TPMS_SCHEME_HASH_Unmarshalu(TPMS_SCHEME_HASH * target,BYTE ** buffer,uint32_t * size)2463 TSS_TPMS_SCHEME_HASH_Unmarshalu(TPMS_SCHEME_HASH *target, BYTE **buffer, uint32_t *size)
2464 {
2465     TPM_RC rc = TPM_RC_SUCCESS;
2466 
2467     if (rc == TPM_RC_SUCCESS) {
2468 	rc = TSS_TPMI_ALG_HASH_Unmarshalu(&target->hashAlg, buffer, size, NO);
2469     }
2470     return rc;
2471 }
2472 
2473 /* Table 136 - Definition of {ECC} TPMS_SCHEME_ECDAA Structure */
2474 
2475 TPM_RC
TSS_TPMS_SCHEME_ECDAA_Unmarshalu(TPMS_SCHEME_ECDAA * target,BYTE ** buffer,uint32_t * size)2476 TSS_TPMS_SCHEME_ECDAA_Unmarshalu(TPMS_SCHEME_ECDAA *target, BYTE **buffer, uint32_t *size)
2477 {
2478     TPM_RC rc = TPM_RC_SUCCESS;
2479 
2480     if (rc == TPM_RC_SUCCESS) {
2481 	rc = TSS_TPMI_ALG_HASH_Unmarshalu(&target->hashAlg, buffer, size, NO);
2482     }
2483     if (rc == TPM_RC_SUCCESS) {
2484 	rc = TSS_UINT16_Unmarshalu(&target->count, buffer, size);
2485     }
2486     return rc;
2487 }
2488 
2489 /* Table 137 - Definition of (TPM_ALG_ID) TPMI_ALG_KEYEDHASH_SCHEME Type */
2490 
2491 TPM_RC
TSS_TPMI_ALG_KEYEDHASH_SCHEME_Unmarshalu(TPMI_ALG_KEYEDHASH_SCHEME * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)2492 TSS_TPMI_ALG_KEYEDHASH_SCHEME_Unmarshalu(TPMI_ALG_KEYEDHASH_SCHEME *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
2493 {
2494     TPM_RC rc = TPM_RC_SUCCESS;
2495     allowNull = allowNull;
2496 
2497     if (rc == TPM_RC_SUCCESS) {
2498 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
2499     }
2500     return rc;
2501 }
2502 
2503 /* Table 138 - Definition of Types for HMAC_SIG_SCHEME */
2504 
2505 TPM_RC
TSS_TPMS_SCHEME_HMAC_Unmarshalu(TPMS_SCHEME_HMAC * target,BYTE ** buffer,uint32_t * size)2506 TSS_TPMS_SCHEME_HMAC_Unmarshalu(TPMS_SCHEME_HMAC *target, BYTE **buffer, uint32_t *size)
2507 {
2508     TPM_RC rc = TPM_RC_SUCCESS;
2509 
2510     if (rc == TPM_RC_SUCCESS) {
2511 	rc = TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, size);
2512     }
2513     return rc;
2514 }
2515 
2516 /* Table 139 - Definition of TPMS_SCHEME_XOR Structure */
2517 
2518 TPM_RC
TSS_TPMS_SCHEME_XOR_Unmarshalu(TPMS_SCHEME_XOR * target,BYTE ** buffer,uint32_t * size)2519 TSS_TPMS_SCHEME_XOR_Unmarshalu(TPMS_SCHEME_XOR *target, BYTE **buffer, uint32_t *size)
2520 {
2521     TPM_RC rc = TPM_RC_SUCCESS;
2522 
2523     if (rc == TPM_RC_SUCCESS) {
2524 	rc = TSS_TPMI_ALG_HASH_Unmarshalu(&target->hashAlg, buffer, size, NO);	/* as of rev 147 */
2525     }
2526     if (rc == TPM_RC_SUCCESS) {
2527 	rc = TSS_TPMI_ALG_KDF_Unmarshalu(&target->kdf, buffer, size, YES);
2528     }
2529     return rc;
2530 }
2531 
2532 /* Table 140 - Definition of TPMU_SCHEME_KEYEDHASH Union <IN/OUT, S> */
2533 
2534 TPM_RC
TSS_TPMU_SCHEME_KEYEDHASH_Unmarshalu(TPMU_SCHEME_KEYEDHASH * target,BYTE ** buffer,uint32_t * size,uint32_t selector)2535 TSS_TPMU_SCHEME_KEYEDHASH_Unmarshalu(TPMU_SCHEME_KEYEDHASH *target, BYTE **buffer, uint32_t *size, uint32_t selector)
2536 {
2537     TPM_RC rc = TPM_RC_SUCCESS;
2538 
2539     switch (selector) {
2540 #ifdef TPM_ALG_HMAC
2541       case TPM_ALG_HMAC:
2542 	rc = TSS_TPMS_SCHEME_HMAC_Unmarshalu(&target->hmac, buffer, size);
2543 	break;
2544 #endif
2545 #ifdef TPM_ALG_XOR
2546       case TPM_ALG_XOR:
2547 	rc = TSS_TPMS_SCHEME_XOR_Unmarshalu(&target->xorr, buffer, size);
2548 	break;
2549 #endif
2550       case TPM_ALG_NULL:
2551 	break;
2552       default:
2553 	rc = TPM_RC_SELECTOR;
2554     }
2555     return rc;
2556 }
2557 
2558 /* Table 141 - Definition of TPMT_KEYEDHASH_SCHEME Structure */
2559 
2560 TPM_RC
TSS_TPMT_KEYEDHASH_SCHEME_Unmarshalu(TPMT_KEYEDHASH_SCHEME * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)2561 TSS_TPMT_KEYEDHASH_SCHEME_Unmarshalu(TPMT_KEYEDHASH_SCHEME *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
2562 {
2563     TPM_RC rc = TPM_RC_SUCCESS;
2564 
2565     if (rc == TPM_RC_SUCCESS) {
2566 	rc = TSS_TPMI_ALG_KEYEDHASH_SCHEME_Unmarshalu(&target->scheme, buffer, size, allowNull);
2567     }
2568     if (rc == TPM_RC_SUCCESS) {
2569 	rc = TSS_TPMU_SCHEME_KEYEDHASH_Unmarshalu(&target->details, buffer, size, target->scheme);
2570     }
2571     return rc;
2572 }
2573 
2574 /* Table 142 - Definition of {RSA} Types for RSA Signature Schemes */
2575 
2576 TPM_RC
TSS_TPMS_SIG_SCHEME_RSAPSS_Unmarshalu(TPMS_SIG_SCHEME_RSAPSS * target,BYTE ** buffer,uint32_t * size)2577 TSS_TPMS_SIG_SCHEME_RSAPSS_Unmarshalu(TPMS_SIG_SCHEME_RSAPSS *target, BYTE **buffer, uint32_t *size)
2578 {
2579     TPM_RC rc = TPM_RC_SUCCESS;
2580 
2581     if (rc == TPM_RC_SUCCESS) {
2582 	rc = TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, size);
2583     }
2584     return rc;
2585 }
2586 
2587 /* Table 142 - Definition of {RSA} Types for RSA Signature Schemes */
2588 
2589 TPM_RC
TSS_TPMS_SIG_SCHEME_RSASSA_Unmarshalu(TPMS_SIG_SCHEME_RSASSA * target,BYTE ** buffer,uint32_t * size)2590 TSS_TPMS_SIG_SCHEME_RSASSA_Unmarshalu(TPMS_SIG_SCHEME_RSASSA *target, BYTE **buffer, uint32_t *size)
2591 {
2592     TPM_RC rc = TPM_RC_SUCCESS;
2593 
2594     if (rc == TPM_RC_SUCCESS) {
2595 	rc = TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, size);
2596     }
2597     return rc;
2598 }
2599 
2600 /* Table 143 - Definition of {ECC} Types for ECC Signature Schemes */
2601 
2602 TPM_RC
TSS_TPMS_SIG_SCHEME_ECDAA_Unmarshalu(TPMS_SIG_SCHEME_ECDAA * target,BYTE ** buffer,uint32_t * size)2603 TSS_TPMS_SIG_SCHEME_ECDAA_Unmarshalu(TPMS_SIG_SCHEME_ECDAA *target, BYTE **buffer, uint32_t *size)
2604 {
2605     TPM_RC rc = TPM_RC_SUCCESS;
2606 
2607     if (rc == TPM_RC_SUCCESS) {
2608 	rc = TSS_TPMS_SCHEME_ECDAA_Unmarshalu(target, buffer, size);
2609     }
2610     return rc;
2611 }
2612 
2613 /* Table 143 - Definition of {ECC} Types for ECC Signature Schemes */
2614 
2615 TPM_RC
TSS_TPMS_SIG_SCHEME_ECDSA_Unmarshalu(TPMS_SIG_SCHEME_ECDSA * target,BYTE ** buffer,uint32_t * size)2616 TSS_TPMS_SIG_SCHEME_ECDSA_Unmarshalu(TPMS_SIG_SCHEME_ECDSA *target, BYTE **buffer, uint32_t *size)
2617 {
2618     TPM_RC rc = TPM_RC_SUCCESS;
2619 
2620     if (rc == TPM_RC_SUCCESS) {
2621 	rc = TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, size);
2622     }
2623     return rc;
2624 }
2625 
2626 /* Table 143 - Definition of {ECC} Types for ECC Signature Schemes */
2627 
2628 TPM_RC
TSS_TPMS_SIG_SCHEME_ECSCHNORR_Unmarshalu(TPMS_SIG_SCHEME_ECSCHNORR * target,BYTE ** buffer,uint32_t * size)2629 TSS_TPMS_SIG_SCHEME_ECSCHNORR_Unmarshalu(TPMS_SIG_SCHEME_ECSCHNORR *target, BYTE **buffer, uint32_t *size)
2630 {
2631     TPM_RC rc = TPM_RC_SUCCESS;
2632 
2633     if (rc == TPM_RC_SUCCESS) {
2634 	rc = TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, size);
2635     }
2636     return rc;
2637 }
2638 
2639 /* Table 143 - Definition of {ECC} Types for ECC Signature Schemes */
2640 
2641 TPM_RC
TSS_TPMS_SIG_SCHEME_SM2_Unmarshalu(TPMS_SIG_SCHEME_SM2 * target,BYTE ** buffer,uint32_t * size)2642 TSS_TPMS_SIG_SCHEME_SM2_Unmarshalu(TPMS_SIG_SCHEME_SM2 *target, BYTE **buffer, uint32_t *size)
2643 {
2644     TPM_RC rc = TPM_RC_SUCCESS;
2645 
2646     if (rc == TPM_RC_SUCCESS) {
2647 	rc = TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, size);
2648     }
2649     return rc;
2650 }
2651 
2652 #ifndef TPM_TSS_NOCMDCHECK
2653 
2654 /* Table 144 - Definition of TPMU_SIG_SCHEME Union <IN/OUT, S> */
2655 
2656 TPM_RC
TSS_TPMU_SIG_SCHEME_Unmarshalu(TPMU_SIG_SCHEME * target,BYTE ** buffer,uint32_t * size,uint32_t selector)2657 TSS_TPMU_SIG_SCHEME_Unmarshalu(TPMU_SIG_SCHEME *target, BYTE **buffer, uint32_t *size, uint32_t selector)
2658 {
2659     TPM_RC rc = TPM_RC_SUCCESS;
2660 
2661     switch (selector) {
2662 #ifdef TPM_ALG_RSASSA
2663       case TPM_ALG_RSASSA:
2664 	rc = TSS_TPMS_SIG_SCHEME_RSASSA_Unmarshalu(&target->rsassa, buffer, size);
2665 	break;
2666 #endif
2667 #ifdef TPM_ALG_RSAPSS
2668       case TPM_ALG_RSAPSS:
2669 	rc = TSS_TPMS_SIG_SCHEME_RSAPSS_Unmarshalu(&target->rsapss, buffer, size);
2670 	break;
2671 #endif
2672 #ifdef TPM_ALG_ECDSA
2673       case TPM_ALG_ECDSA:
2674 	rc = TSS_TPMS_SIG_SCHEME_ECDSA_Unmarshalu(&target->ecdsa, buffer, size);
2675 	break;
2676 #endif
2677 #ifdef TPM_ALG_ECDAA
2678       case TPM_ALG_ECDAA:
2679 	rc = TSS_TPMS_SIG_SCHEME_ECDAA_Unmarshalu(&target->ecdaa, buffer, size);
2680 	break;
2681 #endif
2682 #ifdef TPM_ALG_SM2
2683       case TPM_ALG_SM2:
2684 	rc = TSS_TPMS_SIG_SCHEME_SM2_Unmarshalu(&target->sm2, buffer, size);
2685 	break;
2686 #endif
2687 #ifdef TPM_ALG_ECSCHNORR
2688       case TPM_ALG_ECSCHNORR:
2689 	rc = TSS_TPMS_SIG_SCHEME_ECSCHNORR_Unmarshalu(&target->ecSchnorr, buffer, size);
2690 	break;
2691 #endif
2692 #ifdef TPM_ALG_HMAC
2693       case TPM_ALG_HMAC:
2694 	rc = TSS_TPMS_SCHEME_HMAC_Unmarshalu(&target->hmac, buffer, size);
2695 	break;
2696 #endif
2697       case TPM_ALG_NULL:
2698 	break;
2699       default:
2700 	rc = TPM_RC_SELECTOR;
2701     }
2702     return rc;
2703 }
2704 
2705 /* Table 145 - Definition of TPMT_SIG_SCHEME Structure */
2706 
2707 TPM_RC
TSS_TPMT_SIG_SCHEME_Unmarshalu(TPMT_SIG_SCHEME * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)2708 TSS_TPMT_SIG_SCHEME_Unmarshalu(TPMT_SIG_SCHEME *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
2709 {
2710     TPM_RC rc = TPM_RC_SUCCESS;
2711 
2712     if (rc == TPM_RC_SUCCESS) {
2713 	rc = TSS_TPMI_ALG_SIG_SCHEME_Unmarshalu(&target->scheme, buffer, size, allowNull);
2714     }
2715     if (rc == TPM_RC_SUCCESS) {
2716 	rc = TSS_TPMU_SIG_SCHEME_Unmarshalu(&target->details, buffer, size, target->scheme);
2717     }
2718     return rc;
2719 }
2720 
2721 #endif	/* TPM_TSS_NOCMDCHECK */
2722 
2723 /* Table 146 - Definition of Types for {RSA} Encryption Schemes */
2724 
2725 TPM_RC
TSS_TPMS_ENC_SCHEME_OAEP_Unmarshalu(TPMS_ENC_SCHEME_OAEP * target,BYTE ** buffer,uint32_t * size)2726 TSS_TPMS_ENC_SCHEME_OAEP_Unmarshalu(TPMS_ENC_SCHEME_OAEP *target, BYTE **buffer, uint32_t *size)
2727 {
2728     TPM_RC rc = TPM_RC_SUCCESS;
2729 
2730     if (rc == TPM_RC_SUCCESS) {
2731 	rc = TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, size);
2732     }
2733     return rc;
2734 }
2735 
2736 /* Table 146 - Definition of Types for {RSA} Encryption Schemes */
2737 
2738 /* NOTE: Marked as const function in header */
2739 
2740 TPM_RC
TSS_TPMS_ENC_SCHEME_RSAES_Unmarshalu(TPMS_ENC_SCHEME_RSAES * target,BYTE ** buffer,uint32_t * size)2741 TSS_TPMS_ENC_SCHEME_RSAES_Unmarshalu(TPMS_ENC_SCHEME_RSAES *target, BYTE **buffer, uint32_t *size)
2742 {
2743     TPM_RC rc = TPM_RC_SUCCESS;
2744 
2745     if (rc == TPM_RC_SUCCESS) {
2746 	rc = TSS_TPMS_EMPTY_Unmarshalu(target, buffer, size);
2747     }
2748     return rc;
2749 }
2750 
2751 /* Table 147 - Definition of Types for {ECC} ECC Key Exchange */
2752 
2753 TPM_RC
TSS_TPMS_KEY_SCHEME_ECDH_Unmarshalu(TPMS_KEY_SCHEME_ECDH * target,BYTE ** buffer,uint32_t * size)2754 TSS_TPMS_KEY_SCHEME_ECDH_Unmarshalu(TPMS_KEY_SCHEME_ECDH *target, BYTE **buffer, uint32_t *size)
2755 {
2756     TPM_RC rc = TPM_RC_SUCCESS;
2757 
2758     if (rc == TPM_RC_SUCCESS) {
2759 	rc = TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, size);
2760     }
2761     return rc;
2762 }
2763 
2764 #ifndef TPM_TSS_NOCMDCHECK
2765 
2766 /* Table 147 - Definition of Types for {ECC} ECC Key Exchange */
2767 
2768 TPM_RC
TSS_TPMS_KEY_SCHEME_ECMQV_Unmarshalu(TPMS_KEY_SCHEME_ECMQV * target,BYTE ** buffer,uint32_t * size)2769 TSS_TPMS_KEY_SCHEME_ECMQV_Unmarshalu(TPMS_KEY_SCHEME_ECMQV *target, BYTE **buffer, uint32_t *size)
2770 {
2771     TPM_RC rc = TPM_RC_SUCCESS;
2772 
2773     if (rc == TPM_RC_SUCCESS) {
2774 	rc = TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, size);
2775     }
2776     return rc;
2777 }
2778 
2779 #endif	/* TPM_TSS_NOCMDCHECK */
2780 
2781 /* Table 148 - Definition of Types for KDF Schemes, hash-based key- or mask-generation functions */
2782 
2783 TPM_RC
TSS_TPMS_SCHEME_KDF1_SP800_108_Unmarshalu(TPMS_SCHEME_KDF1_SP800_108 * target,BYTE ** buffer,uint32_t * size)2784 TSS_TPMS_SCHEME_KDF1_SP800_108_Unmarshalu(TPMS_SCHEME_KDF1_SP800_108 *target, BYTE **buffer, uint32_t *size)
2785 {
2786     TPM_RC rc = TPM_RC_SUCCESS;
2787 
2788     if (rc == TPM_RC_SUCCESS) {
2789 	rc = TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, size);
2790     }
2791     return rc;
2792 }
2793 
2794 /* Table 148 - Definition of Types for KDF Schemes, hash-based key- or mask-generation functions */
2795 
2796 TPM_RC
TSS_TPMS_SCHEME_KDF1_SP800_56A_Unmarshalu(TPMS_SCHEME_KDF1_SP800_56A * target,BYTE ** buffer,uint32_t * size)2797 TSS_TPMS_SCHEME_KDF1_SP800_56A_Unmarshalu(TPMS_SCHEME_KDF1_SP800_56A *target, BYTE **buffer, uint32_t *size)
2798 {
2799     TPM_RC rc = TPM_RC_SUCCESS;
2800 
2801     if (rc == TPM_RC_SUCCESS) {
2802 	rc = TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, size);
2803     }
2804     return rc;
2805 }
2806 
2807 #ifndef TPM_TSS_NOCMDCHECK
2808 
2809 /* Table 148 - Definition of Types for KDF Schemes, hash-based key- or mask-generation functions */
2810 
2811 TPM_RC
TSS_TPMS_SCHEME_KDF2_Unmarshalu(TPMS_SCHEME_KDF2 * target,BYTE ** buffer,uint32_t * size)2812 TSS_TPMS_SCHEME_KDF2_Unmarshalu(TPMS_SCHEME_KDF2 *target, BYTE **buffer, uint32_t *size)
2813 {
2814     TPM_RC rc = TPM_RC_SUCCESS;
2815 
2816     if (rc == TPM_RC_SUCCESS) {
2817 	rc = TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, size);
2818     }
2819     return rc;
2820 }
2821 
2822 #endif	/* TPM_TSS_NOCMDCHECK */
2823 
2824 /* Table 148 - Definition of Types for KDF Schemes, hash-based key- or mask-generation functions */
2825 
2826 TPM_RC
TSS_TPMS_SCHEME_MGF1_Unmarshalu(TPMS_SCHEME_MGF1 * target,BYTE ** buffer,uint32_t * size)2827 TSS_TPMS_SCHEME_MGF1_Unmarshalu(TPMS_SCHEME_MGF1 *target, BYTE **buffer, uint32_t *size)
2828 {
2829     TPM_RC rc = TPM_RC_SUCCESS;
2830 
2831     if (rc == TPM_RC_SUCCESS) {
2832 	rc = TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, size);
2833     }
2834     return rc;
2835 }
2836 
2837 /* Table 149 - Definition of TPMU_KDF_SCHEME Union <IN/OUT, S> */
2838 
2839 TPM_RC
TSS_TPMU_KDF_SCHEME_Unmarshalu(TPMU_KDF_SCHEME * target,BYTE ** buffer,uint32_t * size,uint32_t selector)2840 TSS_TPMU_KDF_SCHEME_Unmarshalu(TPMU_KDF_SCHEME *target, BYTE **buffer, uint32_t *size, uint32_t selector)
2841 {
2842     TPM_RC rc = TPM_RC_SUCCESS;
2843 
2844     switch (selector) {
2845 #ifdef TPM_ALG_MGF1
2846       case TPM_ALG_MGF1:
2847 	rc = TSS_TPMS_SCHEME_MGF1_Unmarshalu(&target->mgf1, buffer, size);
2848 	break;
2849 #endif
2850 #ifdef TPM_ALG_KDF1_SP800_56A
2851       case TPM_ALG_KDF1_SP800_56A:
2852 	rc = TSS_TPMS_SCHEME_KDF1_SP800_56A_Unmarshalu(&target->kdf1_SP800_56a, buffer, size);
2853 	break;
2854 #endif
2855 #ifdef TPM_ALG_KDF2
2856       case TPM_ALG_KDF2:
2857 	rc = TSS_TPMS_SCHEME_KDF2_Unmarshalu(&target->kdf2, buffer, size);
2858 	break;
2859 #endif
2860 #ifdef TPM_ALG_KDF1_SP800_108
2861       case TPM_ALG_KDF1_SP800_108:
2862 	rc = TSS_TPMS_SCHEME_KDF1_SP800_108_Unmarshalu(&target->kdf1_sp800_108, buffer, size);
2863 	break;
2864 #endif
2865       case TPM_ALG_NULL:
2866 	break;
2867       default:
2868 	rc = TPM_RC_SELECTOR;
2869     }
2870     return rc;
2871 }
2872 
2873 /* Table 150 - Definition of TPMT_KDF_SCHEME Structure */
2874 
2875 TPM_RC
TSS_TPMT_KDF_SCHEME_Unmarshalu(TPMT_KDF_SCHEME * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)2876 TSS_TPMT_KDF_SCHEME_Unmarshalu(TPMT_KDF_SCHEME *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
2877 {
2878     TPM_RC rc = TPM_RC_SUCCESS;
2879 
2880     if (rc == TPM_RC_SUCCESS) {
2881 	rc = TSS_TPMI_ALG_KDF_Unmarshalu(&target->scheme, buffer, size, allowNull);
2882     }
2883     if (rc == TPM_RC_SUCCESS) {
2884 	rc = TSS_TPMU_KDF_SCHEME_Unmarshalu(&target->details, buffer, size, target->scheme);
2885     }
2886     return rc;
2887 }
2888 
2889 /* Table 151 - Definition of (TPM_ALG_ID) TPMI_ALG_ASYM_SCHEME Type <> */
2890 
2891 #if 0
2892 TPM_RC
2893 TSS_TPMI_ALG_ASYM_SCHEME_Unmarshalu(TPMI_ALG_ASYM_SCHEME *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
2894 {
2895     TPM_RC rc = TPM_RC_SUCCESS;
2896 
2897     if (rc == TPM_RC_SUCCESS) {
2898 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
2899     }
2900     return rc;
2901 }
2902 #endif	/* 0 */
2903 
2904 /* Table 152 - Definition of TPMU_ASYM_SCHEME Union */
2905 
2906 TPM_RC
TSS_TPMU_ASYM_SCHEME_Unmarshalu(TPMU_ASYM_SCHEME * target,BYTE ** buffer,uint32_t * size,uint32_t selector)2907 TSS_TPMU_ASYM_SCHEME_Unmarshalu(TPMU_ASYM_SCHEME *target, BYTE **buffer, uint32_t *size, uint32_t selector)
2908 {
2909     TPM_RC rc = TPM_RC_SUCCESS;
2910 
2911     switch (selector) {
2912 #ifdef TPM_ALG_ECDH
2913       case TPM_ALG_ECDH:
2914 	rc = TSS_TPMS_KEY_SCHEME_ECDH_Unmarshalu(&target->ecdh, buffer, size);
2915 	break;
2916 #endif
2917 #ifdef TPM_ALG_ECMQV
2918       case TPM_ALG_ECMQV:
2919 	rc = TSS_TPMS_KEY_SCHEME_ECMQV_Unmarshalu(&target->ecmqvh, buffer, size);
2920 	break;
2921 #endif
2922 #ifdef TPM_ALG_RSASSA
2923       case TPM_ALG_RSASSA:
2924 	rc = TSS_TPMS_SIG_SCHEME_RSASSA_Unmarshalu(&target->rsassa, buffer, size);
2925 	break;
2926 #endif
2927 #ifdef TPM_ALG_RSAPSS
2928       case TPM_ALG_RSAPSS:
2929 	rc = TSS_TPMS_SIG_SCHEME_RSAPSS_Unmarshalu(&target->rsapss, buffer, size);
2930 	break;
2931 #endif
2932 #ifdef TPM_ALG_ECDSA
2933       case TPM_ALG_ECDSA:
2934 	rc = TSS_TPMS_SIG_SCHEME_ECDSA_Unmarshalu(&target->ecdsa, buffer, size);
2935 	break;
2936 #endif
2937 #ifdef TPM_ALG_ECDAA
2938       case TPM_ALG_ECDAA:
2939 	rc = TSS_TPMS_SIG_SCHEME_ECDAA_Unmarshalu(&target->ecdaa, buffer, size);
2940 	break;
2941 #endif
2942 #ifdef TPM_ALG_SM2
2943       case TPM_ALG_SM2:
2944 	rc = TSS_TPMS_SIG_SCHEME_SM2_Unmarshalu(&target->sm2, buffer, size);
2945 	break;
2946 #endif
2947 #ifdef TPM_ALG_ECSCHNORR
2948       case TPM_ALG_ECSCHNORR:
2949 	rc = TSS_TPMS_SIG_SCHEME_ECSCHNORR_Unmarshalu(&target->ecSchnorr, buffer, size);
2950 	break;
2951 #endif
2952 #ifdef TPM_ALG_RSAES
2953       case TPM_ALG_RSAES:
2954 	rc = TSS_TPMS_ENC_SCHEME_RSAES_Unmarshalu(&target->rsaes, buffer, size);
2955 	break;
2956 #endif
2957 #ifdef TPM_ALG_OAEP
2958       case TPM_ALG_OAEP:
2959 	rc = TSS_TPMS_ENC_SCHEME_OAEP_Unmarshalu(&target->oaep, buffer, size);
2960 	break;
2961 #endif
2962       case TPM_ALG_NULL:
2963 	break;
2964       default:
2965 	rc = TPM_RC_SELECTOR;
2966     }
2967     return rc;
2968 }
2969 
2970 /* Table 153 - Definition of TPMT_ASYM_SCHEME Structure <> */
2971 
2972 #if 0
2973 TPM_RC
2974 TSS_TPMT_ASYM_SCHEME_Unmarshalu(TPMT_ASYM_SCHEME *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
2975 {
2976     TPM_RC rc = TPM_RC_SUCCESS;
2977 
2978     if (rc == TPM_RC_SUCCESS) {
2979 	rc = TSS_TPMI_ALG_ASYM_SCHEME_Unmarshalu(&target->scheme, buffer, size, allowNull);
2980     }
2981     if (rc == TPM_RC_SUCCESS) {
2982 	rc = TSS_TPMU_ASYM_SCHEME_Unmarshalu(&target->details, buffer, size, target->scheme);
2983     }
2984     return rc;
2985 }
2986 #endif	/* 0 */
2987 
2988 /* Table 154 - Definition of (TPM_ALG_ID) {RSA} TPMI_ALG_RSA_SCHEME Type */
2989 
2990 TPM_RC
TSS_TPMI_ALG_RSA_SCHEME_Unmarshalu(TPMI_ALG_RSA_SCHEME * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)2991 TSS_TPMI_ALG_RSA_SCHEME_Unmarshalu(TPMI_ALG_RSA_SCHEME *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
2992 {
2993     TPM_RC rc = TPM_RC_SUCCESS;
2994     allowNull = allowNull;
2995 
2996     if (rc == TPM_RC_SUCCESS) {
2997 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
2998     }
2999     return rc;
3000 }
3001 
3002 /* Table 155 - Definition of {RSA} TPMT_RSA_SCHEME Structure */
3003 
3004 TPM_RC
TSS_TPMT_RSA_SCHEME_Unmarshalu(TPMT_RSA_SCHEME * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)3005 TSS_TPMT_RSA_SCHEME_Unmarshalu(TPMT_RSA_SCHEME *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
3006 {
3007     TPM_RC rc = TPM_RC_SUCCESS;
3008 
3009     if (rc == TPM_RC_SUCCESS) {
3010 	rc = TSS_TPMI_ALG_RSA_SCHEME_Unmarshalu(&target->scheme, buffer, size, allowNull);
3011     }
3012     if (rc == TPM_RC_SUCCESS) {
3013 	rc = TSS_TPMU_ASYM_SCHEME_Unmarshalu(&target->details, buffer, size, target->scheme);
3014     }
3015     return rc;
3016 }
3017 
3018 #ifndef TPM_TSS_NOCMDCHECK
3019 
3020 /* Table 156 - Definition of (TPM_ALG_ID) {RSA} TPMI_ALG_RSA_DECRYPT Type */
3021 
3022 TPM_RC
TSS_TPMI_ALG_RSA_DECRYPT_Unmarshalu(TPMI_ALG_RSA_DECRYPT * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)3023 TSS_TPMI_ALG_RSA_DECRYPT_Unmarshalu(TPMI_ALG_RSA_DECRYPT *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
3024 {
3025     TPM_RC rc = TPM_RC_SUCCESS;
3026     allowNull = allowNull;
3027 
3028     if (rc == TPM_RC_SUCCESS) {
3029 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
3030     }
3031     return rc;
3032 }
3033 
3034 /* Table 157 - Definition of {RSA} TPMT_RSA_DECRYPT Structure */
3035 
3036 TPM_RC
TSS_TPMT_RSA_DECRYPT_Unmarshalu(TPMT_RSA_DECRYPT * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)3037 TSS_TPMT_RSA_DECRYPT_Unmarshalu(TPMT_RSA_DECRYPT *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
3038 {
3039     TPM_RC rc = TPM_RC_SUCCESS;
3040 
3041     if (rc == TPM_RC_SUCCESS) {
3042 	rc = TSS_TPMI_ALG_RSA_DECRYPT_Unmarshalu(&target->scheme, buffer, size, allowNull);
3043     }
3044     if (rc == TPM_RC_SUCCESS) {
3045 	rc = TSS_TPMU_ASYM_SCHEME_Unmarshalu(&target->details, buffer, size, target->scheme);
3046     }
3047     return rc;
3048 }
3049 
3050 #endif /* TPM_TSS_NOCMDCHECK */
3051 
3052 /* Table 158 - Definition of {RSA} TPM2B_PUBLIC_KEY_RSA Structure */
3053 TPM_RC
TSS_TPM2B_PUBLIC_KEY_RSA_Unmarshalu(TPM2B_PUBLIC_KEY_RSA * target,BYTE ** buffer,uint32_t * size)3054 TSS_TPM2B_PUBLIC_KEY_RSA_Unmarshalu(TPM2B_PUBLIC_KEY_RSA *target, BYTE **buffer, uint32_t *size)
3055 {
3056     TPM_RC rc = TPM_RC_SUCCESS;
3057 
3058     if (rc == TPM_RC_SUCCESS) {
3059 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
3060     }
3061     return rc;
3062 }
3063 
3064 /* Table 159 - Definition of {RSA} (TPM_KEY_BITS) TPMI_RSA_KEY_BITS Type */
3065 
3066 TPM_RC
TSS_TPMI_RSA_KEY_BITS_Unmarshalu(TPMI_RSA_KEY_BITS * target,BYTE ** buffer,uint32_t * size)3067 TSS_TPMI_RSA_KEY_BITS_Unmarshalu(TPMI_RSA_KEY_BITS *target, BYTE **buffer, uint32_t *size)
3068 {
3069     TPM_RC rc = TPM_RC_SUCCESS;
3070 
3071     if (rc == TPM_RC_SUCCESS) {
3072 	rc = TSS_TPM_KEY_BITS_Unmarshalu(target, buffer, size);
3073     }
3074     return rc;
3075 }
3076 
3077 #ifndef TPM_TSS_NOCMDCHECK
3078 
3079 /* Table 160 - Definition of {RSA} TPM2B_PRIVATE_KEY_RSA Structure */
3080 
3081 TPM_RC
TSS_TPM2B_PRIVATE_KEY_RSA_Unmarshalu(TPM2B_PRIVATE_KEY_RSA * target,BYTE ** buffer,uint32_t * size)3082 TSS_TPM2B_PRIVATE_KEY_RSA_Unmarshalu(TPM2B_PRIVATE_KEY_RSA *target, BYTE **buffer, uint32_t *size)
3083 {
3084     TPM_RC rc = TPM_RC_SUCCESS;
3085 
3086     if (rc == TPM_RC_SUCCESS) {
3087 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
3088     }
3089     return rc;
3090 }
3091 
3092 #endif	/* TPM_TSS_NOCMDCHECK */
3093 
3094 /* Table 161 - Definition of {ECC} TPM2B_ECC_PARAMETER Structure */
3095 
3096 TPM_RC
TSS_TPM2B_ECC_PARAMETER_Unmarshalu(TPM2B_ECC_PARAMETER * target,BYTE ** buffer,uint32_t * size)3097 TSS_TPM2B_ECC_PARAMETER_Unmarshalu(TPM2B_ECC_PARAMETER *target, BYTE **buffer, uint32_t *size)
3098 {
3099     TPM_RC rc = TPM_RC_SUCCESS;
3100 
3101     if (rc == TPM_RC_SUCCESS) {
3102      	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
3103     }
3104     return rc;
3105 }
3106 
3107 /* Table 162 - Definition of {ECC} TPMS_ECC_POINT Structure */
3108 
3109 TPM_RC
TSS_TPMS_ECC_POINT_Unmarshalu(TPMS_ECC_POINT * target,BYTE ** buffer,uint32_t * size)3110 TSS_TPMS_ECC_POINT_Unmarshalu(TPMS_ECC_POINT *target, BYTE **buffer, uint32_t *size)
3111 {
3112     TPM_RC rc = TPM_RC_SUCCESS;
3113 
3114     if (rc == TPM_RC_SUCCESS) {
3115 	rc = TSS_TPM2B_ECC_PARAMETER_Unmarshalu(&target->x, buffer, size);
3116     }
3117     if (rc == TPM_RC_SUCCESS) {
3118 	rc = TSS_TPM2B_ECC_PARAMETER_Unmarshalu(&target->y, buffer, size);
3119     }
3120     return rc;
3121 }
3122 
3123 /* Table 163 - Definition of {ECC} TPM2B_ECC_POINT Structure */
3124 
3125 TPM_RC
TSS_TPM2B_ECC_POINT_Unmarshalu(TPM2B_ECC_POINT * target,BYTE ** buffer,uint32_t * size)3126 TSS_TPM2B_ECC_POINT_Unmarshalu(TPM2B_ECC_POINT *target, BYTE **buffer, uint32_t *size)
3127 {
3128     TPM_RC rc = TPM_RC_SUCCESS;
3129     uint32_t startSize = 0;
3130 
3131     if (rc == TPM_RC_SUCCESS) {
3132 	rc = TSS_UINT16_Unmarshalu(&target->size, buffer, size);
3133     }
3134     if (rc == TPM_RC_SUCCESS) {
3135 	if (target->size == 0) {
3136 	    rc = TPM_RC_SIZE;
3137 	}
3138     }
3139     if (rc == TPM_RC_SUCCESS) {
3140 	startSize = *size;
3141     }
3142     if (rc == TPM_RC_SUCCESS) {
3143 	rc = TSS_TPMS_ECC_POINT_Unmarshalu(&target->point, buffer, size);
3144     }
3145     if (rc == TPM_RC_SUCCESS) {
3146 	if (target->size != startSize - *size) {
3147 	    rc = TPM_RC_SIZE;
3148 	}
3149     }
3150     return rc;
3151 }
3152 
3153 /* Table 164 - Definition of (TPM_ALG_ID) {ECC} TPMI_ALG_ECC_SCHEME Type */
3154 
3155 TPM_RC
TSS_TPMI_ALG_ECC_SCHEME_Unmarshalu(TPMI_ALG_ECC_SCHEME * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)3156 TSS_TPMI_ALG_ECC_SCHEME_Unmarshalu(TPMI_ALG_ECC_SCHEME *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
3157 {
3158     TPM_RC rc = TPM_RC_SUCCESS;
3159     allowNull = allowNull;
3160 
3161     if (rc == TPM_RC_SUCCESS) {
3162 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
3163     }
3164     return rc;
3165 }
3166 
3167 /* Table 165 - Definition of {ECC} (TPM_ECC_CURVE) TPMI_ECC_CURVE Type */
3168 
3169 TPM_RC
TSS_TPMI_ECC_CURVE_Unmarshalu(TPMI_ECC_CURVE * target,BYTE ** buffer,uint32_t * size)3170 TSS_TPMI_ECC_CURVE_Unmarshalu(TPMI_ECC_CURVE *target, BYTE **buffer, uint32_t *size)
3171 {
3172     TPM_RC rc = TPM_RC_SUCCESS;
3173 
3174     if (rc == TPM_RC_SUCCESS) {
3175 	rc = TSS_TPM_ECC_CURVE_Unmarshalu(target, buffer, size);
3176     }
3177     return rc;
3178 }
3179 
3180 /* Table 166 - Definition of (TPMT_SIG_SCHEME) {ECC} TPMT_ECC_SCHEME Structure */
3181 
3182 TPM_RC
TSS_TPMT_ECC_SCHEME_Unmarshalu(TPMT_ECC_SCHEME * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)3183 TSS_TPMT_ECC_SCHEME_Unmarshalu(TPMT_ECC_SCHEME *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
3184 {
3185     TPM_RC rc = TPM_RC_SUCCESS;
3186 
3187     if (rc == TPM_RC_SUCCESS) {
3188 	rc = TSS_TPMI_ALG_ECC_SCHEME_Unmarshalu(&target->scheme, buffer, size, allowNull);
3189     }
3190     if (rc == TPM_RC_SUCCESS) {
3191 	rc = TSS_TPMU_ASYM_SCHEME_Unmarshalu(&target->details, buffer, size, target->scheme);
3192     }
3193     return rc;
3194 }
3195 
3196 /* Table 167 - Definition of {ECC} TPMS_ALGORITHM_DETAIL_ECC Structure <OUT> */
3197 
3198 TPM_RC
TSS_TPMS_ALGORITHM_DETAIL_ECC_Unmarshalu(TPMS_ALGORITHM_DETAIL_ECC * target,BYTE ** buffer,uint32_t * size)3199 TSS_TPMS_ALGORITHM_DETAIL_ECC_Unmarshalu(TPMS_ALGORITHM_DETAIL_ECC *target, BYTE **buffer, uint32_t *size)
3200 {
3201     TPM_RC rc = TPM_RC_SUCCESS;
3202 
3203     if (rc == TPM_RC_SUCCESS) {
3204 	rc = TSS_TPM_ECC_CURVE_Unmarshalu(&target->curveID, buffer, size);
3205     }
3206     if (rc == TPM_RC_SUCCESS) {
3207 	rc = TSS_UINT16_Unmarshalu(&target->keySize, buffer, size);
3208     }
3209     if (rc == TPM_RC_SUCCESS) {
3210 	rc = TSS_TPMT_KDF_SCHEME_Unmarshalu(&target->kdf, buffer, size, YES);
3211     }
3212     if (rc == TPM_RC_SUCCESS) {
3213 	rc = TSS_TPMT_ECC_SCHEME_Unmarshalu(&target->sign, buffer, size, YES);
3214     }
3215     if (rc == TPM_RC_SUCCESS) {
3216 	rc = TSS_TPM2B_ECC_PARAMETER_Unmarshalu(&target->p, buffer, size);
3217     }
3218     if (rc == TPM_RC_SUCCESS) {
3219 	rc = TSS_TPM2B_ECC_PARAMETER_Unmarshalu(&target->a, buffer, size);
3220     }
3221     if (rc == TPM_RC_SUCCESS) {
3222 	rc = TSS_TPM2B_ECC_PARAMETER_Unmarshalu(&target->b, buffer, size);
3223     }
3224     if (rc == TPM_RC_SUCCESS) {
3225 	rc = TSS_TPM2B_ECC_PARAMETER_Unmarshalu(&target->gX, buffer, size);
3226     }
3227     if (rc == TPM_RC_SUCCESS) {
3228 	rc = TSS_TPM2B_ECC_PARAMETER_Unmarshalu(&target->gY, buffer, size);
3229     }
3230     if (rc == TPM_RC_SUCCESS) {
3231 	rc = TSS_TPM2B_ECC_PARAMETER_Unmarshalu(&target->n, buffer, size);
3232     }
3233     if (rc == TPM_RC_SUCCESS) {
3234 	rc = TSS_TPM2B_ECC_PARAMETER_Unmarshalu(&target->h, buffer, size);
3235     }
3236     return rc;
3237 }
3238 
3239 /* Table 168 - Definition of {RSA} TPMS_SIGNATURE_RSA Structure */
3240 
3241 TPM_RC
TSS_TPMS_SIGNATURE_RSA_Unmarshalu(TPMS_SIGNATURE_RSA * target,BYTE ** buffer,uint32_t * size)3242 TSS_TPMS_SIGNATURE_RSA_Unmarshalu(TPMS_SIGNATURE_RSA *target, BYTE **buffer, uint32_t *size)
3243 {
3244     TPM_RC rc = TPM_RC_SUCCESS;
3245 
3246     if (rc == TPM_RC_SUCCESS) {
3247 	rc = TSS_TPMI_ALG_HASH_Unmarshalu(&target->hash, buffer, size, NO);
3248     }
3249     if (rc == TPM_RC_SUCCESS) {
3250 	rc = TSS_TPM2B_PUBLIC_KEY_RSA_Unmarshalu(&target->sig, buffer, size);
3251     }
3252     return rc;
3253 }
3254 
3255 /* Table 169 - Definition of Types for {RSA} Signature */
3256 
3257 TPM_RC
TSS_TPMS_SIGNATURE_RSASSA_Unmarshalu(TPMS_SIGNATURE_RSASSA * target,BYTE ** buffer,uint32_t * size)3258 TSS_TPMS_SIGNATURE_RSASSA_Unmarshalu(TPMS_SIGNATURE_RSASSA *target, BYTE **buffer, uint32_t *size)
3259 {
3260     TPM_RC rc = TPM_RC_SUCCESS;
3261 
3262     if (rc == TPM_RC_SUCCESS) {
3263 	rc = TSS_TPMS_SIGNATURE_RSA_Unmarshalu(target, buffer, size);
3264     }
3265     return rc;
3266 }
3267 
3268 /* Table 169 - Definition of Types for {RSA} Signature */
3269 
3270 TPM_RC
TSS_TPMS_SIGNATURE_RSAPSS_Unmarshalu(TPMS_SIGNATURE_RSAPSS * target,BYTE ** buffer,uint32_t * size)3271 TSS_TPMS_SIGNATURE_RSAPSS_Unmarshalu(TPMS_SIGNATURE_RSAPSS *target, BYTE **buffer, uint32_t *size)
3272 {
3273     TPM_RC rc = TPM_RC_SUCCESS;
3274 
3275     if (rc == TPM_RC_SUCCESS) {
3276 	rc = TSS_TPMS_SIGNATURE_RSA_Unmarshalu(target, buffer, size);
3277     }
3278     return rc;
3279 }
3280 
3281 /* Table 170 - Definition of {ECC} TPMS_SIGNATURE_ECC Structure */
3282 
3283 TPM_RC
TSS_TPMS_SIGNATURE_ECC_Unmarshalu(TPMS_SIGNATURE_ECC * target,BYTE ** buffer,uint32_t * size)3284 TSS_TPMS_SIGNATURE_ECC_Unmarshalu(TPMS_SIGNATURE_ECC *target, BYTE **buffer, uint32_t *size)
3285 {
3286     TPM_RC rc = TPM_RC_SUCCESS;
3287 
3288     if (rc == TPM_RC_SUCCESS) {
3289 	rc = TSS_TPMI_ALG_HASH_Unmarshalu(&target->hash, buffer, size, NO);
3290     }
3291     if (rc == TPM_RC_SUCCESS) {
3292 	rc = TSS_TPM2B_ECC_PARAMETER_Unmarshalu(&target->signatureR, buffer, size);
3293     }
3294     if (rc == TPM_RC_SUCCESS) {
3295 	rc = TSS_TPM2B_ECC_PARAMETER_Unmarshalu(&target->signatureS, buffer, size);
3296     }
3297     return rc;
3298 }
3299 
3300 /* Table 171 - Definition of Types for {ECC} TPMS_SIGNATURE_ECC */
3301 
3302 TPM_RC
TSS_TPMS_SIGNATURE_ECDSA_Unmarshalu(TPMS_SIGNATURE_ECDSA * target,BYTE ** buffer,uint32_t * size)3303 TSS_TPMS_SIGNATURE_ECDSA_Unmarshalu(TPMS_SIGNATURE_ECDSA *target, BYTE **buffer, uint32_t *size)
3304 {
3305     TPM_RC rc = TPM_RC_SUCCESS;
3306 
3307     if (rc == TPM_RC_SUCCESS) {
3308 	rc = TSS_TPMS_SIGNATURE_ECC_Unmarshalu(target, buffer, size);
3309     }
3310     return rc;
3311 }
3312 
3313 TPM_RC
TSS_TPMS_SIGNATURE_ECDAA_Unmarshalu(TPMS_SIGNATURE_ECDAA * target,BYTE ** buffer,uint32_t * size)3314 TSS_TPMS_SIGNATURE_ECDAA_Unmarshalu(TPMS_SIGNATURE_ECDAA *target, BYTE **buffer, uint32_t *size)
3315 {
3316     TPM_RC rc = TPM_RC_SUCCESS;
3317 
3318     if (rc == TPM_RC_SUCCESS) {
3319 	rc = TSS_TPMS_SIGNATURE_ECC_Unmarshalu(target, buffer, size);
3320     }
3321     return rc;
3322 }
3323 
3324 TPM_RC
TSS_TPMS_SIGNATURE_SM2_Unmarshalu(TPMS_SIGNATURE_SM2 * target,BYTE ** buffer,uint32_t * size)3325 TSS_TPMS_SIGNATURE_SM2_Unmarshalu(TPMS_SIGNATURE_SM2 *target, BYTE **buffer, uint32_t *size)
3326 {
3327     TPM_RC rc = TPM_RC_SUCCESS;
3328 
3329     if (rc == TPM_RC_SUCCESS) {
3330 	rc = TSS_TPMS_SIGNATURE_ECC_Unmarshalu(target, buffer, size);
3331     }
3332     return rc;
3333 }
3334 
3335 TPM_RC
TSS_TPMS_SIGNATURE_ECSCHNORR_Unmarshalu(TPMS_SIGNATURE_ECSCHNORR * target,BYTE ** buffer,uint32_t * size)3336 TSS_TPMS_SIGNATURE_ECSCHNORR_Unmarshalu(TPMS_SIGNATURE_ECSCHNORR *target, BYTE **buffer, uint32_t *size)
3337 {
3338     TPM_RC rc = TPM_RC_SUCCESS;
3339 
3340     if (rc == TPM_RC_SUCCESS) {
3341 	rc = TSS_TPMS_SIGNATURE_ECC_Unmarshalu(target, buffer, size);
3342     }
3343     return rc;
3344 }
3345 
3346 /* Table 172 - Definition of TPMU_SIGNATURE Union <IN/OUT, S> */
3347 
3348 TPM_RC
TSS_TPMU_SIGNATURE_Unmarshalu(TPMU_SIGNATURE * target,BYTE ** buffer,uint32_t * size,uint32_t selector)3349 TSS_TPMU_SIGNATURE_Unmarshalu(TPMU_SIGNATURE *target, BYTE **buffer, uint32_t *size, uint32_t selector)
3350 {
3351     TPM_RC rc = TPM_RC_SUCCESS;
3352 
3353     switch (selector) {
3354 #ifdef TPM_ALG_RSASSA
3355       case TPM_ALG_RSASSA:
3356 	rc = TSS_TPMS_SIGNATURE_RSASSA_Unmarshalu(&target->rsassa, buffer, size);
3357 	break;
3358 #endif
3359 #ifdef TPM_ALG_RSAPSS
3360       case TPM_ALG_RSAPSS:
3361 	rc = TSS_TPMS_SIGNATURE_RSAPSS_Unmarshalu(&target->rsapss, buffer, size);
3362 	break;
3363 #endif
3364 #ifdef TPM_ALG_ECDSA
3365       case TPM_ALG_ECDSA:
3366 	rc = TSS_TPMS_SIGNATURE_ECDSA_Unmarshalu(&target->ecdsa, buffer, size);
3367 	break;
3368 #endif
3369 #ifdef TPM_ALG_ECDAA
3370       case TPM_ALG_ECDAA:
3371 	rc = TSS_TPMS_SIGNATURE_ECDAA_Unmarshalu(&target->ecdaa, buffer, size);
3372 	break;
3373 #endif
3374 #ifdef TPM_ALG_SM2
3375       case TPM_ALG_SM2:
3376 	rc = TSS_TPMS_SIGNATURE_SM2_Unmarshalu(&target->sm2, buffer, size);
3377 	break;
3378 #endif
3379 #ifdef TPM_ALG_ECSCHNORR
3380       case TPM_ALG_ECSCHNORR:
3381 	rc = TSS_TPMS_SIGNATURE_ECSCHNORR_Unmarshalu(&target->ecschnorr, buffer, size);
3382 	break;
3383 #endif
3384 #ifdef TPM_ALG_HMAC
3385       case TPM_ALG_HMAC:
3386 	rc = TSS_TPMT_HA_Unmarshalu(&target->hmac, buffer, size, NO);
3387 	break;
3388 #endif
3389       case TPM_ALG_NULL:
3390 	break;
3391       default:
3392 	rc = TPM_RC_SELECTOR;
3393     }
3394     return rc;
3395 }
3396 
3397 /* Table 173 - Definition of TPMT_SIGNATURE Structure */
3398 
3399 TPM_RC
TSS_TPMT_SIGNATURE_Unmarshalu(TPMT_SIGNATURE * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)3400 TSS_TPMT_SIGNATURE_Unmarshalu(TPMT_SIGNATURE *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
3401 {
3402     TPM_RC rc = TPM_RC_SUCCESS;
3403 
3404     if (rc == TPM_RC_SUCCESS) {
3405 	rc = TSS_TPMI_ALG_SIG_SCHEME_Unmarshalu(&target->sigAlg, buffer, size, allowNull);
3406     }
3407     if (rc == TPM_RC_SUCCESS) {
3408 	rc = TSS_TPMU_SIGNATURE_Unmarshalu(&target->signature, buffer, size, target->sigAlg);
3409     }
3410     return rc;
3411 }
3412 
3413 /* Table 175 - Definition of TPM2B_ENCRYPTED_SECRET Structure */
3414 
3415 TPM_RC
TSS_TPM2B_ENCRYPTED_SECRET_Unmarshalu(TPM2B_ENCRYPTED_SECRET * target,BYTE ** buffer,uint32_t * size)3416 TSS_TPM2B_ENCRYPTED_SECRET_Unmarshalu(TPM2B_ENCRYPTED_SECRET *target, BYTE **buffer, uint32_t *size)
3417 {
3418     TPM_RC rc = TPM_RC_SUCCESS;
3419 
3420     if (rc == TPM_RC_SUCCESS) {
3421 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.secret), buffer, size);
3422     }
3423     return rc;
3424 }
3425 
3426 /* Table 176 - Definition of (TPM_ALG_ID) TPMI_ALG_PUBLIC Type */
3427 
3428 TPM_RC
TSS_TPMI_ALG_PUBLIC_Unmarshalu(TPMI_ALG_PUBLIC * target,BYTE ** buffer,uint32_t * size)3429 TSS_TPMI_ALG_PUBLIC_Unmarshalu(TPMI_ALG_PUBLIC *target, BYTE **buffer, uint32_t *size)
3430 {
3431     TPM_RC rc = TPM_RC_SUCCESS;
3432 
3433     if (rc == TPM_RC_SUCCESS) {
3434 	rc = TSS_TPM_ALG_ID_Unmarshalu(target, buffer, size);
3435     }
3436     return rc;
3437 }
3438 
3439 /* Table 177 - Definition of TPMU_PUBLIC_ID Union <IN/OUT, S> */
3440 
3441 TPM_RC
TSS_TPMU_PUBLIC_ID_Unmarshalu(TPMU_PUBLIC_ID * target,BYTE ** buffer,uint32_t * size,uint32_t selector)3442 TSS_TPMU_PUBLIC_ID_Unmarshalu(TPMU_PUBLIC_ID *target, BYTE **buffer, uint32_t *size, uint32_t selector)
3443 {
3444     TPM_RC rc = TPM_RC_SUCCESS;
3445 
3446     switch (selector) {
3447 #ifdef TPM_ALG_KEYEDHASH
3448       case TPM_ALG_KEYEDHASH:
3449 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->keyedHash, buffer, size);
3450 	break;
3451 #endif
3452 #ifdef TPM_ALG_SYMCIPHER
3453       case TPM_ALG_SYMCIPHER:
3454 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->sym, buffer, size);
3455 	break;
3456 #endif
3457 #ifdef TPM_ALG_RSA
3458       case TPM_ALG_RSA:
3459 	rc = TSS_TPM2B_PUBLIC_KEY_RSA_Unmarshalu(&target->rsa, buffer, size);
3460 	break;
3461 #endif
3462 #ifdef TPM_ALG_ECC
3463       case TPM_ALG_ECC:
3464 	rc = TSS_TPMS_ECC_POINT_Unmarshalu(&target->ecc, buffer, size);
3465 	break;
3466 #endif
3467       default:
3468 	rc = TPM_RC_SELECTOR;
3469     }
3470     return rc;
3471 }
3472 
3473 /* Table 178 - Definition of TPMS_KEYEDHASH_PARMS Structure */
3474 
3475 TPM_RC
TSS_TPMS_KEYEDHASH_PARMS_Unmarshalu(TPMS_KEYEDHASH_PARMS * target,BYTE ** buffer,uint32_t * size)3476 TSS_TPMS_KEYEDHASH_PARMS_Unmarshalu(TPMS_KEYEDHASH_PARMS *target, BYTE **buffer, uint32_t *size)
3477 {
3478     TPM_RC rc = TPM_RC_SUCCESS;
3479 
3480     if (rc == TPM_RC_SUCCESS) {
3481 	rc = TSS_TPMT_KEYEDHASH_SCHEME_Unmarshalu(&target->scheme, buffer, size, YES);
3482     }
3483     return rc;
3484 }
3485 
3486 /* Table 179 - Definition of TPMS_ASYM_PARMS Structure <> */
3487 
3488 #if 0
3489 TPM_RC
3490 TSS_TPMS_ASYM_PARMS_Unmarshalu(TPMS_ASYM_PARMS *target, BYTE **buffer, uint32_t *size)
3491 {
3492     TPM_RC rc = TPM_RC_SUCCESS;
3493 
3494     if (rc == TPM_RC_SUCCESS) {
3495 	rc = TSS_TPMT_SYM_DEF_OBJECT_Unmarshalu(&target->symmetric, buffer, size, YES);
3496     }
3497     if (rc == TPM_RC_SUCCESS) {
3498 	rc = TSS_TPMT_ASYM_SCHEME_Unmarshalu(&target->scheme, buffer, size, YES);
3499     }
3500     return rc;
3501 }
3502 #endif
3503 
3504 /* Table 180 - Definition of {RSA} TPMS_RSA_PARMS Structure */
3505 
3506 TPM_RC
TSS_TPMS_RSA_PARMS_Unmarshalu(TPMS_RSA_PARMS * target,BYTE ** buffer,uint32_t * size)3507 TSS_TPMS_RSA_PARMS_Unmarshalu(TPMS_RSA_PARMS *target, BYTE **buffer, uint32_t *size)
3508 {
3509     TPM_RC rc = TPM_RC_SUCCESS;
3510 
3511     if (rc == TPM_RC_SUCCESS) {
3512 	rc = TSS_TPMT_SYM_DEF_OBJECT_Unmarshalu(&target->symmetric, buffer, size, YES);
3513     }
3514     if (rc == TPM_RC_SUCCESS) {
3515 	rc = TSS_TPMT_RSA_SCHEME_Unmarshalu(&target->scheme, buffer, size, YES);
3516     }
3517     if (rc == TPM_RC_SUCCESS) {
3518 	rc = TSS_TPMI_RSA_KEY_BITS_Unmarshalu(&target->keyBits, buffer, size);
3519     }
3520     if (rc == TPM_RC_SUCCESS) {
3521 	rc = TSS_UINT32_Unmarshalu(&target->exponent, buffer, size);
3522     }
3523     return rc;
3524 }
3525 
3526 /* Table 181 - Definition of {ECC} TPMS_ECC_PARMS Structure */
3527 
3528 TPM_RC
TSS_TPMS_ECC_PARMS_Unmarshalu(TPMS_ECC_PARMS * target,BYTE ** buffer,uint32_t * size)3529 TSS_TPMS_ECC_PARMS_Unmarshalu(TPMS_ECC_PARMS *target, BYTE **buffer, uint32_t *size)
3530 {
3531     TPM_RC rc = TPM_RC_SUCCESS;
3532 
3533     if (rc == TPM_RC_SUCCESS) {
3534 	rc = TSS_TPMT_SYM_DEF_OBJECT_Unmarshalu(&target->symmetric, buffer, size, YES);
3535     }
3536     if (rc == TPM_RC_SUCCESS) {
3537 	rc = TSS_TPMT_ECC_SCHEME_Unmarshalu(&target->scheme, buffer, size, YES);
3538     }
3539     if (rc == TPM_RC_SUCCESS) {
3540 	rc = TSS_TPMI_ECC_CURVE_Unmarshalu(&target->curveID, buffer, size);
3541     }
3542     if (rc == TPM_RC_SUCCESS) {
3543 	rc = TSS_TPMT_KDF_SCHEME_Unmarshalu(&target->kdf, buffer, size, YES);
3544     }
3545     return rc;
3546 }
3547 
3548 /* Table 182 - Definition of TPMU_PUBLIC_PARMS Union <IN/OUT, S> */
3549 
3550 TPM_RC
TSS_TPMU_PUBLIC_PARMS_Unmarshalu(TPMU_PUBLIC_PARMS * target,BYTE ** buffer,uint32_t * size,uint32_t selector)3551 TSS_TPMU_PUBLIC_PARMS_Unmarshalu(TPMU_PUBLIC_PARMS *target, BYTE **buffer, uint32_t *size, uint32_t selector)
3552 {
3553     TPM_RC rc = TPM_RC_SUCCESS;
3554 
3555     switch (selector) {
3556 #ifdef TPM_ALG_KEYEDHASH
3557       case TPM_ALG_KEYEDHASH:
3558 	rc = TSS_TPMS_KEYEDHASH_PARMS_Unmarshalu(&target->keyedHashDetail, buffer, size);
3559 	break;
3560 #endif
3561 #ifdef TPM_ALG_SYMCIPHER
3562       case TPM_ALG_SYMCIPHER:
3563 	rc = TSS_TPMS_SYMCIPHER_PARMS_Unmarshalu(&target->symDetail, buffer, size);
3564 	break;
3565 #endif
3566 #ifdef TPM_ALG_RSA
3567       case TPM_ALG_RSA:
3568 	rc = TSS_TPMS_RSA_PARMS_Unmarshalu(&target->rsaDetail, buffer, size);
3569 	break;
3570 #endif
3571 #ifdef TPM_ALG_ECC
3572       case TPM_ALG_ECC:
3573 	rc = TSS_TPMS_ECC_PARMS_Unmarshalu(&target->eccDetail, buffer, size);
3574 	break;
3575 #endif
3576       default:
3577 	rc = TPM_RC_SELECTOR;
3578     }
3579     return rc;
3580 }
3581 
3582 #ifndef TPM_TSS_NOCMDCHECK
3583 
3584 /* Table 183 - Definition of TPMT_PUBLIC_PARMS Structure */
3585 
3586 TPM_RC
TSS_TPMT_PUBLIC_PARMS_Unmarshalu(TPMT_PUBLIC_PARMS * target,BYTE ** buffer,uint32_t * size)3587 TSS_TPMT_PUBLIC_PARMS_Unmarshalu(TPMT_PUBLIC_PARMS *target, BYTE **buffer, uint32_t *size)
3588 {
3589     TPM_RC rc = TPM_RC_SUCCESS;
3590 
3591     if (rc == TPM_RC_SUCCESS) {
3592 	rc = TSS_TPMI_ALG_PUBLIC_Unmarshalu(&target->type, buffer, size);
3593     }
3594     if (rc == TPM_RC_SUCCESS) {
3595 	rc = TSS_TPMU_PUBLIC_PARMS_Unmarshalu(&target->parameters, buffer, size, target->type);
3596     }
3597     return rc;
3598 }
3599 
3600 #endif	/* TPM_TSS_NOCMDCHECK */
3601 
3602 /* Table 184 - Definition of TPMT_PUBLIC Structure */
3603 
3604 TPM_RC
TSS_TPMT_PUBLIC_Unmarshalu(TPMT_PUBLIC * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)3605 TSS_TPMT_PUBLIC_Unmarshalu(TPMT_PUBLIC *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
3606 {
3607     TPM_RC rc = TPM_RC_SUCCESS;
3608 
3609     if (rc == TPM_RC_SUCCESS) {
3610 	rc = TSS_TPMI_ALG_PUBLIC_Unmarshalu(&target->type, buffer, size);
3611     }
3612     if (rc == TPM_RC_SUCCESS) {
3613 	rc = TSS_TPMI_ALG_HASH_Unmarshalu(&target->nameAlg, buffer, size, allowNull);
3614     }
3615     if (rc == TPM_RC_SUCCESS) {
3616 	rc = TSS_TPMA_OBJECT_Unmarshalu(&target->objectAttributes, buffer, size);
3617     }
3618     if (rc == TPM_RC_SUCCESS) {
3619 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->authPolicy, buffer, size);
3620     }
3621     if (rc == TPM_RC_SUCCESS) {
3622 	rc = TSS_TPMU_PUBLIC_PARMS_Unmarshalu(&target->parameters, buffer, size, target->type);
3623     }
3624     if (rc == TPM_RC_SUCCESS) {
3625 	rc = TSS_TPMU_PUBLIC_ID_Unmarshalu(&target->unique, buffer, size, target->type);
3626     }
3627     return rc;
3628 }
3629 
3630 /* Table 185 - Definition of TPM2B_PUBLIC Structure */
3631 
3632 TPM_RC
TSS_TPM2B_PUBLIC_Unmarshalu(TPM2B_PUBLIC * target,BYTE ** buffer,uint32_t * size,BOOL allowNull)3633 TSS_TPM2B_PUBLIC_Unmarshalu(TPM2B_PUBLIC *target, BYTE **buffer, uint32_t *size, BOOL allowNull)
3634 {
3635     TPM_RC rc = TPM_RC_SUCCESS;
3636     uint32_t startSize = 0;
3637 
3638     if (rc == TPM_RC_SUCCESS) {
3639 	rc = TSS_UINT16_Unmarshalu(&target->size, buffer, size);
3640     }
3641     if (rc == TPM_RC_SUCCESS) {
3642 	if (target->size == 0) {
3643 	    rc = TPM_RC_SIZE;
3644 	}
3645     }
3646     if (rc == TPM_RC_SUCCESS) {
3647 	startSize = *size;
3648     }
3649     if (rc == TPM_RC_SUCCESS) {
3650 	rc = TSS_TPMT_PUBLIC_Unmarshalu(&target->publicArea, buffer, size, allowNull);
3651     }
3652     if (rc == TPM_RC_SUCCESS) {
3653 	if (target->size != startSize - *size) {
3654 	    rc = TPM_RC_SIZE;
3655 	}
3656     }
3657     return rc;
3658 }
3659 #ifndef TPM_TSS_NOCMDCHECK
3660 
3661 /* Table 192 - Definition of TPM2B_TEMPLATE Structure */
3662 
3663 TPM_RC
TSS_TPM2B_TEMPLATE_Unmarshalu(TPM2B_TEMPLATE * target,BYTE ** buffer,uint32_t * size)3664 TSS_TPM2B_TEMPLATE_Unmarshalu(TPM2B_TEMPLATE *target, BYTE **buffer, uint32_t *size)
3665 {
3666     TPM_RC rc = TPM_RC_SUCCESS;
3667 
3668     if (rc == TPM_RC_SUCCESS) {
3669 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
3670     }
3671     return rc;
3672 }
3673 
3674 /* Table 187 - Definition of TPMU_SENSITIVE_COMPOSITE Union <IN/OUT, S> */
3675 
3676 TPM_RC
TSS_TPMU_SENSITIVE_COMPOSITE_Unmarshalu(TPMU_SENSITIVE_COMPOSITE * target,BYTE ** buffer,uint32_t * size,uint32_t selector)3677 TSS_TPMU_SENSITIVE_COMPOSITE_Unmarshalu(TPMU_SENSITIVE_COMPOSITE *target, BYTE **buffer, uint32_t *size, uint32_t selector)
3678 {
3679     TPM_RC rc = TPM_RC_SUCCESS;
3680 
3681     switch (selector) {
3682 #ifdef TPM_ALG_RSA
3683       case TPM_ALG_RSA:
3684 	rc = TSS_TPM2B_PRIVATE_KEY_RSA_Unmarshalu(&target->rsa, buffer, size);
3685 	break;
3686 #endif
3687 #ifdef TPM_ALG_ECC
3688       case TPM_ALG_ECC:
3689 	rc = TSS_TPM2B_ECC_PARAMETER_Unmarshalu(&target->ecc, buffer, size);
3690 	break;
3691 #endif
3692 #ifdef TPM_ALG_KEYEDHASH
3693       case TPM_ALG_KEYEDHASH:
3694 	rc = TSS_TPM2B_SENSITIVE_DATA_Unmarshalu(&target->bits, buffer, size);
3695 	break;
3696 #endif
3697 #ifdef TPM_ALG_SYMCIPHER
3698       case TPM_ALG_SYMCIPHER:
3699 	rc = TSS_TPM2B_SYM_KEY_Unmarshalu(&target->sym, buffer, size);
3700 	break;
3701 #endif
3702       default:
3703 	rc = TPM_RC_SELECTOR;
3704     }
3705     return rc;
3706 }
3707 
3708 /* Table 188 - Definition of TPMT_SENSITIVE Structure */
3709 
3710 TPM_RC
TSS_TPMT_SENSITIVE_Unmarshalu(TPMT_SENSITIVE * target,BYTE ** buffer,uint32_t * size)3711 TSS_TPMT_SENSITIVE_Unmarshalu(TPMT_SENSITIVE *target, BYTE **buffer, uint32_t *size)
3712 {
3713     TPM_RC rc = TPM_RC_SUCCESS;
3714 
3715     if (rc == TPM_RC_SUCCESS) {
3716 	rc = TSS_TPMI_ALG_PUBLIC_Unmarshalu(&target->sensitiveType, buffer, size);
3717     }
3718     if (rc == TPM_RC_SUCCESS) {
3719 	rc = TSS_TPM2B_AUTH_Unmarshalu(&target->authValue, buffer, size);
3720     }
3721     if (rc == TPM_RC_SUCCESS) {
3722 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->seedValue, buffer, size);
3723     }
3724     if (rc == TPM_RC_SUCCESS) {
3725 	rc = TSS_TPMU_SENSITIVE_COMPOSITE_Unmarshalu(&target->sensitive, buffer, size, target->sensitiveType);
3726     }
3727     return rc;
3728 }
3729 
3730 /* Table 189 - Definition of TPM2B_SENSITIVE Structure <IN/OUT> */
3731 
3732 TPM_RC
TSS_TPM2B_SENSITIVE_Unmarshalu(TPM2B_SENSITIVE * target,BYTE ** buffer,uint32_t * size)3733 TSS_TPM2B_SENSITIVE_Unmarshalu(TPM2B_SENSITIVE *target, BYTE **buffer, uint32_t *size)
3734 {
3735     TPM_RC rc = TPM_RC_SUCCESS;
3736     uint32_t startSize = 0;
3737 
3738     if (rc == TPM_RC_SUCCESS) {
3739 	rc = TSS_UINT16_Unmarshalu(&target->t.size, buffer, size);
3740     }
3741     if (target->t.size != 0) {
3742 	if (rc == TPM_RC_SUCCESS) {
3743 	    startSize = *size;
3744 	}
3745 	if (rc == TPM_RC_SUCCESS) {
3746 	    rc = TSS_TPMT_SENSITIVE_Unmarshalu(&target->t.sensitiveArea, buffer, size);
3747 	}
3748 	if (rc == TPM_RC_SUCCESS) {
3749 	    if (target->t.size != startSize - *size) {
3750 		rc = TPM_RC_SIZE;
3751 	    }
3752 	}
3753     }
3754     return rc;
3755 }
3756 
3757 #endif	/* TPM_TSS_NOCMDCHECK */
3758 
3759 /* Table 191 - Definition of TPM2B_PRIVATE Structure <IN/OUT, S> */
3760 
3761 TPM_RC
TSS_TPM2B_PRIVATE_Unmarshalu(TPM2B_PRIVATE * target,BYTE ** buffer,uint32_t * size)3762 TSS_TPM2B_PRIVATE_Unmarshalu(TPM2B_PRIVATE *target, BYTE **buffer, uint32_t *size)
3763 {
3764     TPM_RC rc = TPM_RC_SUCCESS;
3765 
3766     if (rc == TPM_RC_SUCCESS) {
3767 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
3768     }
3769     return rc;
3770 }
3771 
3772 /* Table 193 - Definition of TPM2B_ID_OBJECT Structure <IN/OUT> */
3773 
3774 TPM_RC
TSS_TPM2B_ID_OBJECT_Unmarshalu(TPM2B_ID_OBJECT * target,BYTE ** buffer,uint32_t * size)3775 TSS_TPM2B_ID_OBJECT_Unmarshalu(TPM2B_ID_OBJECT *target, BYTE **buffer, uint32_t *size)
3776 {
3777     TPM_RC rc = TPM_RC_SUCCESS;
3778 
3779     if (rc == TPM_RC_SUCCESS) {
3780 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.credential), buffer, size);
3781     }
3782     return rc;
3783 }
3784 
3785 /* Table 196 - Definition of (UINT32) TPMA_NV Bits */
3786 
3787 TPM_RC
TSS_TPMA_NV_Unmarshalu(TPMA_NV * target,BYTE ** buffer,uint32_t * size)3788 TSS_TPMA_NV_Unmarshalu(TPMA_NV *target, BYTE **buffer, uint32_t *size)
3789 {
3790     TPM_RC rc = TPM_RC_SUCCESS;
3791 
3792     if (rc == TPM_RC_SUCCESS) {
3793 	rc = TSS_UINT32_Unmarshalu(&target->val, buffer, size);
3794     }
3795     if (rc == TPM_RC_SUCCESS) {
3796 	if (target->val & TPMA_NV_RESERVED) {
3797 	    rc = TPM_RC_RESERVED_BITS;
3798 	}
3799     }
3800     return rc;
3801 }
3802 
3803 /* Table 197 - Definition of TPMS_NV_PUBLIC Structure */
3804 
3805 TPM_RC
TSS_TPMS_NV_PUBLIC_Unmarshalu(TPMS_NV_PUBLIC * target,BYTE ** buffer,uint32_t * size)3806 TSS_TPMS_NV_PUBLIC_Unmarshalu(TPMS_NV_PUBLIC *target, BYTE **buffer, uint32_t *size)
3807 {
3808     TPM_RC rc = TPM_RC_SUCCESS;
3809 
3810     if (rc == TPM_RC_SUCCESS) {
3811 	rc = TSS_TPMI_RH_NV_INDEX_Unmarshalu(&target->nvIndex, buffer, size, NO);
3812     }
3813     if (rc == TPM_RC_SUCCESS) {
3814 	rc = TSS_TPMI_ALG_HASH_Unmarshalu(&target->nameAlg, buffer, size, NO);
3815     }
3816     if (rc == TPM_RC_SUCCESS) {
3817 	rc = TSS_TPMA_NV_Unmarshalu(&target->attributes, buffer, size);
3818     }
3819     if (rc == TPM_RC_SUCCESS) {
3820 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->authPolicy, buffer, size);
3821     }
3822     if (rc == TPM_RC_SUCCESS) {
3823 	rc = TSS_UINT16_Unmarshalu(&target->dataSize, buffer, size);
3824     }
3825     return rc;
3826 }
3827 
3828 /* Table 198 - Definition of TPM2B_NV_PUBLIC Structure */
3829 
3830 TPM_RC
TSS_TPM2B_NV_PUBLIC_Unmarshalu(TPM2B_NV_PUBLIC * target,BYTE ** buffer,uint32_t * size)3831 TSS_TPM2B_NV_PUBLIC_Unmarshalu(TPM2B_NV_PUBLIC *target, BYTE **buffer, uint32_t *size)
3832 {
3833     TPM_RC rc = TPM_RC_SUCCESS;
3834     uint32_t startSize = 0;
3835 
3836     if (rc == TPM_RC_SUCCESS) {
3837 	rc = TSS_UINT16_Unmarshalu(&target->size, buffer, size);
3838     }
3839     if (rc == TPM_RC_SUCCESS) {
3840 	if (target->size == 0) {
3841 	    rc = TPM_RC_SIZE;
3842 	}
3843     }
3844     if (rc == TPM_RC_SUCCESS) {
3845 	startSize = *size;
3846     }
3847     if (rc == TPM_RC_SUCCESS) {
3848 	rc = TSS_TPMS_NV_PUBLIC_Unmarshalu(&target->nvPublic, buffer, size);
3849     }
3850     if (rc == TPM_RC_SUCCESS) {
3851 	if (target->size != startSize - *size) {
3852 	    rc = TPM_RC_SIZE;
3853 	}
3854     }
3855     return rc;
3856 }
3857 
3858 #ifndef TPM_TSS_NOCMDCHECK
3859 
3860 /* Table 199 - Definition of TPM2B_CONTEXT_SENSITIVE Structure <IN/OUT> */
3861 
3862 TPM_RC
TSS_TPM2B_CONTEXT_SENSITIVE_Unmarshalu(TPM2B_CONTEXT_SENSITIVE * target,BYTE ** buffer,uint32_t * size)3863 TSS_TPM2B_CONTEXT_SENSITIVE_Unmarshalu(TPM2B_CONTEXT_SENSITIVE *target, BYTE **buffer, uint32_t *size)
3864 {
3865     TPM_RC rc = TPM_RC_SUCCESS;
3866 
3867     if (rc == TPM_RC_SUCCESS) {
3868 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
3869     }
3870     return rc;
3871 }
3872 
3873 /* Table 200 - Definition of TPMS_CONTEXT_DATA Structure <IN/OUT, S> */
3874 
3875 TPM_RC
TSS_TPMS_CONTEXT_DATA_Unmarshalu(TPMS_CONTEXT_DATA * target,BYTE ** buffer,uint32_t * size)3876 TSS_TPMS_CONTEXT_DATA_Unmarshalu(TPMS_CONTEXT_DATA *target, BYTE **buffer, uint32_t *size)
3877 {
3878     TPM_RC rc = TPM_RC_SUCCESS;
3879 
3880     if (rc == TPM_RC_SUCCESS) {
3881 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->integrity, buffer, size);
3882     }
3883     if (rc == TPM_RC_SUCCESS) {
3884 	rc = TSS_TPM2B_CONTEXT_SENSITIVE_Unmarshalu(&target->encrypted, buffer, size);
3885     }
3886     return rc;
3887 }
3888 
3889 #endif	/* TPM_TSS_NOCMDCHECK */
3890 
3891 /* Table 201 - Definition of TPM2B_CONTEXT_DATA Structure <IN/OUT> */
3892 
3893 TPM_RC
TSS_TPM2B_CONTEXT_DATA_Unmarshalu(TPM2B_CONTEXT_DATA * target,BYTE ** buffer,uint32_t * size)3894 TSS_TPM2B_CONTEXT_DATA_Unmarshalu(TPM2B_CONTEXT_DATA *target, BYTE **buffer, uint32_t *size)
3895 {
3896     TPM_RC rc = TPM_RC_SUCCESS;
3897 
3898     if (rc == TPM_RC_SUCCESS) {
3899 	rc = TSS_TPM2B_Unmarshalu(&target->b, sizeof(target->t.buffer), buffer, size);
3900     }
3901     return rc;
3902 }
3903 
3904 /* Table 202 - Definition of TPMS_CONTEXT Structure */
3905 
3906 TPM_RC
TSS_TPMS_CONTEXT_Unmarshalu(TPMS_CONTEXT * target,BYTE ** buffer,uint32_t * size)3907 TSS_TPMS_CONTEXT_Unmarshalu(TPMS_CONTEXT *target, BYTE **buffer, uint32_t *size)
3908 {
3909     TPM_RC rc = TPM_RC_SUCCESS;
3910 
3911     if (rc == TPM_RC_SUCCESS) {
3912 	rc = TSS_UINT64_Unmarshalu(&target->sequence, buffer, size);
3913     }
3914     if (rc == TPM_RC_SUCCESS) {
3915 	rc = TSS_TPMI_DH_SAVED_Unmarshalu(&target->savedHandle, buffer, size, NO);
3916     }
3917     if (rc == TPM_RC_SUCCESS) {
3918 	rc = TSS_TPMI_RH_HIERARCHY_Unmarshalu(&target->hierarchy, buffer, size, YES);
3919     }
3920     if (rc == TPM_RC_SUCCESS) {
3921 	rc = TSS_TPM2B_CONTEXT_DATA_Unmarshalu(&target->contextBlob, buffer, size);
3922     }
3923     return rc;
3924 }
3925 
3926 /* Table 204 - Definition of TPMS_CREATION_DATA Structure <OUT> */
3927 
3928 TPM_RC
TSS_TPMS_CREATION_DATA_Unmarshalu(TPMS_CREATION_DATA * target,BYTE ** buffer,uint32_t * size)3929 TSS_TPMS_CREATION_DATA_Unmarshalu(TPMS_CREATION_DATA *target, BYTE **buffer, uint32_t *size)
3930 {
3931     TPM_RC rc = TPM_RC_SUCCESS;
3932 
3933     if (rc == TPM_RC_SUCCESS) {
3934 	rc = TSS_TPML_PCR_SELECTION_Unmarshalu(&target->pcrSelect, buffer, size);
3935     }
3936     if (rc == TPM_RC_SUCCESS) {
3937 	rc = TSS_TPM2B_DIGEST_Unmarshalu(&target->pcrDigest, buffer, size);
3938     }
3939     if (rc == TPM_RC_SUCCESS) {
3940 	rc = TSS_TPMA_LOCALITY_Unmarshalu(&target->locality, buffer, size);
3941     }
3942     if (rc == TPM_RC_SUCCESS) {
3943 	rc = TSS_TPM_ALG_ID_Unmarshalu(&target->parentNameAlg, buffer, size);
3944     }
3945     if (rc == TPM_RC_SUCCESS) {
3946 	rc = TSS_TPM2B_NAME_Unmarshalu(&target->parentName, buffer, size);
3947     }
3948     if (rc == TPM_RC_SUCCESS) {
3949 	rc = TSS_TPM2B_NAME_Unmarshalu(&target->parentQualifiedName, buffer, size);
3950     }
3951     if (rc == TPM_RC_SUCCESS) {
3952 	rc = TSS_TPM2B_DATA_Unmarshalu(&target->outsideInfo, buffer, size);
3953     }
3954     return rc;
3955 }
3956 
3957 /* Table 205 - Definition of TPM2B_CREATION_DATA Structure <OUT> */
3958 
3959 TPM_RC
TSS_TPM2B_CREATION_DATA_Unmarshalu(TPM2B_CREATION_DATA * target,BYTE ** buffer,uint32_t * size)3960 TSS_TPM2B_CREATION_DATA_Unmarshalu(TPM2B_CREATION_DATA *target, BYTE **buffer, uint32_t *size)
3961 {
3962     TPM_RC rc = TPM_RC_SUCCESS;
3963     uint32_t startSize = 0;
3964 
3965     if (rc == TPM_RC_SUCCESS) {
3966 	rc = TSS_UINT16_Unmarshalu(&target->size, buffer, size);
3967     }
3968     if (rc == TPM_RC_SUCCESS) {
3969 	if (target->size == 0) {
3970 	    rc = TPM_RC_SIZE;
3971 	}
3972     }
3973     if (rc == TPM_RC_SUCCESS) {
3974 	startSize = *size;
3975     }
3976     if (rc == TPM_RC_SUCCESS) {
3977 	rc = TSS_TPMS_CREATION_DATA_Unmarshalu(&target->creationData, buffer, size);
3978     }
3979     if (rc == TPM_RC_SUCCESS) {
3980 	if (target->size != startSize - *size) {
3981 	    rc = TPM_RC_SIZE;
3982 	}
3983     }
3984     return rc;
3985 }
3986 #ifndef TPM_TSS_NOCMDCHECK
3987 
3988 /* Deprecated functions that use a sized value for the size parameter.  The recommended functions
3989    use an unsigned value.
3990 
3991 */
3992 
TPM2B_Unmarshal(TPM2B * target,UINT16 targetSize,BYTE ** buffer,INT32 * size)3993 TPM_RC TPM2B_Unmarshal(TPM2B *target, UINT16 targetSize, BYTE **buffer, INT32 *size)
3994 {
3995     return TSS_TPM2B_Unmarshalu(target, targetSize, buffer, (uint32_t *)size);
3996 }
3997 
TPM_KEY_BITS_Unmarshal(TPM_KEY_BITS * target,BYTE ** buffer,INT32 * size)3998 TPM_RC TPM_KEY_BITS_Unmarshal(TPM_KEY_BITS *target, BYTE **buffer, INT32 *size)
3999 {
4000     return TSS_TPM_KEY_BITS_Unmarshalu(target, buffer, (uint32_t *)size);
4001 }
4002 
TPM_GENERATED_Unmarshal(TPM_GENERATED * target,BYTE ** buffer,INT32 * size)4003 TPM_RC TPM_GENERATED_Unmarshal(TPM_GENERATED *target, BYTE **buffer, INT32 *size)
4004 {
4005     return TSS_TPM_GENERATED_Unmarshalu(target, buffer, (uint32_t *)size);
4006 }
4007 
TPM_ALG_ID_Unmarshal(TPM_ALG_ID * target,BYTE ** buffer,INT32 * size)4008 TPM_RC TPM_ALG_ID_Unmarshal(TPM_ALG_ID *target, BYTE **buffer, INT32 *size)
4009 {
4010     return TSS_TPM_ALG_ID_Unmarshalu(target, buffer, (uint32_t *)size);
4011 }
4012 
TPM_ECC_CURVE_Unmarshal(TPM_ECC_CURVE * target,BYTE ** buffer,INT32 * size)4013 TPM_RC TPM_ECC_CURVE_Unmarshal(TPM_ECC_CURVE *target, BYTE **buffer, INT32 *size)
4014 {
4015     return TSS_TPM_ECC_CURVE_Unmarshalu(target, buffer, (uint32_t *)size);
4016 }
4017 
TPM_CC_Unmarshal(TPM_RC * target,BYTE ** buffer,INT32 * size)4018 TPM_RC TPM_CC_Unmarshal(TPM_RC *target, BYTE **buffer, INT32 *size)
4019 {
4020     return TSS_TPM_CC_Unmarshalu(target, buffer, (uint32_t *)size);
4021 }
4022 
TPM_RC_Unmarshal(TPM_RC * target,BYTE ** buffer,INT32 * size)4023 TPM_RC TPM_RC_Unmarshal(TPM_RC *target, BYTE **buffer, INT32 *size)
4024 {
4025     return TSS_TPM_RC_Unmarshalu(target, buffer, (uint32_t *)size);
4026 }
4027 
TPM_CLOCK_ADJUST_Unmarshal(TPM_CLOCK_ADJUST * target,BYTE ** buffer,INT32 * size)4028 TPM_RC TPM_CLOCK_ADJUST_Unmarshal(TPM_CLOCK_ADJUST *target, BYTE **buffer, INT32 *size)
4029 {
4030     return TSS_TPM_CLOCK_ADJUST_Unmarshalu(target, buffer, (uint32_t *)size);
4031 }
4032 
TPM_EO_Unmarshal(TPM_EO * target,BYTE ** buffer,INT32 * size)4033 TPM_RC TPM_EO_Unmarshal(TPM_EO *target, BYTE **buffer, INT32 *size)
4034 {
4035     return TSS_TPM_EO_Unmarshalu(target, buffer, (uint32_t *)size);
4036 }
4037 
TPM_ST_Unmarshal(TPM_ST * target,BYTE ** buffer,INT32 * size)4038 TPM_RC TPM_ST_Unmarshal(TPM_ST *target, BYTE **buffer, INT32 *size)
4039 {
4040     return TSS_TPM_ST_Unmarshalu(target, buffer, (uint32_t *)size);
4041 }
4042 
TPM_SU_Unmarshal(TPM_SU * target,BYTE ** buffer,INT32 * size)4043 TPM_RC TPM_SU_Unmarshal(TPM_SU *target, BYTE **buffer, INT32 *size)
4044 {
4045     return TSS_TPM_SU_Unmarshalu(target, buffer, (uint32_t *)size);
4046 }
4047 
TPM_SE_Unmarshal(TPM_SE * target,BYTE ** buffer,INT32 * size)4048 TPM_RC TPM_SE_Unmarshal(TPM_SE *target, BYTE **buffer, INT32 *size)
4049 {
4050     return TSS_TPM_SE_Unmarshalu(target, buffer, (uint32_t *)size);
4051 }
4052 
TPM_CAP_Unmarshal(TPM_CAP * target,BYTE ** buffer,INT32 * size)4053 TPM_RC TPM_CAP_Unmarshal(TPM_CAP *target, BYTE **buffer, INT32 *size)
4054 {
4055     return TSS_TPM_CAP_Unmarshalu(target, buffer, (uint32_t *)size);
4056 }
4057 
TPM_PT_Unmarshal(TPM_HANDLE * target,BYTE ** buffer,INT32 * size)4058 TPM_RC TPM_PT_Unmarshal(TPM_HANDLE *target, BYTE **buffer, INT32 *size)
4059 {
4060     return TSS_TPM_PT_Unmarshalu(target, buffer, (uint32_t *)size);
4061 }
4062 
TPM_PT_PCR_Unmarshal(TPM_PT_PCR * target,BYTE ** buffer,INT32 * size)4063 TPM_RC TPM_PT_PCR_Unmarshal(TPM_PT_PCR *target, BYTE **buffer, INT32 *size)
4064 {
4065     return TSS_TPM_PT_PCR_Unmarshalu(target, buffer, (uint32_t *)size);
4066 }
4067 
TPM_HANDLE_Unmarshal(TPM_HANDLE * target,BYTE ** buffer,INT32 * size)4068 TPM_RC TPM_HANDLE_Unmarshal(TPM_HANDLE *target, BYTE **buffer, INT32 *size)
4069 {
4070     return TSS_TPM_HANDLE_Unmarshalu(target, buffer, (uint32_t *)size);
4071 }
4072 
TPMA_ALGORITHM_Unmarshal(TPMA_ALGORITHM * target,BYTE ** buffer,INT32 * size)4073 TPM_RC TPMA_ALGORITHM_Unmarshal(TPMA_ALGORITHM *target, BYTE **buffer, INT32 *size)
4074 {
4075     return TSS_TPMA_ALGORITHM_Unmarshalu(target, buffer, (uint32_t *)size);
4076 }
4077 
TPMA_OBJECT_Unmarshal(TPMA_OBJECT * target,BYTE ** buffer,INT32 * size)4078 TPM_RC TPMA_OBJECT_Unmarshal(TPMA_OBJECT *target, BYTE **buffer, INT32 *size)
4079 {
4080     return TSS_TPMA_OBJECT_Unmarshalu(target, buffer, (uint32_t *)size);
4081 }
4082 
TPMA_SESSION_Unmarshal(TPMA_SESSION * target,BYTE ** buffer,INT32 * size)4083 TPM_RC TPMA_SESSION_Unmarshal(TPMA_SESSION *target, BYTE **buffer, INT32 *size)
4084 {
4085     return TSS_TPMA_SESSION_Unmarshalu(target, buffer, (uint32_t *)size);
4086 }
4087 
TPMA_LOCALITY_Unmarshal(TPMA_LOCALITY * target,BYTE ** buffer,INT32 * size)4088 TPM_RC TPMA_LOCALITY_Unmarshal(TPMA_LOCALITY *target, BYTE **buffer, INT32 *size)
4089 {
4090     return TSS_TPMA_LOCALITY_Unmarshalu(target, buffer, (uint32_t *)size);
4091 }
4092 
TPMA_CC_Unmarshal(TPMA_CC * target,BYTE ** buffer,INT32 * size)4093 TPM_RC TPMA_CC_Unmarshal(TPMA_CC *target, BYTE **buffer, INT32 *size)
4094 {
4095     return TSS_TPMA_CC_Unmarshalu(target, buffer, (uint32_t *)size);
4096 }
4097 
TPMI_YES_NO_Unmarshal(TPMI_YES_NO * target,BYTE ** buffer,INT32 * size)4098 TPM_RC TPMI_YES_NO_Unmarshal(TPMI_YES_NO *target, BYTE **buffer, INT32 *size)
4099 {
4100     return TSS_TPMI_YES_NO_Unmarshalu(target, buffer, (uint32_t *)size);
4101 }
4102 
TPMI_DH_OBJECT_Unmarshal(TPMI_DH_OBJECT * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4103 TPM_RC TPMI_DH_OBJECT_Unmarshal(TPMI_DH_OBJECT *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4104 {
4105     return TSS_TPMI_DH_OBJECT_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4106 }
4107 
4108 #if 0
4109 TPM_RC TPMI_DH_PARENT_Unmarshal(TPMI_DH_PARENT *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4110 {
4111     return TSS_TPMI_DH_PARENT_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4112 }
4113 #endif
4114 
TPMI_DH_PERSISTENT_Unmarshal(TPMI_DH_PERSISTENT * target,BYTE ** buffer,INT32 * size)4115 TPM_RC TPMI_DH_PERSISTENT_Unmarshal(TPMI_DH_PERSISTENT *target, BYTE **buffer, INT32 *size)
4116 {
4117     return TSS_TPMI_DH_PERSISTENT_Unmarshalu(target, buffer, (uint32_t *)size);
4118 }
4119 
TPMI_DH_ENTITY_Unmarshal(TPMI_DH_ENTITY * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4120 TPM_RC TPMI_DH_ENTITY_Unmarshal(TPMI_DH_ENTITY *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4121 {
4122     return TSS_TPMI_DH_ENTITY_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4123 }
4124 
TPMI_DH_PCR_Unmarshal(TPMI_DH_PCR * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4125 TPM_RC TPMI_DH_PCR_Unmarshal(TPMI_DH_PCR *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4126 {
4127     return TSS_TPMI_DH_PCR_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4128 }
4129 
TPMI_SH_AUTH_SESSION_Unmarshal(TPMI_SH_AUTH_SESSION * target,BYTE ** buffer,INT32 * size,BOOL allowPwd)4130 TPM_RC TPMI_SH_AUTH_SESSION_Unmarshal(TPMI_SH_AUTH_SESSION *target, BYTE **buffer, INT32 *size, BOOL allowPwd)
4131 {
4132     return TSS_TPMI_SH_AUTH_SESSION_Unmarshalu(target, buffer, (uint32_t *)size, allowPwd);
4133 }
4134 
TPMI_SH_HMAC_Unmarshal(TPMI_SH_HMAC * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4135 TPM_RC TPMI_SH_HMAC_Unmarshal(TPMI_SH_HMAC *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4136 {
4137     return TSS_TPMI_SH_HMAC_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4138 }
4139 
TPMI_SH_POLICY_Unmarshal(TPMI_SH_POLICY * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4140 TPM_RC TPMI_SH_POLICY_Unmarshal(TPMI_SH_POLICY *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4141 {
4142     return TSS_TPMI_SH_POLICY_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4143 }
4144 
TPMI_DH_CONTEXT_Unmarshal(TPMI_DH_CONTEXT * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4145 TPM_RC TPMI_DH_CONTEXT_Unmarshal(TPMI_DH_CONTEXT *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4146 {
4147     return TSS_TPMI_DH_CONTEXT_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4148 }
4149 
TPMI_RH_HIERARCHY_Unmarshal(TPMI_RH_HIERARCHY * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4150 TPM_RC TPMI_RH_HIERARCHY_Unmarshal(TPMI_RH_HIERARCHY *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4151 {
4152     return TSS_TPMI_RH_HIERARCHY_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4153 }
4154 
TPMI_RH_ENABLES_Unmarshal(TPMI_RH_ENABLES * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4155 TPM_RC TPMI_RH_ENABLES_Unmarshal(TPMI_RH_ENABLES *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4156 {
4157     return TSS_TPMI_RH_ENABLES_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4158 }
4159 
TPMI_RH_HIERARCHY_AUTH_Unmarshal(TPMI_RH_HIERARCHY_AUTH * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4160 TPM_RC TPMI_RH_HIERARCHY_AUTH_Unmarshal(TPMI_RH_HIERARCHY_AUTH *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4161 {
4162     return TSS_TPMI_RH_HIERARCHY_AUTH_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4163 }
4164 
TPMI_RH_PLATFORM_Unmarshal(TPMI_RH_PLATFORM * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4165 TPM_RC TPMI_RH_PLATFORM_Unmarshal(TPMI_RH_PLATFORM *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4166 {
4167     return TSS_TPMI_RH_PLATFORM_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4168 }
4169 
TPMI_RH_ENDORSEMENT_Unmarshal(TPMI_RH_ENDORSEMENT * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4170 TPM_RC TPMI_RH_ENDORSEMENT_Unmarshal(TPMI_RH_ENDORSEMENT *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4171 {
4172     return TSS_TPMI_RH_ENDORSEMENT_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4173 }
4174 
TPMI_RH_PROVISION_Unmarshal(TPMI_RH_PROVISION * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4175 TPM_RC TPMI_RH_PROVISION_Unmarshal(TPMI_RH_PROVISION *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4176 {
4177     return TSS_TPMI_RH_PROVISION_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4178 }
4179 
TPMI_RH_CLEAR_Unmarshal(TPMI_RH_CLEAR * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4180 TPM_RC TPMI_RH_CLEAR_Unmarshal(TPMI_RH_CLEAR *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4181 {
4182     return TSS_TPMI_RH_CLEAR_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4183 }
4184 
TPMI_RH_NV_AUTH_Unmarshal(TPMI_RH_NV_AUTH * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4185 TPM_RC TPMI_RH_NV_AUTH_Unmarshal(TPMI_RH_NV_AUTH *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4186 {
4187     return TSS_TPMI_RH_NV_AUTH_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4188 }
4189 
TPMI_RH_LOCKOUT_Unmarshal(TPMI_RH_LOCKOUT * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4190 TPM_RC TPMI_RH_LOCKOUT_Unmarshal(TPMI_RH_LOCKOUT *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4191 {
4192     return TSS_TPMI_RH_LOCKOUT_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4193 }
4194 
TPMI_RH_NV_INDEX_Unmarshal(TPMI_RH_NV_INDEX * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4195 TPM_RC TPMI_RH_NV_INDEX_Unmarshal(TPMI_RH_NV_INDEX *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4196 {
4197     return TSS_TPMI_RH_NV_INDEX_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4198 }
4199 
TPMI_ALG_HASH_Unmarshal(TPMI_ALG_HASH * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4200 TPM_RC TPMI_ALG_HASH_Unmarshal(TPMI_ALG_HASH *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4201 {
4202     return TSS_TPMI_ALG_HASH_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4203 }
4204 
TPMI_ALG_SYM_Unmarshal(TPMI_ALG_SYM * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4205 TPM_RC TPMI_ALG_SYM_Unmarshal(TPMI_ALG_SYM *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4206 {
4207     return TSS_TPMI_ALG_SYM_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4208 }
4209 
TPMI_ALG_SYM_OBJECT_Unmarshal(TPMI_ALG_SYM_OBJECT * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4210 TPM_RC TPMI_ALG_SYM_OBJECT_Unmarshal(TPMI_ALG_SYM_OBJECT *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4211 {
4212     return TSS_TPMI_ALG_SYM_OBJECT_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4213 }
4214 
TPMI_ALG_SYM_MODE_Unmarshal(TPMI_ALG_SYM_MODE * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4215 TPM_RC TPMI_ALG_SYM_MODE_Unmarshal(TPMI_ALG_SYM_MODE *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4216 {
4217     return TSS_TPMI_ALG_SYM_MODE_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4218 }
4219 
TPMI_ALG_KDF_Unmarshal(TPMI_ALG_KDF * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4220 TPM_RC TPMI_ALG_KDF_Unmarshal(TPMI_ALG_KDF *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4221 {
4222     return TSS_TPMI_ALG_KDF_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4223 }
4224 
TPMI_ALG_SIG_SCHEME_Unmarshal(TPMI_ALG_SIG_SCHEME * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4225 TPM_RC TPMI_ALG_SIG_SCHEME_Unmarshal(TPMI_ALG_SIG_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4226 {
4227     return TSS_TPMI_ALG_SIG_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4228 }
4229 
TPMI_ECC_KEY_EXCHANGE_Unmarshal(TPMI_ECC_KEY_EXCHANGE * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4230 TPM_RC TPMI_ECC_KEY_EXCHANGE_Unmarshal(TPMI_ECC_KEY_EXCHANGE *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4231 {
4232     return TSS_TPMI_ECC_KEY_EXCHANGE_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4233 }
4234 
TPMI_ST_COMMAND_TAG_Unmarshal(TPMI_ST_COMMAND_TAG * target,BYTE ** buffer,INT32 * size)4235 TPM_RC TPMI_ST_COMMAND_TAG_Unmarshal(TPMI_ST_COMMAND_TAG *target, BYTE **buffer, INT32 *size)
4236 {
4237     return TSS_TPMI_ST_COMMAND_TAG_Unmarshalu(target, buffer, (uint32_t *)size);
4238 }
4239 
TPMI_ALG_MAC_SCHEME_Unmarshal(TPMI_ALG_MAC_SCHEME * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4240 TPM_RC TPMI_ALG_MAC_SCHEME_Unmarshal(TPMI_ALG_MAC_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4241 {
4242     return TSS_TPMI_ALG_MAC_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4243 }
4244 
TPMI_ALG_CIPHER_MODE_Unmarshal(TPMI_ALG_CIPHER_MODE * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4245 TPM_RC TPMI_ALG_CIPHER_MODE_Unmarshal(TPMI_ALG_CIPHER_MODE *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4246 {
4247     return TSS_TPMI_ALG_CIPHER_MODE_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4248 }
4249 
4250 /* NOTE: Marked as const function in header */
4251 
TPMS_EMPTY_Unmarshal(TPMS_EMPTY * target,BYTE ** buffer,INT32 * size)4252 TPM_RC TPMS_EMPTY_Unmarshal(TPMS_EMPTY *target, BYTE **buffer, INT32 *size)
4253 {
4254     return TSS_TPMS_EMPTY_Unmarshalu(target, buffer, (uint32_t *)size);
4255 }
4256 
TPMU_HA_Unmarshal(TPMU_HA * target,BYTE ** buffer,INT32 * size,UINT32 selector)4257 TPM_RC TPMU_HA_Unmarshal(TPMU_HA *target, BYTE **buffer, INT32 *size, UINT32 selector)
4258 {
4259     return TSS_TPMU_HA_Unmarshalu(target, buffer, (uint32_t *)size, selector);
4260 }
4261 
TPMT_HA_Unmarshal(TPMT_HA * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4262 TPM_RC TPMT_HA_Unmarshal(TPMT_HA *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4263 {
4264     return TSS_TPMT_HA_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4265 }
4266 
TPM2B_DIGEST_Unmarshal(TPM2B_DIGEST * target,BYTE ** buffer,INT32 * size)4267 TPM_RC TPM2B_DIGEST_Unmarshal(TPM2B_DIGEST *target, BYTE **buffer, INT32 *size)
4268 {
4269     return TSS_TPM2B_DIGEST_Unmarshalu(target, buffer, (uint32_t *)size);
4270 }
4271 
TPM2B_DATA_Unmarshal(TPM2B_DATA * target,BYTE ** buffer,INT32 * size)4272 TPM_RC TPM2B_DATA_Unmarshal(TPM2B_DATA *target, BYTE **buffer, INT32 *size)
4273 {
4274     return TSS_TPM2B_DATA_Unmarshalu(target, buffer, (uint32_t *)size);
4275 }
4276 
TPM2B_NONCE_Unmarshal(TPM2B_NONCE * target,BYTE ** buffer,INT32 * size)4277 TPM_RC TPM2B_NONCE_Unmarshal(TPM2B_NONCE *target, BYTE **buffer, INT32 *size)
4278 {
4279     return TSS_TPM2B_NONCE_Unmarshalu(target, buffer, (uint32_t *)size);
4280 }
4281 
TPM2B_AUTH_Unmarshal(TPM2B_AUTH * target,BYTE ** buffer,INT32 * size)4282 TPM_RC TPM2B_AUTH_Unmarshal(TPM2B_AUTH *target, BYTE **buffer, INT32 *size)
4283 {
4284     return TSS_TPM2B_AUTH_Unmarshalu(target, buffer, (uint32_t *)size);
4285 }
4286 
TPM2B_OPERAND_Unmarshal(TPM2B_OPERAND * target,BYTE ** buffer,INT32 * size)4287 TPM_RC TPM2B_OPERAND_Unmarshal(TPM2B_OPERAND *target, BYTE **buffer, INT32 *size)
4288 {
4289     return TSS_TPM2B_OPERAND_Unmarshalu(target, buffer, (uint32_t *)size);
4290 }
4291 
TPM2B_EVENT_Unmarshal(TPM2B_EVENT * target,BYTE ** buffer,INT32 * size)4292 TPM_RC TPM2B_EVENT_Unmarshal(TPM2B_EVENT *target, BYTE **buffer, INT32 *size)
4293 {
4294     return TSS_TPM2B_EVENT_Unmarshalu(target, buffer, (uint32_t *)size);
4295 }
4296 
TPM2B_MAX_BUFFER_Unmarshal(TPM2B_MAX_BUFFER * target,BYTE ** buffer,INT32 * size)4297 TPM_RC TPM2B_MAX_BUFFER_Unmarshal(TPM2B_MAX_BUFFER *target, BYTE **buffer, INT32 *size)
4298 {
4299     return TSS_TPM2B_MAX_BUFFER_Unmarshalu(target, buffer, (uint32_t *)size);
4300 }
4301 
TPM2B_MAX_NV_BUFFER_Unmarshal(TPM2B_MAX_NV_BUFFER * target,BYTE ** buffer,INT32 * size)4302 TPM_RC TPM2B_MAX_NV_BUFFER_Unmarshal(TPM2B_MAX_NV_BUFFER *target, BYTE **buffer, INT32 *size)
4303 {
4304     return TSS_TPM2B_MAX_NV_BUFFER_Unmarshalu(target, buffer, (uint32_t *)size);
4305 }
4306 
TPM2B_TIMEOUT_Unmarshal(TPM2B_TIMEOUT * target,BYTE ** buffer,INT32 * size)4307 TPM_RC TPM2B_TIMEOUT_Unmarshal(TPM2B_TIMEOUT *target, BYTE **buffer, INT32 *size)
4308 {
4309     return TSS_TPM2B_TIMEOUT_Unmarshalu(target, buffer, (uint32_t *)size);
4310 }
4311 
TPM2B_IV_Unmarshal(TPM2B_IV * target,BYTE ** buffer,INT32 * size)4312 TPM_RC TPM2B_IV_Unmarshal(TPM2B_IV *target, BYTE **buffer, INT32 *size)
4313 {
4314     return TSS_TPM2B_IV_Unmarshalu(target, buffer, (uint32_t *)size);
4315 }
4316 
TPM2B_NAME_Unmarshal(TPM2B_NAME * target,BYTE ** buffer,INT32 * size)4317 TPM_RC TPM2B_NAME_Unmarshal(TPM2B_NAME *target, BYTE **buffer, INT32 *size)
4318 {
4319     return TSS_TPM2B_NAME_Unmarshalu(target, buffer, (uint32_t *)size);
4320 }
4321 
TPMS_PCR_SELECTION_Unmarshal(TPMS_PCR_SELECTION * target,BYTE ** buffer,INT32 * size)4322 TPM_RC TPMS_PCR_SELECTION_Unmarshal(TPMS_PCR_SELECTION *target, BYTE **buffer, INT32 *size)
4323 {
4324     return TSS_TPMS_PCR_SELECTION_Unmarshalu(target, buffer, (uint32_t *)size);
4325 }
4326 
TPMT_TK_CREATION_Unmarshal(TPMT_TK_CREATION * target,BYTE ** buffer,INT32 * size)4327 TPM_RC TPMT_TK_CREATION_Unmarshal(TPMT_TK_CREATION *target, BYTE **buffer, INT32 *size)
4328 {
4329     return TSS_TPMT_TK_CREATION_Unmarshalu(target, buffer, (uint32_t *)size);
4330 }
4331 
TPMT_TK_VERIFIED_Unmarshal(TPMT_TK_VERIFIED * target,BYTE ** buffer,INT32 * size)4332 TPM_RC TPMT_TK_VERIFIED_Unmarshal(TPMT_TK_VERIFIED *target, BYTE **buffer, INT32 *size)
4333 {
4334     return TSS_TPMT_TK_VERIFIED_Unmarshalu(target, buffer, (uint32_t *)size);
4335 }
4336 
TPMT_TK_AUTH_Unmarshal(TPMT_TK_AUTH * target,BYTE ** buffer,INT32 * size)4337 TPM_RC TPMT_TK_AUTH_Unmarshal(TPMT_TK_AUTH *target, BYTE **buffer, INT32 *size)
4338 {
4339     return TSS_TPMT_TK_AUTH_Unmarshalu(target, buffer, (uint32_t *)size);
4340 }
4341 
TPMT_TK_HASHCHECK_Unmarshal(TPMT_TK_HASHCHECK * target,BYTE ** buffer,INT32 * size)4342 TPM_RC TPMT_TK_HASHCHECK_Unmarshal(TPMT_TK_HASHCHECK *target, BYTE **buffer, INT32 *size)
4343 {
4344     return TSS_TPMT_TK_HASHCHECK_Unmarshalu(target, buffer, (uint32_t *)size);
4345 }
4346 
TPMS_ALG_PROPERTY_Unmarshal(TPMS_ALG_PROPERTY * target,BYTE ** buffer,INT32 * size)4347 TPM_RC TPMS_ALG_PROPERTY_Unmarshal(TPMS_ALG_PROPERTY *target, BYTE **buffer, INT32 *size)
4348 {
4349     return TSS_TPMS_ALG_PROPERTY_Unmarshalu(target, buffer, (uint32_t *)size);
4350 }
4351 
TPMS_TAGGED_PROPERTY_Unmarshal(TPMS_TAGGED_PROPERTY * target,BYTE ** buffer,INT32 * size)4352 TPM_RC TPMS_TAGGED_PROPERTY_Unmarshal(TPMS_TAGGED_PROPERTY *target, BYTE **buffer, INT32 *size)
4353 {
4354     return TSS_TPMS_TAGGED_PROPERTY_Unmarshalu(target, buffer, (uint32_t *)size);
4355 }
4356 
TPMS_TAGGED_PCR_SELECT_Unmarshal(TPMS_TAGGED_PCR_SELECT * target,BYTE ** buffer,INT32 * size)4357 TPM_RC TPMS_TAGGED_PCR_SELECT_Unmarshal(TPMS_TAGGED_PCR_SELECT *target, BYTE **buffer, INT32 *size)
4358 {
4359     return TSS_TPMS_TAGGED_PCR_SELECT_Unmarshalu(target, buffer, (uint32_t *)size);
4360 }
4361 
TPML_CC_Unmarshal(TPML_CC * target,BYTE ** buffer,INT32 * size)4362 TPM_RC TPML_CC_Unmarshal(TPML_CC *target, BYTE **buffer, INT32 *size)
4363 {
4364     return TSS_TPML_CC_Unmarshalu(target, buffer, (uint32_t *)size);
4365 }
4366 
TPML_CCA_Unmarshal(TPML_CCA * target,BYTE ** buffer,INT32 * size)4367 TPM_RC TPML_CCA_Unmarshal(TPML_CCA *target, BYTE **buffer, INT32 *size)
4368 {
4369     return TSS_TPML_CCA_Unmarshalu(target, buffer, (uint32_t *)size);
4370 }
4371 
TPML_ALG_Unmarshal(TPML_ALG * target,BYTE ** buffer,INT32 * size)4372 TPM_RC TPML_ALG_Unmarshal(TPML_ALG *target, BYTE **buffer, INT32 *size)
4373 {
4374     return TSS_TPML_ALG_Unmarshalu(target, buffer, (uint32_t *)size);
4375 }
4376 
TPML_HANDLE_Unmarshal(TPML_HANDLE * target,BYTE ** buffer,INT32 * size)4377 TPM_RC TPML_HANDLE_Unmarshal(TPML_HANDLE *target, BYTE **buffer, INT32 *size)
4378 {
4379     return TSS_TPML_HANDLE_Unmarshalu(target, buffer, (uint32_t *)size);
4380 }
4381 
TPML_DIGEST_Unmarshal(TPML_DIGEST * target,BYTE ** buffer,INT32 * size,uint32_t minCount)4382 TPM_RC TPML_DIGEST_Unmarshal(TPML_DIGEST *target, BYTE **buffer, INT32 *size,uint32_t minCount)
4383 {
4384     return TSS_TPML_DIGEST_Unmarshalu(target, buffer, (uint32_t *)size, minCount);
4385 }
4386 
TPML_DIGEST_VALUES_Unmarshal(TPML_DIGEST_VALUES * target,BYTE ** buffer,INT32 * size)4387 TPM_RC TPML_DIGEST_VALUES_Unmarshal(TPML_DIGEST_VALUES *target, BYTE **buffer, INT32 *size)
4388 {
4389     return TSS_TPML_DIGEST_VALUES_Unmarshalu(target, buffer, (uint32_t *)size);
4390 }
4391 
TPML_PCR_SELECTION_Unmarshal(TPML_PCR_SELECTION * target,BYTE ** buffer,INT32 * size)4392 TPM_RC TPML_PCR_SELECTION_Unmarshal(TPML_PCR_SELECTION *target, BYTE **buffer, INT32 *size)
4393 {
4394     return TSS_TPML_PCR_SELECTION_Unmarshalu(target, buffer, (uint32_t *)size);
4395 }
4396 
TPML_ALG_PROPERTY_Unmarshal(TPML_ALG_PROPERTY * target,BYTE ** buffer,INT32 * size)4397 TPM_RC TPML_ALG_PROPERTY_Unmarshal(TPML_ALG_PROPERTY *target, BYTE **buffer, INT32 *size)
4398 {
4399     return TSS_TPML_ALG_PROPERTY_Unmarshalu(target, buffer, (uint32_t *)size);
4400 }
4401 
TPML_TAGGED_TPM_PROPERTY_Unmarshal(TPML_TAGGED_TPM_PROPERTY * target,BYTE ** buffer,INT32 * size)4402 TPM_RC TPML_TAGGED_TPM_PROPERTY_Unmarshal(TPML_TAGGED_TPM_PROPERTY  *target, BYTE **buffer, INT32 *size)
4403 {
4404     return TSS_TPML_TAGGED_TPM_PROPERTY_Unmarshalu(target, buffer, (uint32_t *)size);
4405 }
4406 
TPML_TAGGED_PCR_PROPERTY_Unmarshal(TPML_TAGGED_PCR_PROPERTY * target,BYTE ** buffer,INT32 * size)4407 TPM_RC TPML_TAGGED_PCR_PROPERTY_Unmarshal(TPML_TAGGED_PCR_PROPERTY  *target, BYTE **buffer, INT32 *size)
4408 {
4409     return TSS_TPML_TAGGED_PCR_PROPERTY_Unmarshalu(target, buffer, (uint32_t *)size);
4410 }
4411 
TPML_ECC_CURVE_Unmarshal(TPML_ECC_CURVE * target,BYTE ** buffer,INT32 * size)4412 TPM_RC TPML_ECC_CURVE_Unmarshal(TPML_ECC_CURVE *target, BYTE **buffer, INT32 *size)
4413 {
4414     return TSS_TPML_ECC_CURVE_Unmarshalu(target, buffer, (uint32_t *)size);
4415 }
4416 
4417 #if 0
4418 TPM_RC TPML_TAGGED_POLICY_Unmarshal(TPML_TAGGED_POLICY *target, BYTE **buffer, INT32 *size)
4419 {
4420     return TSS_TPML_TAGGED_POLICY_Unmarshalu(target, buffer, (uint32_t *)size);
4421 }
4422 #endif
4423 
TPMU_CAPABILITIES_Unmarshal(TPMU_CAPABILITIES * target,BYTE ** buffer,INT32 * size,UINT32 selector)4424 TPM_RC TPMU_CAPABILITIES_Unmarshal(TPMU_CAPABILITIES *target, BYTE **buffer, INT32 *size, UINT32 selector)
4425 {
4426     return TSS_TPMU_CAPABILITIES_Unmarshalu(target, buffer, (uint32_t *)size, selector);
4427 }
4428 
TPMS_CLOCK_INFO_Unmarshal(TPMS_CLOCK_INFO * target,BYTE ** buffer,INT32 * size)4429 TPM_RC TPMS_CLOCK_INFO_Unmarshal(TPMS_CLOCK_INFO *target, BYTE **buffer, INT32 *size)
4430 {
4431     return TSS_TPMS_CLOCK_INFO_Unmarshalu(target, buffer, (uint32_t *)size);
4432 }
4433 
TPMS_TIME_INFO_Unmarshal(TPMS_TIME_INFO * target,BYTE ** buffer,INT32 * size)4434 TPM_RC TPMS_TIME_INFO_Unmarshal(TPMS_TIME_INFO *target, BYTE **buffer, INT32 *size)
4435 {
4436     return TSS_TPMS_TIME_INFO_Unmarshalu(target, buffer, (uint32_t *)size);
4437 }
4438 
TPMS_TIME_ATTEST_INFO_Unmarshal(TPMS_TIME_ATTEST_INFO * target,BYTE ** buffer,INT32 * size)4439 TPM_RC TPMS_TIME_ATTEST_INFO_Unmarshal(TPMS_TIME_ATTEST_INFO *target, BYTE **buffer, INT32 *size)
4440 {
4441     return TSS_TPMS_TIME_ATTEST_INFO_Unmarshalu(target, buffer, (uint32_t *)size);
4442 }
4443 
TPMS_CERTIFY_INFO_Unmarshal(TPMS_CERTIFY_INFO * target,BYTE ** buffer,INT32 * size)4444 TPM_RC TPMS_CERTIFY_INFO_Unmarshal(TPMS_CERTIFY_INFO *target, BYTE **buffer, INT32 *size)
4445 {
4446     return TSS_TPMS_CERTIFY_INFO_Unmarshalu(target, buffer, (uint32_t *)size);
4447 }
4448 
TPMS_QUOTE_INFO_Unmarshal(TPMS_QUOTE_INFO * target,BYTE ** buffer,INT32 * size)4449 TPM_RC TPMS_QUOTE_INFO_Unmarshal(TPMS_QUOTE_INFO *target, BYTE **buffer, INT32 *size)
4450 {
4451     return TSS_TPMS_QUOTE_INFO_Unmarshalu(target, buffer, (uint32_t *)size);
4452 }
4453 
TPMS_COMMAND_AUDIT_INFO_Unmarshal(TPMS_COMMAND_AUDIT_INFO * target,BYTE ** buffer,INT32 * size)4454 TPM_RC TPMS_COMMAND_AUDIT_INFO_Unmarshal(TPMS_COMMAND_AUDIT_INFO *target, BYTE **buffer, INT32 *size)
4455 {
4456     return TSS_TPMS_COMMAND_AUDIT_INFO_Unmarshalu(target, buffer, (uint32_t *)size);
4457 }
4458 
TPMS_SESSION_AUDIT_INFO_Unmarshal(TPMS_SESSION_AUDIT_INFO * target,BYTE ** buffer,INT32 * size)4459 TPM_RC TPMS_SESSION_AUDIT_INFO_Unmarshal(TPMS_SESSION_AUDIT_INFO *target, BYTE **buffer, INT32 *size)
4460 {
4461     return TSS_TPMS_SESSION_AUDIT_INFO_Unmarshalu(target, buffer, (uint32_t *)size);
4462 }
4463 
TPMS_CREATION_INFO_Unmarshal(TPMS_CREATION_INFO * target,BYTE ** buffer,INT32 * size)4464 TPM_RC TPMS_CREATION_INFO_Unmarshal(TPMS_CREATION_INFO *target, BYTE **buffer, INT32 *size)
4465 {
4466     return TSS_TPMS_CREATION_INFO_Unmarshalu(target, buffer, (uint32_t *)size);
4467 }
4468 
TPMS_NV_CERTIFY_INFO_Unmarshal(TPMS_NV_CERTIFY_INFO * target,BYTE ** buffer,INT32 * size)4469 TPM_RC TPMS_NV_CERTIFY_INFO_Unmarshal(TPMS_NV_CERTIFY_INFO *target, BYTE **buffer, INT32 *size)
4470 {
4471     return TSS_TPMS_NV_CERTIFY_INFO_Unmarshalu(target, buffer, (uint32_t *)size);
4472 }
4473 
TPMI_ST_ATTEST_Unmarshal(TPMI_ST_ATTEST * target,BYTE ** buffer,INT32 * size)4474 TPM_RC TPMI_ST_ATTEST_Unmarshal(TPMI_ST_ATTEST *target, BYTE **buffer, INT32 *size)
4475 {
4476     return TSS_TPMI_ST_ATTEST_Unmarshalu(target, buffer, (uint32_t *)size);
4477 }
4478 
TPMU_ATTEST_Unmarshal(TPMU_ATTEST * target,BYTE ** buffer,INT32 * size,UINT32 selector)4479 TPM_RC TPMU_ATTEST_Unmarshal(TPMU_ATTEST *target, BYTE **buffer, INT32 *size, UINT32 selector)
4480 {
4481     return TSS_TPMU_ATTEST_Unmarshalu(target, buffer, (uint32_t *)size, selector);
4482 }
4483 
TPMS_ATTEST_Unmarshal(TPMS_ATTEST * target,BYTE ** buffer,INT32 * size)4484 TPM_RC TPMS_ATTEST_Unmarshal(TPMS_ATTEST *target, BYTE **buffer, INT32 *size)
4485 {
4486     return TSS_TPMS_ATTEST_Unmarshalu(target, buffer, (uint32_t *)size);
4487 }
4488 
TPM2B_ATTEST_Unmarshal(TPM2B_ATTEST * target,BYTE ** buffer,INT32 * size)4489 TPM_RC TPM2B_ATTEST_Unmarshal(TPM2B_ATTEST *target, BYTE **buffer, INT32 *size)
4490 {
4491     return TSS_TPM2B_ATTEST_Unmarshalu(target, buffer, (uint32_t *)size);
4492 }
4493 
TPMS_CAPABILITY_DATA_Unmarshal(TPMS_CAPABILITY_DATA * target,BYTE ** buffer,INT32 * size)4494 TPM_RC TPMS_CAPABILITY_DATA_Unmarshal(TPMS_CAPABILITY_DATA *target, BYTE **buffer, INT32 *size)
4495 {
4496     return TSS_TPMS_CAPABILITY_DATA_Unmarshalu(target, buffer, (uint32_t *)size);
4497 }
4498 
TPMS_AUTH_RESPONSE_Unmarshal(TPMS_AUTH_RESPONSE * target,BYTE ** buffer,INT32 * size)4499 TPM_RC TPMS_AUTH_RESPONSE_Unmarshal(TPMS_AUTH_RESPONSE *target, BYTE **buffer, INT32 *size)
4500 {
4501     return TSS_TPMS_AUTH_RESPONSE_Unmarshalu(target, buffer, (uint32_t *)size);
4502 }
4503 
TPMI_AES_KEY_BITS_Unmarshal(TPMI_AES_KEY_BITS * target,BYTE ** buffer,INT32 * size)4504 TPM_RC TPMI_AES_KEY_BITS_Unmarshal(TPMI_AES_KEY_BITS *target, BYTE **buffer, INT32 *size)
4505 {
4506     return TSS_TPMI_AES_KEY_BITS_Unmarshalu(target, buffer, (uint32_t *)size);
4507 }
4508 
TPMU_SYM_KEY_BITS_Unmarshal(TPMU_SYM_KEY_BITS * target,BYTE ** buffer,INT32 * size,UINT32 selector)4509 TPM_RC TPMU_SYM_KEY_BITS_Unmarshal(TPMU_SYM_KEY_BITS *target, BYTE **buffer, INT32 *size, UINT32 selector)
4510 {
4511     return TSS_TPMU_SYM_KEY_BITS_Unmarshalu(target, buffer, (uint32_t *)size, selector);
4512 }
4513 
TPMU_SYM_MODE_Unmarshal(TPMU_SYM_MODE * target,BYTE ** buffer,INT32 * size,UINT32 selector)4514 TPM_RC TPMU_SYM_MODE_Unmarshal(TPMU_SYM_MODE *target, BYTE **buffer, INT32 *size, UINT32 selector)
4515 {
4516     return TSS_TPMU_SYM_MODE_Unmarshalu(target, buffer, (uint32_t *)size, selector);
4517 }
4518 
TPMT_SYM_DEF_Unmarshal(TPMT_SYM_DEF * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4519 TPM_RC TPMT_SYM_DEF_Unmarshal(TPMT_SYM_DEF *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4520 {
4521     return TSS_TPMT_SYM_DEF_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4522 }
4523 
TPMT_SYM_DEF_OBJECT_Unmarshal(TPMT_SYM_DEF_OBJECT * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4524 TPM_RC TPMT_SYM_DEF_OBJECT_Unmarshal(TPMT_SYM_DEF_OBJECT *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4525 {
4526     return TSS_TPMT_SYM_DEF_OBJECT_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4527 }
4528 
TPM2B_SYM_KEY_Unmarshal(TPM2B_SYM_KEY * target,BYTE ** buffer,INT32 * size)4529 TPM_RC TPM2B_SYM_KEY_Unmarshal(TPM2B_SYM_KEY *target, BYTE **buffer, INT32 *size)
4530 {
4531     return TSS_TPM2B_SYM_KEY_Unmarshalu(target, buffer, (uint32_t *)size);
4532 }
4533 
TPMS_SYMCIPHER_PARMS_Unmarshal(TPMS_SYMCIPHER_PARMS * target,BYTE ** buffer,INT32 * size)4534 TPM_RC TPMS_SYMCIPHER_PARMS_Unmarshal(TPMS_SYMCIPHER_PARMS *target, BYTE **buffer, INT32 *size)
4535 {
4536     return TSS_TPMS_SYMCIPHER_PARMS_Unmarshalu(target, buffer, (uint32_t *)size);
4537 }
4538 
4539 #if 0
4540 TPM_RC TPM2B_LABEL_Unmarshal(TPM2B_LABEL *target, BYTE **buffer, INT32 *size)
4541 {
4542     return TSS_TPM2B_LABEL_Unmarshalu(target, buffer, (uint32_t *)size);
4543 }
4544 #endif
4545 
TPM2B_SENSITIVE_DATA_Unmarshal(TPM2B_SENSITIVE_DATA * target,BYTE ** buffer,INT32 * size)4546 TPM_RC TPM2B_SENSITIVE_DATA_Unmarshal(TPM2B_SENSITIVE_DATA *target, BYTE **buffer, INT32 *size)
4547 {
4548     return TSS_TPM2B_SENSITIVE_DATA_Unmarshalu(target, buffer, (uint32_t *)size);
4549 }
4550 
TPMS_SENSITIVE_CREATE_Unmarshal(TPMS_SENSITIVE_CREATE * target,BYTE ** buffer,INT32 * size)4551 TPM_RC TPMS_SENSITIVE_CREATE_Unmarshal(TPMS_SENSITIVE_CREATE *target, BYTE **buffer, INT32 *size)
4552 {
4553     return TSS_TPMS_SENSITIVE_CREATE_Unmarshalu(target, buffer, (uint32_t *)size);
4554 }
4555 
TPM2B_SENSITIVE_CREATE_Unmarshal(TPM2B_SENSITIVE_CREATE * target,BYTE ** buffer,INT32 * size)4556 TPM_RC TPM2B_SENSITIVE_CREATE_Unmarshal(TPM2B_SENSITIVE_CREATE *target, BYTE **buffer, INT32 *size)
4557 {
4558     return TSS_TPM2B_SENSITIVE_CREATE_Unmarshalu(target, buffer, (uint32_t *)size);
4559 }
4560 
TPMS_SCHEME_HASH_Unmarshal(TPMS_SCHEME_HASH * target,BYTE ** buffer,INT32 * size)4561 TPM_RC TPMS_SCHEME_HASH_Unmarshal(TPMS_SCHEME_HASH *target, BYTE **buffer, INT32 *size)
4562 {
4563     return TSS_TPMS_SCHEME_HASH_Unmarshalu(target, buffer, (uint32_t *)size);
4564 }
4565 
TPMS_SCHEME_ECDAA_Unmarshal(TPMS_SCHEME_ECDAA * target,BYTE ** buffer,INT32 * size)4566 TPM_RC TPMS_SCHEME_ECDAA_Unmarshal(TPMS_SCHEME_ECDAA *target, BYTE **buffer, INT32 *size)
4567 {
4568     return TSS_TPMS_SCHEME_ECDAA_Unmarshalu(target, buffer, (uint32_t *)size);
4569 }
4570 
TPMI_ALG_KEYEDHASH_SCHEME_Unmarshal(TPMI_ALG_KEYEDHASH_SCHEME * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4571 TPM_RC TPMI_ALG_KEYEDHASH_SCHEME_Unmarshal(TPMI_ALG_KEYEDHASH_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4572 {
4573     return TSS_TPMI_ALG_KEYEDHASH_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4574 }
4575 
TPMS_SCHEME_HMAC_Unmarshal(TPMS_SCHEME_HMAC * target,BYTE ** buffer,INT32 * size)4576 TPM_RC TPMS_SCHEME_HMAC_Unmarshal(TPMS_SCHEME_HMAC *target, BYTE **buffer, INT32 *size)
4577 {
4578     return TSS_TPMS_SCHEME_HMAC_Unmarshalu(target, buffer, (uint32_t *)size);
4579 }
4580 
TPMS_SCHEME_XOR_Unmarshal(TPMS_SCHEME_XOR * target,BYTE ** buffer,INT32 * size)4581 TPM_RC TPMS_SCHEME_XOR_Unmarshal(TPMS_SCHEME_XOR *target, BYTE **buffer, INT32 *size)
4582 {
4583     return TSS_TPMS_SCHEME_XOR_Unmarshalu(target, buffer, (uint32_t *)size);
4584 }
4585 
TPMU_SCHEME_KEYEDHASH_Unmarshal(TPMU_SCHEME_KEYEDHASH * target,BYTE ** buffer,INT32 * size,UINT32 selector)4586 TPM_RC TPMU_SCHEME_KEYEDHASH_Unmarshal(TPMU_SCHEME_KEYEDHASH *target, BYTE **buffer, INT32 *size, UINT32 selector)
4587 {
4588     return TSS_TPMU_SCHEME_KEYEDHASH_Unmarshalu(target, buffer, (uint32_t *)size, selector);
4589 }
4590 
TPMT_KEYEDHASH_SCHEME_Unmarshal(TPMT_KEYEDHASH_SCHEME * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4591 TPM_RC TPMT_KEYEDHASH_SCHEME_Unmarshal(TPMT_KEYEDHASH_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4592 {
4593     return TSS_TPMT_KEYEDHASH_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4594 }
4595 
TPMS_SIG_SCHEME_ECDAA_Unmarshal(TPMS_SIG_SCHEME_ECDAA * target,BYTE ** buffer,INT32 * size)4596 TPM_RC TPMS_SIG_SCHEME_ECDAA_Unmarshal(TPMS_SIG_SCHEME_ECDAA *target, BYTE **buffer, INT32 *size)
4597 {
4598     return TSS_TPMS_SIG_SCHEME_ECDAA_Unmarshalu(target, buffer, (uint32_t *)size);
4599 }
4600 
TPMS_SIG_SCHEME_ECDSA_Unmarshal(TPMS_SIG_SCHEME_ECDSA * target,BYTE ** buffer,INT32 * size)4601 TPM_RC TPMS_SIG_SCHEME_ECDSA_Unmarshal(TPMS_SIG_SCHEME_ECDSA *target, BYTE **buffer, INT32 *size)
4602 {
4603     return TSS_TPMS_SIG_SCHEME_ECDSA_Unmarshalu(target, buffer, (uint32_t *)size);
4604 }
4605 
TPMS_SIG_SCHEME_ECSCHNORR_Unmarshal(TPMS_SIG_SCHEME_ECSCHNORR * target,BYTE ** buffer,INT32 * size)4606 TPM_RC TPMS_SIG_SCHEME_ECSCHNORR_Unmarshal(TPMS_SIG_SCHEME_ECSCHNORR *target, BYTE **buffer, INT32 *size)
4607 {
4608     return TSS_TPMS_SIG_SCHEME_ECSCHNORR_Unmarshalu(target, buffer, (uint32_t *)size);
4609 }
4610 
TPMS_SIG_SCHEME_RSAPSS_Unmarshal(TPMS_SIG_SCHEME_RSAPSS * target,BYTE ** buffer,INT32 * size)4611 TPM_RC TPMS_SIG_SCHEME_RSAPSS_Unmarshal(TPMS_SIG_SCHEME_RSAPSS *target, BYTE **buffer, INT32 *size)
4612 {
4613     return TSS_TPMS_SIG_SCHEME_RSAPSS_Unmarshalu(target, buffer, (uint32_t *)size);
4614 }
4615 
TPMS_SIG_SCHEME_RSASSA_Unmarshal(TPMS_SIG_SCHEME_RSASSA * target,BYTE ** buffer,INT32 * size)4616 TPM_RC TPMS_SIG_SCHEME_RSASSA_Unmarshal(TPMS_SIG_SCHEME_RSASSA *target, BYTE **buffer, INT32 *size)
4617 {
4618     return TSS_TPMS_SIG_SCHEME_RSASSA_Unmarshalu(target, buffer, (uint32_t *)size);
4619 }
4620 
TPMS_SIG_SCHEME_SM2_Unmarshal(TPMS_SIG_SCHEME_SM2 * target,BYTE ** buffer,INT32 * size)4621 TPM_RC TPMS_SIG_SCHEME_SM2_Unmarshal(TPMS_SIG_SCHEME_SM2 *target, BYTE **buffer, INT32 *size)
4622 {
4623     return TSS_TPMS_SIG_SCHEME_SM2_Unmarshalu(target, buffer, (uint32_t *)size);
4624 }
4625 
TPMU_SIG_SCHEME_Unmarshal(TPMU_SIG_SCHEME * target,BYTE ** buffer,INT32 * size,UINT32 selector)4626 TPM_RC TPMU_SIG_SCHEME_Unmarshal(TPMU_SIG_SCHEME *target, BYTE **buffer, INT32 *size, UINT32 selector)
4627 {
4628     return TSS_TPMU_SIG_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, selector);
4629 }
4630 
TPMT_SIG_SCHEME_Unmarshal(TPMT_SIG_SCHEME * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4631 TPM_RC TPMT_SIG_SCHEME_Unmarshal(TPMT_SIG_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4632 {
4633     return TSS_TPMT_SIG_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4634 }
4635 
TPMS_ENC_SCHEME_OAEP_Unmarshal(TPMS_ENC_SCHEME_OAEP * target,BYTE ** buffer,INT32 * size)4636 TPM_RC TPMS_ENC_SCHEME_OAEP_Unmarshal(TPMS_ENC_SCHEME_OAEP *target, BYTE **buffer, INT32 *size)
4637 {
4638     return TSS_TPMS_ENC_SCHEME_OAEP_Unmarshalu(target, buffer, (uint32_t *)size);
4639 }
4640 
4641 /* NOTE: Marked as const function in header */
4642 
TPMS_ENC_SCHEME_RSAES_Unmarshal(TPMS_ENC_SCHEME_RSAES * target,BYTE ** buffer,INT32 * size)4643 TPM_RC TPMS_ENC_SCHEME_RSAES_Unmarshal(TPMS_ENC_SCHEME_RSAES *target, BYTE **buffer, INT32 *size)
4644 {
4645     return TSS_TPMS_ENC_SCHEME_RSAES_Unmarshalu(target, buffer, (uint32_t *)size);
4646 }
4647 
TPMS_KEY_SCHEME_ECDH_Unmarshal(TPMS_KEY_SCHEME_ECDH * target,BYTE ** buffer,INT32 * size)4648 TPM_RC TPMS_KEY_SCHEME_ECDH_Unmarshal(TPMS_KEY_SCHEME_ECDH *target, BYTE **buffer, INT32 *size)
4649 {
4650     return TSS_TPMS_KEY_SCHEME_ECDH_Unmarshalu(target, buffer, (uint32_t *)size);
4651 }
4652 
TPMS_KEY_SCHEME_ECMQV_Unmarshal(TPMS_KEY_SCHEME_ECMQV * target,BYTE ** buffer,INT32 * size)4653 TPM_RC TPMS_KEY_SCHEME_ECMQV_Unmarshal(TPMS_KEY_SCHEME_ECMQV *target, BYTE **buffer, INT32 *size)
4654 {
4655     return TSS_TPMS_KEY_SCHEME_ECMQV_Unmarshalu(target, buffer, (uint32_t *)size);
4656 }
4657 
TPMS_SCHEME_KDF1_SP800_108_Unmarshal(TPMS_SCHEME_KDF1_SP800_108 * target,BYTE ** buffer,INT32 * size)4658 TPM_RC TPMS_SCHEME_KDF1_SP800_108_Unmarshal(TPMS_SCHEME_KDF1_SP800_108 *target, BYTE **buffer, INT32 *size)
4659 {
4660     return TSS_TPMS_SCHEME_KDF1_SP800_108_Unmarshalu(target, buffer, (uint32_t *)size);
4661 }
4662 
TPMS_SCHEME_KDF1_SP800_56A_Unmarshal(TPMS_SCHEME_KDF1_SP800_56A * target,BYTE ** buffer,INT32 * size)4663 TPM_RC TPMS_SCHEME_KDF1_SP800_56A_Unmarshal(TPMS_SCHEME_KDF1_SP800_56A *target, BYTE **buffer, INT32 *size)
4664 {
4665     return TSS_TPMS_SCHEME_KDF1_SP800_56A_Unmarshalu(target, buffer, (uint32_t *)size);
4666 }
4667 
TPMS_SCHEME_KDF2_Unmarshal(TPMS_SCHEME_KDF2 * target,BYTE ** buffer,INT32 * size)4668 TPM_RC TPMS_SCHEME_KDF2_Unmarshal(TPMS_SCHEME_KDF2 *target, BYTE **buffer, INT32 *size)
4669 {
4670     return TSS_TPMS_SCHEME_KDF2_Unmarshalu(target, buffer, (uint32_t *)size);
4671 }
4672 
TPMS_SCHEME_MGF1_Unmarshal(TPMS_SCHEME_MGF1 * target,BYTE ** buffer,INT32 * size)4673 TPM_RC TPMS_SCHEME_MGF1_Unmarshal(TPMS_SCHEME_MGF1 *target, BYTE **buffer, INT32 *size)
4674 {
4675     return TSS_TPMS_SCHEME_MGF1_Unmarshalu(target, buffer, (uint32_t *)size);
4676 }
4677 
TPMU_KDF_SCHEME_Unmarshal(TPMU_KDF_SCHEME * target,BYTE ** buffer,INT32 * size,UINT32 selector)4678 TPM_RC TPMU_KDF_SCHEME_Unmarshal(TPMU_KDF_SCHEME *target, BYTE **buffer, INT32 *size, UINT32 selector)
4679 {
4680     return TSS_TPMU_KDF_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, selector);
4681 }
4682 
TPMT_KDF_SCHEME_Unmarshal(TPMT_KDF_SCHEME * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4683 TPM_RC TPMT_KDF_SCHEME_Unmarshal(TPMT_KDF_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4684 {
4685     return TSS_TPMT_KDF_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4686 }
4687 
4688 #if 0
4689 TPM_RC TPMI_ALG_ASYM_SCHEME_Unmarshal(TPMI_ALG_ASYM_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4690 {
4691     return TSS_TPMI_ALG_ASYM_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4692 }
4693 #endif
4694 
TPMU_ASYM_SCHEME_Unmarshal(TPMU_ASYM_SCHEME * target,BYTE ** buffer,INT32 * size,UINT32 selector)4695 TPM_RC TPMU_ASYM_SCHEME_Unmarshal(TPMU_ASYM_SCHEME *target, BYTE **buffer, INT32 *size, UINT32 selector)
4696 {
4697     return TSS_TPMU_ASYM_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, selector);
4698 }
4699 
4700 #if 0
4701 TPM_RC TPMT_ASYM_SCHEME_Unmarshal(TPMT_ASYM_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4702 {
4703     return TSS_TPMT_ASYM_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4704 }
4705 #endif
4706 
TPMI_ALG_RSA_SCHEME_Unmarshal(TPMI_ALG_RSA_SCHEME * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4707 TPM_RC TPMI_ALG_RSA_SCHEME_Unmarshal(TPMI_ALG_RSA_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4708 {
4709     return TSS_TPMI_ALG_RSA_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4710 }
4711 
TPMT_RSA_SCHEME_Unmarshal(TPMT_RSA_SCHEME * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4712 TPM_RC TPMT_RSA_SCHEME_Unmarshal(TPMT_RSA_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4713 {
4714     return TSS_TPMT_RSA_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4715 }
4716 
TPMI_ALG_RSA_DECRYPT_Unmarshal(TPMI_ALG_RSA_DECRYPT * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4717 TPM_RC TPMI_ALG_RSA_DECRYPT_Unmarshal(TPMI_ALG_RSA_DECRYPT *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4718 {
4719     return TSS_TPMI_ALG_RSA_DECRYPT_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4720 }
4721 
TPMT_RSA_DECRYPT_Unmarshal(TPMT_RSA_DECRYPT * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4722 TPM_RC TPMT_RSA_DECRYPT_Unmarshal(TPMT_RSA_DECRYPT *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4723 {
4724     return TSS_TPMT_RSA_DECRYPT_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4725 }
4726 
TPM2B_PUBLIC_KEY_RSA_Unmarshal(TPM2B_PUBLIC_KEY_RSA * target,BYTE ** buffer,INT32 * size)4727 TPM_RC TPM2B_PUBLIC_KEY_RSA_Unmarshal(TPM2B_PUBLIC_KEY_RSA *target, BYTE **buffer, INT32 *size)
4728 {
4729     return TSS_TPM2B_PUBLIC_KEY_RSA_Unmarshalu(target, buffer, (uint32_t *)size);
4730 }
4731 
TPMI_RSA_KEY_BITS_Unmarshal(TPMI_RSA_KEY_BITS * target,BYTE ** buffer,INT32 * size)4732 TPM_RC TPMI_RSA_KEY_BITS_Unmarshal(TPMI_RSA_KEY_BITS *target, BYTE **buffer, INT32 *size)
4733 {
4734     return TSS_TPMI_RSA_KEY_BITS_Unmarshalu(target, buffer, (uint32_t *)size);
4735 }
4736 
TPM2B_PRIVATE_KEY_RSA_Unmarshal(TPM2B_PRIVATE_KEY_RSA * target,BYTE ** buffer,INT32 * size)4737 TPM_RC TPM2B_PRIVATE_KEY_RSA_Unmarshal(TPM2B_PRIVATE_KEY_RSA *target, BYTE **buffer, INT32 *size)
4738 {
4739     return TSS_TPM2B_PRIVATE_KEY_RSA_Unmarshalu(target, buffer, (uint32_t *)size);
4740 }
4741 
TPM2B_ECC_PARAMETER_Unmarshal(TPM2B_ECC_PARAMETER * target,BYTE ** buffer,INT32 * size)4742 TPM_RC TPM2B_ECC_PARAMETER_Unmarshal(TPM2B_ECC_PARAMETER *target, BYTE **buffer, INT32 *size)
4743 {
4744     return TSS_TPM2B_ECC_PARAMETER_Unmarshalu(target, buffer, (uint32_t *)size);
4745 }
4746 
TPMS_ECC_POINT_Unmarshal(TPMS_ECC_POINT * target,BYTE ** buffer,INT32 * size)4747 TPM_RC TPMS_ECC_POINT_Unmarshal(TPMS_ECC_POINT *target, BYTE **buffer, INT32 *size)
4748 {
4749     return TSS_TPMS_ECC_POINT_Unmarshalu(target, buffer, (uint32_t *)size);
4750 }
4751 
TPM2B_ECC_POINT_Unmarshal(TPM2B_ECC_POINT * target,BYTE ** buffer,INT32 * size)4752 TPM_RC TPM2B_ECC_POINT_Unmarshal(TPM2B_ECC_POINT *target, BYTE **buffer, INT32 *size)
4753 {
4754     return TSS_TPM2B_ECC_POINT_Unmarshalu(target, buffer, (uint32_t *)size);
4755 }
4756 
TPMI_ALG_ECC_SCHEME_Unmarshal(TPMI_ALG_ECC_SCHEME * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4757 TPM_RC TPMI_ALG_ECC_SCHEME_Unmarshal(TPMI_ALG_ECC_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4758 {
4759     return TSS_TPMI_ALG_ECC_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4760 }
4761 
TPMI_ECC_CURVE_Unmarshal(TPMI_ECC_CURVE * target,BYTE ** buffer,INT32 * size)4762 TPM_RC TPMI_ECC_CURVE_Unmarshal(TPMI_ECC_CURVE *target, BYTE **buffer, INT32 *size)
4763 {
4764     return TSS_TPMI_ECC_CURVE_Unmarshalu(target, buffer, (uint32_t *)size);
4765 }
4766 
TPMT_ECC_SCHEME_Unmarshal(TPMT_ECC_SCHEME * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4767 TPM_RC TPMT_ECC_SCHEME_Unmarshal(TPMT_ECC_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4768 {
4769     return TSS_TPMT_ECC_SCHEME_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4770 }
4771 
TPMS_ALGORITHM_DETAIL_ECC_Unmarshal(TPMS_ALGORITHM_DETAIL_ECC * target,BYTE ** buffer,INT32 * size)4772 TPM_RC TPMS_ALGORITHM_DETAIL_ECC_Unmarshal(TPMS_ALGORITHM_DETAIL_ECC *target, BYTE **buffer, INT32 *size)
4773 {
4774     return TSS_TPMS_ALGORITHM_DETAIL_ECC_Unmarshalu(target, buffer, (uint32_t *)size);
4775 }
4776 
TPMS_SIGNATURE_RSA_Unmarshal(TPMS_SIGNATURE_RSA * target,BYTE ** buffer,INT32 * size)4777 TPM_RC TPMS_SIGNATURE_RSA_Unmarshal(TPMS_SIGNATURE_RSA *target, BYTE **buffer, INT32 *size)
4778 {
4779     return TSS_TPMS_SIGNATURE_RSA_Unmarshalu(target, buffer, (uint32_t *)size);
4780 }
4781 
TPMS_SIGNATURE_RSASSA_Unmarshal(TPMS_SIGNATURE_RSASSA * target,BYTE ** buffer,INT32 * size)4782 TPM_RC TPMS_SIGNATURE_RSASSA_Unmarshal(TPMS_SIGNATURE_RSASSA *target, BYTE **buffer, INT32 *size)
4783 {
4784     return TSS_TPMS_SIGNATURE_RSASSA_Unmarshalu(target, buffer, (uint32_t *)size);
4785 }
4786 
TPMS_SIGNATURE_RSAPSS_Unmarshal(TPMS_SIGNATURE_RSAPSS * target,BYTE ** buffer,INT32 * size)4787 TPM_RC TPMS_SIGNATURE_RSAPSS_Unmarshal(TPMS_SIGNATURE_RSAPSS *target, BYTE **buffer, INT32 *size)
4788 {
4789     return TSS_TPMS_SIGNATURE_RSAPSS_Unmarshalu(target, buffer, (uint32_t *)size);
4790 }
4791 
TPMS_SIGNATURE_ECC_Unmarshal(TPMS_SIGNATURE_ECC * target,BYTE ** buffer,INT32 * size)4792 TPM_RC TPMS_SIGNATURE_ECC_Unmarshal(TPMS_SIGNATURE_ECC *target, BYTE **buffer, INT32 *size)
4793 {
4794     return TSS_TPMS_SIGNATURE_ECC_Unmarshalu(target, buffer, (uint32_t *)size);
4795 }
4796 
TPMS_SIGNATURE_ECDSA_Unmarshal(TPMS_SIGNATURE_ECDSA * target,BYTE ** buffer,INT32 * size)4797 TPM_RC TPMS_SIGNATURE_ECDSA_Unmarshal(TPMS_SIGNATURE_ECDSA *target, BYTE **buffer, INT32 *size)
4798 {
4799     return TSS_TPMS_SIGNATURE_ECDSA_Unmarshalu(target, buffer, (uint32_t *)size);
4800 }
4801 
TPMS_SIGNATURE_ECDAA_Unmarshal(TPMS_SIGNATURE_ECDAA * target,BYTE ** buffer,INT32 * size)4802 TPM_RC TPMS_SIGNATURE_ECDAA_Unmarshal(TPMS_SIGNATURE_ECDAA *target, BYTE **buffer, INT32 *size)
4803 {
4804     return TSS_TPMS_SIGNATURE_ECDAA_Unmarshalu(target, buffer, (uint32_t *)size);
4805 }
4806 
TPMS_SIGNATURE_SM2_Unmarshal(TPMS_SIGNATURE_SM2 * target,BYTE ** buffer,INT32 * size)4807 TPM_RC TPMS_SIGNATURE_SM2_Unmarshal(TPMS_SIGNATURE_SM2 *target, BYTE **buffer, INT32 *size)
4808 {
4809     return TSS_TPMS_SIGNATURE_SM2_Unmarshalu(target, buffer, (uint32_t *)size);
4810 }
4811 
TPMS_SIGNATURE_ECSCHNORR_Unmarshal(TPMS_SIGNATURE_ECSCHNORR * target,BYTE ** buffer,INT32 * size)4812 TPM_RC TPMS_SIGNATURE_ECSCHNORR_Unmarshal(TPMS_SIGNATURE_ECSCHNORR *target, BYTE **buffer, INT32 *size)
4813 {
4814     return TSS_TPMS_SIGNATURE_ECSCHNORR_Unmarshalu(target, buffer, (uint32_t *)size);
4815 }
4816 
TPMU_SIGNATURE_Unmarshal(TPMU_SIGNATURE * target,BYTE ** buffer,INT32 * size,UINT32 selector)4817 TPM_RC TPMU_SIGNATURE_Unmarshal(TPMU_SIGNATURE *target, BYTE **buffer, INT32 *size, UINT32 selector)
4818 {
4819     return TSS_TPMU_SIGNATURE_Unmarshalu(target, buffer, (uint32_t *)size, selector);
4820 }
4821 
TPMT_SIGNATURE_Unmarshal(TPMT_SIGNATURE * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4822 TPM_RC TPMT_SIGNATURE_Unmarshal(TPMT_SIGNATURE *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4823 {
4824     return TSS_TPMT_SIGNATURE_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4825 }
4826 
TPM2B_ENCRYPTED_SECRET_Unmarshal(TPM2B_ENCRYPTED_SECRET * target,BYTE ** buffer,INT32 * size)4827 TPM_RC TPM2B_ENCRYPTED_SECRET_Unmarshal(TPM2B_ENCRYPTED_SECRET *target, BYTE **buffer, INT32 *size)
4828 {
4829     return TSS_TPM2B_ENCRYPTED_SECRET_Unmarshalu(target, buffer, (uint32_t *)size);
4830 }
4831 
TPMI_ALG_PUBLIC_Unmarshal(TPMI_ALG_PUBLIC * target,BYTE ** buffer,INT32 * size)4832 TPM_RC TPMI_ALG_PUBLIC_Unmarshal(TPMI_ALG_PUBLIC *target, BYTE **buffer, INT32 *size)
4833 {
4834     return TSS_TPMI_ALG_PUBLIC_Unmarshalu(target, buffer, (uint32_t *)size);
4835 }
4836 
TPMU_PUBLIC_ID_Unmarshal(TPMU_PUBLIC_ID * target,BYTE ** buffer,INT32 * size,UINT32 selector)4837 TPM_RC TPMU_PUBLIC_ID_Unmarshal(TPMU_PUBLIC_ID *target, BYTE **buffer, INT32 *size, UINT32 selector)
4838 {
4839     return TSS_TPMU_PUBLIC_ID_Unmarshalu(target, buffer, (uint32_t *)size, selector);
4840 }
4841 
TPMS_KEYEDHASH_PARMS_Unmarshal(TPMS_KEYEDHASH_PARMS * target,BYTE ** buffer,INT32 * size)4842 TPM_RC TPMS_KEYEDHASH_PARMS_Unmarshal(TPMS_KEYEDHASH_PARMS *target, BYTE **buffer, INT32 *size)
4843 {
4844     return TSS_TPMS_KEYEDHASH_PARMS_Unmarshalu(target, buffer, (uint32_t *)size);
4845 }
4846 
4847 #if 0
4848 TPM_RC TPMS_ASYM_PARMS_Unmarshal(TPMS_ASYM_PARMS *target, BYTE **buffer, INT32 *size)
4849 {
4850     return TSS_TPMS_ASYM_PARMS_Unmarshalu(target, buffer, (uint32_t *)size);
4851 }
4852 #endif
4853 
TPMS_RSA_PARMS_Unmarshal(TPMS_RSA_PARMS * target,BYTE ** buffer,INT32 * size)4854 TPM_RC TPMS_RSA_PARMS_Unmarshal(TPMS_RSA_PARMS *target, BYTE **buffer, INT32 *size)
4855 {
4856     return TSS_TPMS_RSA_PARMS_Unmarshalu(target, buffer, (uint32_t *)size);
4857 }
4858 
TPMS_ECC_PARMS_Unmarshal(TPMS_ECC_PARMS * target,BYTE ** buffer,INT32 * size)4859 TPM_RC TPMS_ECC_PARMS_Unmarshal(TPMS_ECC_PARMS *target, BYTE **buffer, INT32 *size)
4860 {
4861     return TSS_TPMS_ECC_PARMS_Unmarshalu(target, buffer, (uint32_t *)size);
4862 }
4863 
TPMU_PUBLIC_PARMS_Unmarshal(TPMU_PUBLIC_PARMS * target,BYTE ** buffer,INT32 * size,UINT32 selector)4864 TPM_RC TPMU_PUBLIC_PARMS_Unmarshal(TPMU_PUBLIC_PARMS *target, BYTE **buffer, INT32 *size, UINT32 selector)
4865 {
4866     return TSS_TPMU_PUBLIC_PARMS_Unmarshalu(target, buffer, (uint32_t *)size, selector);
4867 }
4868 
TPMT_PUBLIC_PARMS_Unmarshal(TPMT_PUBLIC_PARMS * target,BYTE ** buffer,INT32 * size)4869 TPM_RC TPMT_PUBLIC_PARMS_Unmarshal(TPMT_PUBLIC_PARMS *target, BYTE **buffer, INT32 *size)
4870 {
4871     return TSS_TPMT_PUBLIC_PARMS_Unmarshalu(target, buffer, (uint32_t *)size);
4872 }
4873 
TPMT_PUBLIC_Unmarshal(TPMT_PUBLIC * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4874 TPM_RC TPMT_PUBLIC_Unmarshal(TPMT_PUBLIC *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4875 {
4876     return TSS_TPMT_PUBLIC_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4877 }
4878 
TPM2B_PUBLIC_Unmarshal(TPM2B_PUBLIC * target,BYTE ** buffer,INT32 * size,BOOL allowNull)4879 TPM_RC TPM2B_PUBLIC_Unmarshal(TPM2B_PUBLIC *target, BYTE **buffer, INT32 *size, BOOL allowNull)
4880 {
4881     return TSS_TPM2B_PUBLIC_Unmarshalu(target, buffer, (uint32_t *)size, allowNull);
4882 }
4883 
TPM2B_TEMPLATE_Unmarshal(TPM2B_TEMPLATE * target,BYTE ** buffer,INT32 * size)4884 TPM_RC TPM2B_TEMPLATE_Unmarshal(TPM2B_TEMPLATE *target, BYTE **buffer, INT32 *size)
4885 {
4886     return TSS_TPM2B_TEMPLATE_Unmarshalu(target, buffer, (uint32_t *)size);
4887 }
4888 
TPMU_SENSITIVE_COMPOSITE_Unmarshal(TPMU_SENSITIVE_COMPOSITE * target,BYTE ** buffer,INT32 * size,UINT32 selector)4889 TPM_RC TPMU_SENSITIVE_COMPOSITE_Unmarshal(TPMU_SENSITIVE_COMPOSITE *target, BYTE **buffer, INT32 *size, UINT32 selector)
4890 {
4891     return TSS_TPMU_SENSITIVE_COMPOSITE_Unmarshalu(target, buffer, (uint32_t *)size, selector);
4892 }
4893 
TPMT_SENSITIVE_Unmarshal(TPMT_SENSITIVE * target,BYTE ** buffer,INT32 * size)4894 TPM_RC TPMT_SENSITIVE_Unmarshal(TPMT_SENSITIVE *target, BYTE **buffer, INT32 *size)
4895 {
4896     return TSS_TPMT_SENSITIVE_Unmarshalu(target, buffer, (uint32_t *)size);
4897 }
4898 
TPM2B_SENSITIVE_Unmarshal(TPM2B_SENSITIVE * target,BYTE ** buffer,INT32 * size)4899 TPM_RC TPM2B_SENSITIVE_Unmarshal(TPM2B_SENSITIVE *target, BYTE **buffer, INT32 *size)
4900 {
4901     return TSS_TPM2B_SENSITIVE_Unmarshalu(target, buffer, (uint32_t *)size);
4902 }
4903 
TPM2B_PRIVATE_Unmarshal(TPM2B_PRIVATE * target,BYTE ** buffer,INT32 * size)4904 TPM_RC TPM2B_PRIVATE_Unmarshal(TPM2B_PRIVATE *target, BYTE **buffer, INT32 *size)
4905 {
4906     return TSS_TPM2B_PRIVATE_Unmarshalu(target, buffer, (uint32_t *)size);
4907 }
4908 
TPM2B_ID_OBJECT_Unmarshal(TPM2B_ID_OBJECT * target,BYTE ** buffer,INT32 * size)4909 TPM_RC TPM2B_ID_OBJECT_Unmarshal(TPM2B_ID_OBJECT *target, BYTE **buffer, INT32 *size)
4910 {
4911     return TSS_TPM2B_ID_OBJECT_Unmarshalu(target, buffer, (uint32_t *)size);
4912 }
4913 
TPMA_NV_Unmarshal(TPMA_NV * target,BYTE ** buffer,INT32 * size)4914 TPM_RC TPMA_NV_Unmarshal(TPMA_NV *target, BYTE **buffer, INT32 *size)
4915 {
4916     return TSS_TPMA_NV_Unmarshalu(target, buffer, (uint32_t *)size);
4917 }
4918 
TPMS_NV_PUBLIC_Unmarshal(TPMS_NV_PUBLIC * target,BYTE ** buffer,INT32 * size)4919 TPM_RC TPMS_NV_PUBLIC_Unmarshal(TPMS_NV_PUBLIC *target, BYTE **buffer, INT32 *size)
4920 {
4921     return TSS_TPMS_NV_PUBLIC_Unmarshalu(target, buffer, (uint32_t *)size);
4922 }
4923 
TPM2B_NV_PUBLIC_Unmarshal(TPM2B_NV_PUBLIC * target,BYTE ** buffer,INT32 * size)4924 TPM_RC TPM2B_NV_PUBLIC_Unmarshal(TPM2B_NV_PUBLIC *target, BYTE **buffer, INT32 *size)
4925 {
4926     return TSS_TPM2B_NV_PUBLIC_Unmarshalu(target, buffer, (uint32_t *)size);
4927 }
4928 
TPM2B_CONTEXT_SENSITIVE_Unmarshal(TPM2B_CONTEXT_SENSITIVE * target,BYTE ** buffer,INT32 * size)4929 TPM_RC TPM2B_CONTEXT_SENSITIVE_Unmarshal(TPM2B_CONTEXT_SENSITIVE *target, BYTE **buffer, INT32 *size)
4930 {
4931     return TSS_TPM2B_CONTEXT_SENSITIVE_Unmarshalu(target, buffer, (uint32_t *)size);
4932 }
4933 
TPMS_CONTEXT_DATA_Unmarshal(TPMS_CONTEXT_DATA * target,BYTE ** buffer,INT32 * size)4934 TPM_RC TPMS_CONTEXT_DATA_Unmarshal(TPMS_CONTEXT_DATA *target, BYTE **buffer, INT32 *size)
4935 {
4936     return TSS_TPMS_CONTEXT_DATA_Unmarshalu(target, buffer, (uint32_t *)size);
4937 }
4938 
TPM2B_CONTEXT_DATA_Unmarshal(TPM2B_CONTEXT_DATA * target,BYTE ** buffer,INT32 * size)4939 TPM_RC TPM2B_CONTEXT_DATA_Unmarshal(TPM2B_CONTEXT_DATA *target, BYTE **buffer, INT32 *size)
4940 {
4941     return TSS_TPM2B_CONTEXT_DATA_Unmarshalu(target, buffer, (uint32_t *)size);
4942 }
4943 
TPMS_CONTEXT_Unmarshal(TPMS_CONTEXT * target,BYTE ** buffer,INT32 * size)4944 TPM_RC TPMS_CONTEXT_Unmarshal(TPMS_CONTEXT *target, BYTE **buffer, INT32 *size)
4945 {
4946     return TSS_TPMS_CONTEXT_Unmarshalu(target, buffer, (uint32_t *)size);
4947 }
4948 
TPMS_CREATION_DATA_Unmarshal(TPMS_CREATION_DATA * target,BYTE ** buffer,INT32 * size)4949 TPM_RC TPMS_CREATION_DATA_Unmarshal(TPMS_CREATION_DATA *target, BYTE **buffer, INT32 *size)
4950 {
4951     return TSS_TPMS_CREATION_DATA_Unmarshalu(target, buffer, (uint32_t *)size);
4952 }
4953 
TPM2B_CREATION_DATA_Unmarshal(TPM2B_CREATION_DATA * target,BYTE ** buffer,INT32 * size)4954 TPM_RC TPM2B_CREATION_DATA_Unmarshal(TPM2B_CREATION_DATA *target, BYTE **buffer, INT32 *size)
4955 {
4956     return TSS_TPM2B_CREATION_DATA_Unmarshalu(target, buffer, (uint32_t *)size);
4957 }
4958 
4959 #endif 	/* TPM_TSS_NOCMDCHECK */
4960 
4961 #endif /* TPM_TPM20 */
4962