• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /***********************************************************************
3  * Copyright (c) 2015 - 2017, Intel Corporation
4  *
5  * All rights reserved.
6  ***********************************************************************/
7 
8 #ifdef HAVE_CONFIG_H
9 #include <config.h>
10 #endif
11 
12 #include <inttypes.h>
13 #include <string.h>
14 
15 #include "tss2_mu.h"
16 
17 #include "util/tss2_endian.h"
18 #define LOGMODULE marshal
19 #include "util/log.h"
20 
21 #define ADDR &
22 #define VAL
23 
24 #define TPMT_MARSHAL_2(type, m1, op1, fn1, m2, op2, sel, fn2) \
25 TSS2_RC Tss2_MU_##type##_Marshal(type const *src, uint8_t buffer[], \
26                                  size_t buffer_size, size_t *offset) \
27 { \
28     TSS2_RC ret = TSS2_RC_SUCCESS; \
29     size_t local_offset = 0; \
30 \
31     if (!src) \
32         return TSS2_SYS_RC_BAD_REFERENCE; \
33 \
34     if (offset) \
35         local_offset = *offset; \
36     else if (!buffer) \
37         return TSS2_MU_RC_BAD_REFERENCE; \
38 \
39     LOG_DEBUG(\
40          "Marshalling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
41          " at index 0x%zx", (uintptr_t)src,  (uintptr_t)buffer, local_offset); \
42 \
43     ret = fn1(op1 src->m1, buffer, buffer_size, &local_offset); \
44     if (ret != TSS2_RC_SUCCESS) \
45         return ret; \
46 \
47     ret = fn2(op2 src->m2, src->sel, buffer, buffer_size, &local_offset); \
48 \
49     if (offset && ret == TSS2_RC_SUCCESS) { \
50         *offset = local_offset; \
51     } \
52 \
53     return ret; \
54 }
55 
56 #define TPMT_UNMARSHAL_2(type, m1, fn1, m2, sel, fn2) \
57 TSS2_RC Tss2_MU_##type##_Unmarshal(uint8_t const buffer[], size_t buffer_size, \
58                                    size_t *offset, type *dest) \
59 { \
60     TSS2_RC ret = TSS2_RC_SUCCESS; \
61     size_t local_offset = 0; \
62     type tmp; \
63 \
64     if (offset) \
65         local_offset = *offset; \
66     else if (!dest) \
67         return TSS2_MU_RC_BAD_REFERENCE; \
68 \
69     LOG_DEBUG(\
70          "Unmarshaling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
71          " at index 0x%zx", (uintptr_t)dest,  (uintptr_t)buffer, local_offset); \
72 \
73     memset(&tmp, '\0', sizeof(tmp)); \
74 \
75     ret = fn1(buffer, buffer_size, &local_offset, dest ? &dest->m1 : &tmp.m1); \
76     if (ret != TSS2_RC_SUCCESS) \
77         return ret; \
78 \
79     ret = fn2(buffer, buffer_size, &local_offset, dest ? dest->sel : tmp.sel, dest ? &dest->m2 : NULL); \
80 \
81     if (offset && ret == TSS2_RC_SUCCESS) { \
82         *offset = local_offset; \
83     } \
84 \
85     return ret; \
86 }
87 
88 #define TPMT_MARSHAL_3(type, m1, op1, fn1, m2, op2, sel2, fn2, m3, op3, sel3, fn3) \
89 TSS2_RC Tss2_MU_##type##_Marshal(type const *src, uint8_t buffer[], \
90                                  size_t buffer_size, size_t *offset) \
91 { \
92     TSS2_RC ret = TSS2_RC_SUCCESS; \
93     size_t local_offset = 0; \
94 \
95     if (!src) \
96         return TSS2_SYS_RC_BAD_REFERENCE; \
97 \
98     if (offset) \
99         local_offset = *offset; \
100     else if (!buffer) \
101         return TSS2_MU_RC_BAD_REFERENCE; \
102 \
103     LOG_DEBUG(\
104          "Marshalling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
105          " at index 0x%zx", (uintptr_t)src,  (uintptr_t)buffer, local_offset); \
106 \
107     ret = fn1(op1 src->m1, buffer, buffer_size, &local_offset); \
108     if (ret != TSS2_RC_SUCCESS) \
109         return ret; \
110 \
111     ret = fn2(op2 src->m2, src->sel2, buffer, buffer_size, &local_offset); \
112     if (ret != TSS2_RC_SUCCESS) \
113         return ret; \
114 \
115     ret = fn3(op3 src->m3, src->sel3, buffer, buffer_size, &local_offset); \
116 \
117     if (offset && ret == TSS2_RC_SUCCESS) { \
118         *offset = local_offset; \
119     } \
120 \
121     return ret; \
122 }
123 
124 #define TPMT_UNMARSHAL_3(type, m1, fn1, m2, sel2, fn2, m3, sel3, fn3) \
125 TSS2_RC Tss2_MU_##type##_Unmarshal(uint8_t const buffer[], size_t buffer_size, \
126                                    size_t *offset, type *dest) \
127 { \
128     TSS2_RC ret = TSS2_RC_SUCCESS; \
129     size_t local_offset = 0; \
130     type tmp; \
131 \
132     if (offset) \
133         local_offset = *offset; \
134     else if (!dest) \
135         return TSS2_MU_RC_BAD_REFERENCE; \
136 \
137     memset(&tmp, '\0', sizeof(tmp)); \
138 \
139     LOG_DEBUG(\
140          "Unmarshaling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
141          " at index 0x%zx", (uintptr_t)dest,  (uintptr_t)buffer, local_offset); \
142 \
143     ret = fn1(buffer, buffer_size, &local_offset, dest ? &dest->m1 : &tmp.m1); \
144     if (ret != TSS2_RC_SUCCESS) \
145         return ret; \
146 \
147     ret = fn2(buffer, buffer_size, &local_offset, dest ? dest->sel2 : tmp.sel2, dest ? &dest->m2 : NULL); \
148     if (ret != TSS2_RC_SUCCESS) \
149         return ret; \
150 \
151     ret = fn3(buffer, buffer_size, &local_offset, dest ? dest->sel3 : tmp.sel3, dest ? &dest->m3 : NULL); \
152 \
153     if (offset && ret == TSS2_RC_SUCCESS) { \
154         *offset = local_offset; \
155     } \
156 \
157     return ret; \
158 }
159 
160 #define TPMT_MARSHAL_TK(type, m1, fn1, m2, fn2, m3, fn3) \
161 TSS2_RC Tss2_MU_##type##_Marshal(type const *src, uint8_t buffer[], \
162                                  size_t buffer_size, size_t *offset) \
163 { \
164     TSS2_RC ret = TSS2_RC_SUCCESS; \
165     size_t local_offset = 0; \
166 \
167     if (!src) \
168         return TSS2_SYS_RC_BAD_REFERENCE; \
169 \
170     if (offset) \
171         local_offset = *offset; \
172     else if (!buffer) \
173         return TSS2_MU_RC_BAD_REFERENCE; \
174 \
175     LOG_DEBUG(\
176          "Marshalling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
177          " at index 0x%zx", (uintptr_t)src,  (uintptr_t)buffer, local_offset); \
178 \
179     ret = fn1(src->m1, buffer, buffer_size, &local_offset); \
180     if (ret != TSS2_RC_SUCCESS) \
181         return ret; \
182 \
183     ret = fn2(src->m2, buffer, buffer_size, &local_offset); \
184     if (ret != TSS2_RC_SUCCESS) \
185         return ret; \
186 \
187     ret = fn3(&src->m3, buffer, buffer_size, &local_offset); \
188 \
189     if (offset && ret == TSS2_RC_SUCCESS) { \
190         *offset = local_offset; \
191     } \
192 \
193     return ret; \
194 }
195 
196 #define TPMT_UNMARSHAL_TK(type, m1, fn1, m2, fn2, m3, fn3) \
197 TSS2_RC Tss2_MU_##type##_Unmarshal(uint8_t const buffer[], size_t buffer_size, \
198                                    size_t *offset, type *dest) \
199 { \
200     TSS2_RC ret = TSS2_RC_SUCCESS; \
201     size_t local_offset = 0; \
202 \
203     if (offset) \
204         local_offset = *offset; \
205     else if (!dest) \
206         return TSS2_MU_RC_BAD_REFERENCE; \
207 \
208     LOG_DEBUG(\
209          "Unmarshaling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
210          " at index 0x%zx", (uintptr_t)dest,  (uintptr_t)buffer, local_offset); \
211 \
212     ret = fn1(buffer, buffer_size, &local_offset, dest ? &dest->m1 : NULL); \
213     if (ret != TSS2_RC_SUCCESS) \
214         return ret; \
215 \
216     ret = fn2(buffer, buffer_size, &local_offset, dest ? &dest->m2 : NULL); \
217     if (ret != TSS2_RC_SUCCESS) \
218         return ret; \
219 \
220     ret = fn3(buffer, buffer_size, &local_offset, dest ? &dest->m3 : NULL); \
221 \
222     if (offset && ret == TSS2_RC_SUCCESS) { \
223         *offset = local_offset; \
224     } \
225 \
226     return ret; \
227 }
228 
229 #define TPMT_MARSHAL_4(type, m1, op1, fn1, m2, op2, fn2, m3, op3, fn3, \
230                        m4, sel4, op4, fn4) \
231 TSS2_RC Tss2_MU_##type##_Marshal(type const *src, uint8_t buffer[], \
232                                  size_t buffer_size, size_t *offset) \
233 { \
234     TSS2_RC ret = TSS2_RC_SUCCESS; \
235     size_t local_offset = 0; \
236 \
237     if (!src) \
238         return TSS2_SYS_RC_BAD_REFERENCE; \
239 \
240     if (offset) \
241         local_offset = *offset; \
242     else if (!buffer) \
243         return TSS2_MU_RC_BAD_REFERENCE; \
244 \
245     LOG_DEBUG(\
246          "Marshalling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
247          " at index 0x%zx", (uintptr_t)src,  (uintptr_t)buffer, local_offset); \
248 \
249     ret = fn1(op1 src->m1, buffer, buffer_size, &local_offset); \
250     if (ret != TSS2_RC_SUCCESS) \
251         return ret; \
252 \
253     ret = fn2(op2 src->m2, buffer, buffer_size, &local_offset); \
254     if (ret != TSS2_RC_SUCCESS) \
255         return ret; \
256 \
257     ret = fn3(op3 src->m3, buffer, buffer_size, &local_offset); \
258     if (ret != TSS2_RC_SUCCESS) \
259         return ret; \
260 \
261     ret = fn4(op4 src->m4, src->sel4, buffer, buffer_size, &local_offset); \
262 \
263     if (offset && ret == TSS2_RC_SUCCESS) { \
264         *offset = local_offset; \
265     } \
266 \
267     return ret; \
268 }
269 
270 #define TPMT_UNMARSHAL_4(type, m1, fn1, m2, fn2, m3, fn3, m4, sel4, fn4) \
271 TSS2_RC Tss2_MU_##type##_Unmarshal(uint8_t const buffer[], size_t buffer_size, \
272                                    size_t *offset, type *dest) \
273 { \
274     TSS2_RC ret = TSS2_RC_SUCCESS; \
275     size_t local_offset = 0; \
276     type tmp; \
277 \
278     if (offset) \
279         local_offset = *offset; \
280     else if (!dest) \
281         return TSS2_MU_RC_BAD_REFERENCE; \
282 \
283     memset(&tmp, '\0', sizeof(tmp)); \
284 \
285     LOG_DEBUG(\
286          "Unmarshaling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
287          " at index 0x%zx", (uintptr_t)dest,  (uintptr_t)buffer, local_offset); \
288 \
289     ret = fn1(buffer, buffer_size, &local_offset, dest ? &dest->m1 : &tmp.m1); \
290     if (ret != TSS2_RC_SUCCESS) \
291         return ret; \
292 \
293     ret = fn2(buffer, buffer_size, &local_offset, dest ? &dest->m2 : &tmp.m2); \
294     if (ret != TSS2_RC_SUCCESS) \
295         return ret; \
296 \
297     ret = fn3(buffer, buffer_size, &local_offset, dest ? &dest->m3 : &tmp.m3); \
298     if (ret != TSS2_RC_SUCCESS) \
299         return ret; \
300 \
301     ret = fn4(buffer, buffer_size, &local_offset, dest ? dest->sel4 : tmp.sel4, dest ? &dest->m4 : NULL); \
302 \
303     if (offset && ret == TSS2_RC_SUCCESS) { \
304         *offset = local_offset; \
305     } \
306 \
307     return ret; \
308 }
309 
310 #define TPMT_MARSHAL_5(type, m1, op1, fn1, m2, op2, fn2, m3, op3, fn3, \
311                        m4, op4, fn4, m5, op5, fn5) \
312 TSS2_RC Tss2_MU_##type##_Marshal(type const *src, uint8_t buffer[], \
313                                  size_t buffer_size, size_t *offset) \
314 { \
315     TSS2_RC ret = TSS2_RC_SUCCESS; \
316     size_t local_offset = 0; \
317 \
318     if (!src) \
319         return TSS2_SYS_RC_BAD_REFERENCE; \
320 \
321     if (offset) \
322         local_offset = *offset; \
323     else if (!buffer) \
324         return TSS2_MU_RC_BAD_REFERENCE; \
325 \
326     LOG_DEBUG(\
327          "Marshalling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
328          " at index 0x%zx", (uintptr_t)src,  (uintptr_t)buffer, local_offset); \
329 \
330     ret = fn1(op1 src->m1, buffer, buffer_size, &local_offset); \
331     if (ret != TSS2_RC_SUCCESS) \
332         return ret; \
333 \
334     ret = fn2(op2 src->m2, buffer, buffer_size, &local_offset); \
335     if (ret != TSS2_RC_SUCCESS) \
336         return ret; \
337 \
338     ret = fn3(op3 src->m3, buffer, buffer_size, &local_offset); \
339     if (ret != TSS2_RC_SUCCESS) \
340         return ret; \
341 \
342     ret = fn4(op4 src->m4, buffer, buffer_size, &local_offset); \
343     if (ret != TSS2_RC_SUCCESS) \
344         return ret; \
345 \
346     ret = fn5(op5 src->m5, buffer, buffer_size, &local_offset); \
347 \
348     if (offset && ret == TSS2_RC_SUCCESS) { \
349         *offset = local_offset; \
350     } \
351 \
352     return ret; \
353 }
354 
355 #define TPMT_UNMARSHAL_5(type, m1, fn1, m2, fn2, m3, fn3, m4, fn4, m5, fn5) \
356 TSS2_RC Tss2_MU_##type##_Unmarshal(uint8_t const buffer[], size_t buffer_size, \
357                                    size_t *offset, type *dest) \
358 { \
359     TSS2_RC ret = TSS2_RC_SUCCESS; \
360     size_t local_offset = 0; \
361 \
362     if (offset) \
363         local_offset = *offset; \
364     else if (!dest) \
365         return TSS2_MU_RC_BAD_REFERENCE; \
366 \
367     LOG_DEBUG(\
368          "Unmarshaling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
369          " at index 0x%zx", (uintptr_t)dest,  (uintptr_t)buffer, local_offset); \
370 \
371     ret = fn1(buffer, buffer_size, &local_offset, dest ? &dest->m1 : NULL); \
372     if (ret != TSS2_RC_SUCCESS) \
373         return ret; \
374 \
375     ret = fn2(buffer, buffer_size, &local_offset, dest ? &dest->m2 : NULL); \
376     if (ret != TSS2_RC_SUCCESS) \
377         return ret; \
378 \
379     ret = fn3(buffer, buffer_size, &local_offset, dest ? &dest->m3 : NULL); \
380     if (ret != TSS2_RC_SUCCESS) \
381         return ret; \
382 \
383     ret = fn4(buffer, buffer_size, &local_offset, dest ? &dest->m4 : NULL); \
384     if (ret != TSS2_RC_SUCCESS) \
385         return ret; \
386 \
387     ret = fn5(buffer, buffer_size, &local_offset, dest ? &dest->m5 : NULL); \
388 \
389     if (offset && ret == TSS2_RC_SUCCESS) { \
390         *offset = local_offset; \
391     } \
392 \
393     return ret; \
394 }
395 
396 #define TPMT_MARSHAL_6(type, m1, op1, fn1, m2, op2, fn2, m3, op3, fn3, \
397                        m4, op4, fn4, m5, op5, sel5, fn5, m6, op6, sel6, fn6) \
398 TSS2_RC Tss2_MU_##type##_Marshal(type const *src, uint8_t buffer[], \
399                                  size_t buffer_size, size_t *offset) \
400 { \
401     TSS2_RC ret = TSS2_RC_SUCCESS; \
402     size_t local_offset = 0; \
403 \
404     if (!src) \
405         return TSS2_SYS_RC_BAD_REFERENCE; \
406 \
407     if (offset) \
408         local_offset = *offset; \
409     else if (!buffer) \
410         return TSS2_MU_RC_BAD_REFERENCE; \
411 \
412     LOG_DEBUG(\
413          "Marshalling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
414          " at index 0x%zx", (uintptr_t)src,  (uintptr_t)buffer, local_offset); \
415 \
416     ret = fn1(op1 src->m1, buffer, buffer_size, &local_offset); \
417     if (ret != TSS2_RC_SUCCESS) \
418         return ret; \
419 \
420     ret = fn2(op2 src->m2, buffer, buffer_size, &local_offset); \
421     if (ret != TSS2_RC_SUCCESS) \
422         return ret; \
423 \
424     ret = fn3(op3 src->m3, buffer, buffer_size, &local_offset); \
425     if (ret != TSS2_RC_SUCCESS) \
426         return ret; \
427 \
428     ret = fn4(op4 src->m4, buffer, buffer_size, &local_offset); \
429     if (ret != TSS2_RC_SUCCESS) \
430         return ret; \
431 \
432     ret = fn5(op5 src->m5, src->sel5, buffer, buffer_size, &local_offset); \
433     if (ret != TSS2_RC_SUCCESS) \
434         return ret; \
435 \
436     ret = fn6(op6 src->m6, src->sel6, buffer, buffer_size, &local_offset); \
437 \
438     if (offset && ret == TSS2_RC_SUCCESS) { \
439         *offset = local_offset; \
440     } \
441 \
442     return ret; \
443 }
444 
445 #define TPMT_UNMARSHAL_6(type, m1, fn1, m2, fn2, m3, fn3, m4, fn4, m5, sel5, fn5, m6, sel6, fn6) \
446 TSS2_RC Tss2_MU_##type##_Unmarshal(uint8_t const buffer[], size_t buffer_size, \
447                                    size_t *offset, type *dest) \
448 { \
449     TSS2_RC ret = TSS2_RC_SUCCESS; \
450     size_t local_offset = 0; \
451     type tmp; \
452 \
453     if (offset) \
454         local_offset = *offset; \
455     else if (!dest) \
456         return TSS2_MU_RC_BAD_REFERENCE; \
457 \
458     memset(&tmp, '\0', sizeof(tmp)); \
459 \
460     LOG_DEBUG(\
461          "Unmarshaling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
462          " at index 0x%zx", (uintptr_t)dest,  (uintptr_t)buffer, local_offset); \
463 \
464     ret = fn1(buffer, buffer_size, &local_offset, dest ? &dest->m1 : &tmp.m1); \
465     if (ret != TSS2_RC_SUCCESS) \
466         return ret; \
467 \
468     ret = fn2(buffer, buffer_size, &local_offset, dest ? &dest->m2 : &tmp.m2); \
469     if (ret != TSS2_RC_SUCCESS) \
470         return ret; \
471 \
472     ret = fn3(buffer, buffer_size, &local_offset, dest ? &dest->m3 : &tmp.m3); \
473     if (ret != TSS2_RC_SUCCESS) \
474         return ret; \
475 \
476     ret = fn4(buffer, buffer_size, &local_offset, dest ? &dest->m4 : &tmp.m4); \
477     if (ret != TSS2_RC_SUCCESS) \
478         return ret; \
479 \
480     ret = fn5(buffer, buffer_size, &local_offset, dest ? dest->sel5 : tmp.sel5, dest ? &dest->m5 : NULL); \
481     if (ret != TSS2_RC_SUCCESS) \
482         return ret; \
483 \
484     ret = fn6(buffer, buffer_size, &local_offset, dest ? dest->sel6 : tmp.sel6, dest ? &dest->m6 : NULL); \
485 \
486     if (offset && ret == TSS2_RC_SUCCESS) { \
487         *offset = local_offset; \
488     } \
489 \
490     return ret; \
491 }
492 
493 /*
494  * These macros expand to (un)marshal functions for each of the TPMT types
495  * the specification part 2.
496  */
497 TPMT_MARSHAL_2(TPMT_HA, hashAlg, VAL, Tss2_MU_UINT16_Marshal,
498                digest, ADDR, hashAlg, Tss2_MU_TPMU_HA_Marshal)
499 
500 TPMT_UNMARSHAL_2(TPMT_HA, hashAlg, Tss2_MU_UINT16_Unmarshal,
501                  digest, hashAlg, Tss2_MU_TPMU_HA_Unmarshal)
502 
503 TPMT_MARSHAL_3(TPMT_SYM_DEF, algorithm, VAL, Tss2_MU_UINT16_Marshal,
504                keyBits, ADDR, algorithm, Tss2_MU_TPMU_SYM_KEY_BITS_Marshal,
505                mode, ADDR, algorithm, Tss2_MU_TPMU_SYM_MODE_Marshal)
506 
507 TPMT_UNMARSHAL_3(TPMT_SYM_DEF, algorithm, Tss2_MU_UINT16_Unmarshal,
508                  keyBits, algorithm, Tss2_MU_TPMU_SYM_KEY_BITS_Unmarshal,
509                  mode, algorithm, Tss2_MU_TPMU_SYM_MODE_Unmarshal)
510 
511 TPMT_MARSHAL_3(TPMT_SYM_DEF_OBJECT, algorithm, VAL, Tss2_MU_UINT16_Marshal,
512                keyBits, ADDR, algorithm, Tss2_MU_TPMU_SYM_KEY_BITS_Marshal,
513                mode, ADDR, algorithm, Tss2_MU_TPMU_SYM_MODE_Marshal)
514 
515 TPMT_UNMARSHAL_3(TPMT_SYM_DEF_OBJECT, algorithm, Tss2_MU_UINT16_Unmarshal,
516                  keyBits, algorithm, Tss2_MU_TPMU_SYM_KEY_BITS_Unmarshal,
517                  mode, algorithm, Tss2_MU_TPMU_SYM_MODE_Unmarshal)
518 
519 TPMT_MARSHAL_2(TPMT_KEYEDHASH_SCHEME, scheme, VAL, Tss2_MU_UINT16_Marshal,
520                details, ADDR, scheme, Tss2_MU_TPMU_SCHEME_KEYEDHASH_Marshal)
521 
522 TPMT_UNMARSHAL_2(TPMT_KEYEDHASH_SCHEME, scheme, Tss2_MU_UINT16_Unmarshal,
523                  details, scheme, Tss2_MU_TPMU_SCHEME_KEYEDHASH_Unmarshal)
524 
525 TPMT_MARSHAL_2(TPMT_SIG_SCHEME, scheme, VAL, Tss2_MU_UINT16_Marshal,
526                details, ADDR, scheme, Tss2_MU_TPMU_SIG_SCHEME_Marshal)
527 
528 TPMT_UNMARSHAL_2(TPMT_SIG_SCHEME, scheme, Tss2_MU_UINT16_Unmarshal,
529                  details, scheme, Tss2_MU_TPMU_SIG_SCHEME_Unmarshal)
530 
531 TPMT_MARSHAL_2(TPMT_KDF_SCHEME, scheme, VAL, Tss2_MU_UINT16_Marshal,
532                details, ADDR, scheme, Tss2_MU_TPMU_KDF_SCHEME_Marshal)
533 
534 TPMT_UNMARSHAL_2(TPMT_KDF_SCHEME, scheme, Tss2_MU_UINT16_Unmarshal,
535                  details, scheme, Tss2_MU_TPMU_KDF_SCHEME_Unmarshal)
536 
537 TPMT_MARSHAL_2(TPMT_ASYM_SCHEME, scheme, VAL, Tss2_MU_UINT16_Marshal,
538                details, ADDR, scheme, Tss2_MU_TPMU_ASYM_SCHEME_Marshal)
539 
540 TPMT_UNMARSHAL_2(TPMT_ASYM_SCHEME, scheme, Tss2_MU_UINT16_Unmarshal,
541                  details, scheme, Tss2_MU_TPMU_ASYM_SCHEME_Unmarshal)
542 
543 TPMT_MARSHAL_2(TPMT_RSA_SCHEME, scheme, VAL, Tss2_MU_UINT16_Marshal,
544                details, ADDR, scheme, Tss2_MU_TPMU_ASYM_SCHEME_Marshal)
545 
546 TPMT_UNMARSHAL_2(TPMT_RSA_SCHEME, scheme, Tss2_MU_UINT16_Unmarshal,
547                  details, scheme, Tss2_MU_TPMU_ASYM_SCHEME_Unmarshal)
548 
549 TPMT_MARSHAL_2(TPMT_RSA_DECRYPT, scheme, VAL, Tss2_MU_UINT16_Marshal,
550                details, ADDR, scheme, Tss2_MU_TPMU_ASYM_SCHEME_Marshal)
551 
552 TPMT_UNMARSHAL_2(TPMT_RSA_DECRYPT, scheme, Tss2_MU_UINT16_Unmarshal,
553                  details, scheme, Tss2_MU_TPMU_ASYM_SCHEME_Unmarshal)
554 
555 TPMT_MARSHAL_2(TPMT_ECC_SCHEME, scheme, VAL, Tss2_MU_UINT16_Marshal,
556                details, ADDR, scheme, Tss2_MU_TPMU_ASYM_SCHEME_Marshal)
557 
558 TPMT_UNMARSHAL_2(TPMT_ECC_SCHEME, scheme, Tss2_MU_UINT16_Unmarshal,
559                  details, scheme, Tss2_MU_TPMU_ASYM_SCHEME_Unmarshal)
560 
561 TPMT_MARSHAL_2(TPMT_SIGNATURE, sigAlg, VAL, Tss2_MU_UINT16_Marshal,
562                signature, ADDR, sigAlg, Tss2_MU_TPMU_SIGNATURE_Marshal)
563 
564 TPMT_UNMARSHAL_2(TPMT_SIGNATURE, sigAlg, Tss2_MU_UINT16_Unmarshal,
565                  signature, sigAlg, Tss2_MU_TPMU_SIGNATURE_Unmarshal)
566 
567 TPMT_MARSHAL_4(TPMT_SENSITIVE, sensitiveType, VAL, Tss2_MU_UINT16_Marshal,
568                authValue, ADDR, Tss2_MU_TPM2B_DIGEST_Marshal,
569                seedValue, ADDR, Tss2_MU_TPM2B_DIGEST_Marshal,
570                sensitive, sensitiveType, ADDR, Tss2_MU_TPMU_SENSITIVE_COMPOSITE_Marshal)
571 
572 TPMT_UNMARSHAL_4(TPMT_SENSITIVE, sensitiveType, Tss2_MU_UINT16_Unmarshal,
573                  authValue, Tss2_MU_TPM2B_DIGEST_Unmarshal,
574                  seedValue, Tss2_MU_TPM2B_DIGEST_Unmarshal,
575                  sensitive, sensitiveType, Tss2_MU_TPMU_SENSITIVE_COMPOSITE_Unmarshal)
576 
577 TPMT_MARSHAL_6(TPMT_PUBLIC, type, VAL, Tss2_MU_UINT16_Marshal,
578                nameAlg, VAL, Tss2_MU_UINT16_Marshal,
579                objectAttributes, VAL, Tss2_MU_TPMA_OBJECT_Marshal,
580                authPolicy, ADDR, Tss2_MU_TPM2B_DIGEST_Marshal,
581                parameters, ADDR, type, Tss2_MU_TPMU_PUBLIC_PARMS_Marshal,
582                unique, ADDR, type, Tss2_MU_TPMU_PUBLIC_ID_Marshal)
583 
584 TPMT_UNMARSHAL_6(TPMT_PUBLIC, type, Tss2_MU_UINT16_Unmarshal,
585                  nameAlg, Tss2_MU_UINT16_Unmarshal,
586                  objectAttributes, Tss2_MU_TPMA_OBJECT_Unmarshal,
587                  authPolicy, Tss2_MU_TPM2B_DIGEST_Unmarshal,
588                  parameters, type, Tss2_MU_TPMU_PUBLIC_PARMS_Unmarshal,
589                  unique, type, Tss2_MU_TPMU_PUBLIC_ID_Unmarshal)
590 
591 TPMT_MARSHAL_2(TPMT_PUBLIC_PARMS, type, VAL, Tss2_MU_UINT16_Marshal,
592                parameters, ADDR, type, Tss2_MU_TPMU_PUBLIC_PARMS_Marshal)
593 
594 TPMT_UNMARSHAL_2(TPMT_PUBLIC_PARMS, type, Tss2_MU_UINT16_Unmarshal,
595                  parameters, type, Tss2_MU_TPMU_PUBLIC_PARMS_Unmarshal)
596 
597 TPMT_MARSHAL_TK(TPMT_TK_CREATION, tag, Tss2_MU_UINT16_Marshal,
598                 hierarchy, Tss2_MU_UINT32_Marshal, digest, Tss2_MU_TPM2B_DIGEST_Marshal)
599 
600 TPMT_UNMARSHAL_TK(TPMT_TK_CREATION, tag, Tss2_MU_UINT16_Unmarshal,
601                   hierarchy, Tss2_MU_UINT32_Unmarshal, digest, Tss2_MU_TPM2B_DIGEST_Unmarshal)
602 
603 TPMT_MARSHAL_TK(TPMT_TK_VERIFIED, tag, Tss2_MU_UINT16_Marshal,
604                 hierarchy, Tss2_MU_UINT32_Marshal, digest, Tss2_MU_TPM2B_DIGEST_Marshal)
605 
606 TPMT_UNMARSHAL_TK(TPMT_TK_VERIFIED, tag, Tss2_MU_UINT16_Unmarshal,
607                   hierarchy, Tss2_MU_UINT32_Unmarshal, digest, Tss2_MU_TPM2B_DIGEST_Unmarshal)
608 
609 TPMT_MARSHAL_TK(TPMT_TK_AUTH, tag, Tss2_MU_UINT16_Marshal,
610                 hierarchy, Tss2_MU_UINT32_Marshal, digest, Tss2_MU_TPM2B_DIGEST_Marshal)
611 
612 TPMT_UNMARSHAL_TK(TPMT_TK_AUTH, tag, Tss2_MU_UINT16_Unmarshal,
613                   hierarchy, Tss2_MU_UINT32_Unmarshal, digest, Tss2_MU_TPM2B_DIGEST_Unmarshal)
614 
615 TPMT_MARSHAL_TK(TPMT_TK_HASHCHECK, tag, Tss2_MU_UINT16_Marshal,
616                 hierarchy, Tss2_MU_UINT32_Marshal, digest, Tss2_MU_TPM2B_DIGEST_Marshal)
617 
618 TPMT_UNMARSHAL_TK(TPMT_TK_HASHCHECK, tag, Tss2_MU_UINT16_Unmarshal,
619                   hierarchy, Tss2_MU_UINT32_Unmarshal, digest, Tss2_MU_TPM2B_DIGEST_Unmarshal)
620