aboutsummaryrefslogtreecommitdiffstats
path: root/tpm-util/duplicate/include/marshal.h
blob: 09d4aed7a48a4178170b19e32e63ca9a9b750b70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
/*
 * Copyright 2018 Intel Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *     Unless required by applicable law or agreed to in writing, software
 *     distributed under the License is distributed on an "AS IS" BASIS,
 *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *     See the License for the specific language governing permissions and
 *     limitations under the License.
 */
// Author: Arun Kumar Sekar


#ifndef __MARSHAL_H__
#define __MARSHAL_H__

#include <sapi/tpm20.h>
#include <sapi/implementation.h>
#define pAssert(a)  ((void)0)
#define UNREFERENCED(a) ((void)(a))

#if NO_AUTO_ALIGN == YES || LITTLE_ENDIAN_TPM == YES
#define BYTE_ARRAY_TO_UINT8(b)   (UINT8)((b)[0])

#define BYTE_ARRAY_TO_UINT16(b)  (UINT16)(  ((b)[0] <<  8) \
                                          +  (b)[1])

#define BYTE_ARRAY_TO_UINT32(b)  (UINT32)(  ((b)[0] << 24) \
                                          + ((b)[1] << 16) \
                                          + ((b)[2] << 8 ) \
                                          +  (b)[3])

#define BYTE_ARRAY_TO_UINT64(b)  (UINT64)(  ((UINT64)(b)[0] << 56) \
                                          + ((UINT64)(b)[1] << 48) \
                                          + ((UINT64)(b)[2] << 40) \
                                          + ((UINT64)(b)[3] << 32) \
                                          + ((UINT64)(b)[4] << 24) \
                                          + ((UINT64)(b)[5] << 16) \
                                          + ((UINT64)(b)[6] <<  8) \
                                          +  (UINT64)(b)[7])

// Disaggregate a UINT into a byte array
#define UINT8_TO_BYTE_ARRAY(i, b)     ((b)[0] = (BYTE)(i), i)

#define UINT16_TO_BYTE_ARRAY(i, b)    ((b)[0] = (BYTE)((i) >>  8), \
                                       (b)[1] = (BYTE) (i),        \
                                       (i))

#define UINT32_TO_BYTE_ARRAY(i, b)    ((b)[0] = (BYTE)((i) >> 24), \
                                       (b)[1] = (BYTE)((i) >> 16), \
                                       (b)[2] = (BYTE)((i) >>  8), \
                                       (b)[3] = (BYTE) (i),        \
                                       (i))

#define UINT64_TO_BYTE_ARRAY(i, b)    ((b)[0] = (BYTE)((i) >> 56), \
                                       (b)[1] = (BYTE)((i) >> 48), \
                                       (b)[2] = (BYTE)((i) >> 40), \
                                       (b)[3] = (BYTE)((i) >> 32), \
                                       (b)[4] = (BYTE)((i) >> 24), \
                                       (b)[5] = (BYTE)((i) >> 16), \
                                       (b)[6] = (BYTE)((i) >>  8), \
                                       (b)[7] = (BYTE) (i),        \
                                       (i))

#else

// the big-endian macros for machines that allow unaligned memory access
// Aggregate a byte array into a UINT
#define BYTE_ARRAY_TO_UINT8(b)        *((UINT8  *)(b))
#define BYTE_ARRAY_TO_UINT16(b)       *((UINT16 *)(b))
#define BYTE_ARRAY_TO_UINT32(b)       *((UINT32 *)(b))
#define BYTE_ARRAY_TO_UINT64(b)       *((UINT64 *)(b))

// Disaggregate a UINT into a byte array


#define UINT8_TO_BYTE_ARRAY(i, b)   (*((UINT8  *)(b)) = (i))
#define UINT16_TO_BYTE_ARRAY(i, b)  (*((UINT16 *)(b)) = (i))
#define UINT32_TO_BYTE_ARRAY(i, b)  (*((UINT32 *)(b)) = (i))
#define UINT64_TO_BYTE_ARRAY(i, b)  (*((UINT64 *)(b)) = (i))


#endif  // NO_AUTO_ALIGN == YES




// Table 2:3 - Definition of Base Types (BaseTypes)
//   UINT8 definition from table 2:3
TPM_RC
UINT8_Unmarshal(UINT8 *target, BYTE **buffer, INT32 *size);
UINT16
UINT8_Marshal(UINT8 *source, BYTE **buffer, INT32 *size);

//   BYTE definition from table 2:3
#define BYTE_Unmarshal(target, buffer, size) \
            UINT8_Unmarshal((UINT8 *)(target), buffer, size)
#define BYTE_Marshal(source, buffer, size) \
            UINT8_Marshal((UINT8 *)(source), buffer, size)
//   INT8 definition from table 2:3
#define INT8_Unmarshal(target, buffer, size) \
            UINT8_Unmarshal((UINT8 *)(target), buffer, size)
//     INT8_Marshal not referenced
//   UINT16 definition from table 2:3
TPM_RC
UINT16_Unmarshal(UINT16 *target, BYTE **buffer, INT32 *size);
UINT16
UINT16_Marshal(UINT16 *source, BYTE **buffer, INT32 *size);

//   INT16 definition from table 2:3
//     INT16_Unmarshal not referenced
//     INT16_Marshal not referenced
//   UINT32 definition from table 2:3
TPM_RC
UINT32_Unmarshal(UINT32 *target, BYTE **buffer, INT32 *size);
UINT16
UINT32_Marshal(UINT32 *source, BYTE **buffer, INT32 *size);

//   INT32 definition from table 2:3
#define INT32_Unmarshal(target, buffer, size) \
            UINT32_Unmarshal((UINT32 *)(target), buffer, size)
//     INT32_Marshal not referenced
//   UINT64 definition from table 2:3
TPM_RC
UINT64_Unmarshal(UINT64 *target, BYTE **buffer, INT32 *size);
UINT16
UINT64_Marshal(UINT64 *source, BYTE **buffer, INT32 *size);

//   INT64 definition from table 2:3
//     INT64_Unmarshal not referenced
//     INT64_Marshal not referenced


// Table 2:4 - Defines for Logic Values (DefinesTable)


// Table 2:5 - Definition of Types for Documentation Clarity (TypesTable)
//   UINT32 definition from table 2:5
//     TPM_ALGORITHM_ID_Unmarshal not referenced
//     TPM_ALGORITHM_ID_Marshal not referenced
//   UINT32 definition from table 2:5
//     TPM_MODIFIER_INDICATOR_Unmarshal not referenced
//     TPM_MODIFIER_INDICATOR_Marshal not referenced
//   UINT32 definition from table 2:5
//     TPM_AUTHORIZATION_SIZE_Unmarshal not referenced
//     TPM_AUTHORIZATION_SIZE_Marshal not referenced
//   UINT32 definition from table 2:5
//     TPM_PARAMETER_SIZE_Unmarshal not referenced
//     TPM_PARAMETER_SIZE_Marshal not referenced
//   UINT16 definition from table 2:5
//     TPM_KEY_SIZE_Unmarshal not referenced
//     TPM_KEY_SIZE_Marshal not referenced
//   UINT16 definition from table 2:5
#define TPM_KEY_BITS_Unmarshal(target, buffer, size) \
            UINT16_Unmarshal((UINT16 *)(target), buffer, size)
#define TPM_KEY_BITS_Marshal(source, buffer, size) \
            UINT16_Marshal((UINT16 *)(source), buffer, size)


// Table 2:6 - Definition of TPM_SPEC Constants  (ConstantsTable)
//     TPM_SPEC_Unmarshal not referenced
//     TPM_SPEC_Marshal not referenced


// Table 2:7 - Definition of TPM_GENERATED Constants  (ConstantsTable)
//     TPM_GENERATED_Unmarshal not referenced
#define TPM_GENERATED_Marshal(source, buffer, size) \
            UINT32_Marshal((UINT32 *)(source), buffer, size)


// Table 2:9 - Definition of TPM_ALG_ID Constants  (ConstantsTable)
#define TPM_ALG_ID_Unmarshal(target, buffer, size) \
            UINT16_Unmarshal((UINT16 *)(target), buffer, size)
#define TPM_ALG_ID_Marshal(source, buffer, size) \
            UINT16_Marshal((UINT16 *)(source), buffer, size)


// Table 2:10 - Definition of TPM_ECC_CURVE Constants  (ConstantsTable)
#ifdef    TPM_ALG_ECC
#define TPM_ECC_CURVE_Unmarshal(target, buffer, size) \
            UINT16_Unmarshal((UINT16 *)(target), buffer, size)
#define TPM_ECC_CURVE_Marshal(source, buffer, size) \
            UINT16_Marshal((UINT16 *)(source), buffer, size)
#endif // TPM_ALG_ECC


// Table 2:13 - Definition of TPM_CC Constants  (ConstantsTable)
#define TPM_CC_Unmarshal(target, buffer, size) \
            UINT32_Unmarshal((UINT32 *)(target), buffer, size)
#define TPM_CC_Marshal(source, buffer, size) \
            UINT32_Marshal((UINT32 *)(source), buffer, size)


// Table 2:17 - Definition of TPM_RC Constants  (ConstantsTable)
//     TPM_RC_Unmarshal not referenced
#define TPM_RC_Marshal(source, buffer, size) \
            UINT32_Marshal((UINT32 *)(source), buffer, size)


// Table 2:18 - Definition of TPM_CLOCK_ADJUST Constants  (ConstantsTable)
TPM_RC
TPM_CLOCK_ADJUST_Unmarshal(TPM_CLOCK_ADJUST *target, BYTE **buffer, INT32 *size);

//     TPM_CLOCK_ADJUST_Marshal not referenced


// Table 2:19 - Definition of TPM_EO Constants  (ConstantsTable)
TPM_RC
TPM_EO_Unmarshal(TPM_EO *target, BYTE **buffer, INT32 *size);

//     TPM_EO_Marshal not referenced


// Table 2:20 - Definition of TPM_ST Constants  (ConstantsTable)
#define TPM_ST_Unmarshal(target, buffer, size) \
            UINT16_Unmarshal((UINT16 *)(target), buffer, size)
#define TPM_ST_Marshal(source, buffer, size) \
            UINT16_Marshal((UINT16 *)(source), buffer, size)


// Table 2:21 - Definition of TPM_SU Constants  (ConstantsTable)
TPM_RC
TPM_SU_Unmarshal(TPM_SU *target, BYTE **buffer, INT32 *size);

//     TPM_SU_Marshal not referenced


// Table 2:22 - Definition of TPM_SE Constants  (ConstantsTable)
TPM_RC
TPM_SE_Unmarshal(TPM_SE *target, BYTE **buffer, INT32 *size);

//     TPM_SE_Marshal not referenced


// Table 2:23 - Definition of TPM_CAP Constants (ConstantsTable)
TPM_RC
TPM_CAP_Unmarshal(TPM_CAP *target, BYTE **buffer, INT32 *size);

#define TPM_CAP_Marshal(source, buffer, size) \
            UINT32_Marshal((UINT32 *)(source), buffer, size)


// Table 2:24 - Definition of TPM_PT Constants  (ConstantsTable)
//     TPM_PT_Unmarshal not referenced
#define TPM_PT_Marshal(source, buffer, size) \
            UINT32_Marshal((UINT32 *)(source), buffer, size)


// Table 2:25 - Definition of TPM_PT_PCR Constants  (ConstantsTable)
//     TPM_PT_PCR_Unmarshal not referenced
//     TPM_PT_PCR_Marshal not referenced


// Table 2:26 - Definition of TPM_PS Constants  (ConstantsTable)
//     TPM_PS_Unmarshal not referenced
//     TPM_PS_Marshal not referenced


// Table 2:27 - Definition of Types for Handles (TypesTable)
//   UINT32 definition from table 2:27
#define TPM_HANDLE_Unmarshal(target, buffer, size) \
            UINT32_Unmarshal((UINT32 *)(target), buffer, size)
#define TPM_HANDLE_Marshal(source, buffer, size) \
            UINT32_Marshal((UINT32 *)(source), buffer, size)


// Table 2:28 - Definition of TPM_HT Constants  (ConstantsTable)
//     TPM_HT_Unmarshal not referenced
//     TPM_HT_Marshal not referenced


// Table 2:29 - Definition of TPM_RH Constants  (ConstantsTable)
//     TPM_RH_Unmarshal not referenced
//     TPM_RH_Marshal not referenced


// Table 2:30 - Definition of TPM_HC Constants  (ConstantsTable)
//     TPM_HC_Unmarshal not referenced
//     TPM_HC_Marshal not referenced


// Table 2:31 - Definition of TPMA_ALGORITHM Bits (BitsTable)
//     TPMA_ALGORITHM_Unmarshal not referenced
#define TPMA_ALGORITHM_Marshal(source, buffer, size) \
            UINT32_Marshal((UINT32 *)(source), buffer, size)


// Table 2:32 - Definition of TPMA_OBJECT Bits (BitsTable)
TPM_RC
TPMA_OBJECT_Unmarshal(TPMA_OBJECT *target, BYTE **buffer, INT32 *size);

#define TPMA_OBJECT_Marshal(source, buffer, size) \
            UINT32_Marshal((UINT32 *)(source), buffer, size)


// Table 2:33 - Definition of TPMA_SESSION Bits  (BitsTable)
TPM_RC
TPMA_SESSION_Unmarshal(TPMA_SESSION *target, BYTE **buffer, INT32 *size);

#define TPMA_SESSION_Marshal(source, buffer, size) \
            UINT8_Marshal((UINT8 *)(source), buffer, size)


// Table 2:34 - Definition of TPMA_LOCALITY Bits  (BitsTable)
#define TPMA_LOCALITY_Unmarshal(target, buffer, size) \
            UINT8_Unmarshal((UINT8 *)(target), buffer, size)
#define TPMA_LOCALITY_Marshal(source, buffer, size) \
            UINT8_Marshal((UINT8 *)(source), buffer, size)


// Table 2:35 - Definition of TPMA_PERMANENT Bits  (BitsTable)
//     TPMA_PERMANENT_Unmarshal not referenced
//     TPMA_PERMANENT_Marshal not referenced


// Table 2:36 - Definition of TPMA_STARTUP_CLEAR Bits  (BitsTable)
//     TPMA_STARTUP_CLEAR_Unmarshal not referenced
//     TPMA_STARTUP_CLEAR_Marshal not referenced


// Table 2:37 - Definition of TPMA_MEMORY Bits  (BitsTable)
//     TPMA_MEMORY_Unmarshal not referenced
//     TPMA_MEMORY_Marshal not referenced


// Table 2:38 - Definition of TPMA_CC Bits  (BitsTable)
//     TPMA_CC_Unmarshal not referenced
#define TPMA_CC_Marshal(source, buffer, size) \
            UINT32_Marshal((UINT32 *)(source), buffer, size)


// Table 2:39 - Definition of TPMI_YES_NO Type (TypeTable)
TPM_RC
TPMI_YES_NO_Unmarshal(TPMI_YES_NO *target, BYTE **buffer, INT32 *size);

#define TPMI_YES_NO_Marshal(source, buffer, size) \
            BYTE_Marshal((BYTE *)(source), buffer, size)


// Table 2:40 - Definition of TPMI_DH_OBJECT Type  (TypeTable)
TPM_RC
TPMI_DH_OBJECT_Unmarshal(TPMI_DH_OBJECT *target, BYTE **buffer, INT32 *size, BOOL flag);

#define TPMI_DH_OBJECT_Marshal(source, buffer, size) \
            TPM_HANDLE_Marshal((TPM_HANDLE *)(source), buffer, size)


// Table 2:41 - Definition of TPMI_DH_PERSISTENT Type  (TypeTable)
TPM_RC
TPMI_DH_PERSISTENT_Unmarshal(TPMI_DH_PERSISTENT *target, BYTE **buffer, INT32 *size);

//     TPMI_DH_PERSISTENT_Marshal not referenced


// Table 2:42 - Definition of TPMI_DH_ENTITY Type  (TypeTable)
TPM_RC
TPMI_DH_ENTITY_Unmarshal(TPMI_DH_ENTITY *target, BYTE **buffer, INT32 *size, BOOL flag);

//     TPMI_DH_ENTITY_Marshal not referenced


// Table 2:43 - Definition of TPMI_DH_PCR Type  (TypeTable)
TPM_RC
TPMI_DH_PCR_Unmarshal(TPMI_DH_PCR *target, BYTE **buffer, INT32 *size, BOOL flag);

//     TPMI_DH_PCR_Marshal not referenced


// Table 2:44 - Definition of TPMI_SH_AUTH_SESSION Type  (TypeTable)
TPM_RC
TPMI_SH_AUTH_SESSION_Unmarshal(TPMI_SH_AUTH_SESSION *target, BYTE **buffer, INT32 *size, BOOL flag);

#define TPMI_SH_AUTH_SESSION_Marshal(source, buffer, size) \
            TPM_HANDLE_Marshal((TPM_HANDLE *)(source), buffer, size)


// Table 2:45 - Definition of TPMI_SH_HMAC Type  (TypeTable)
TPM_RC
TPMI_SH_HMAC_Unmarshal(TPMI_SH_HMAC *target, BYTE **buffer, INT32 *size);

//     TPMI_SH_HMAC_Marshal not referenced


// Table 2:46 - Definition of TPMI_SH_POLICY Type  (TypeTable)
TPM_RC
TPMI_SH_POLICY_Unmarshal(TPMI_SH_POLICY *target, BYTE **buffer, INT32 *size);

//     TPMI_SH_POLICY_Marshal not referenced


// Table 2:47 - Definition of TPMI_DH_CONTEXT Type  (TypeTable)
TPM_RC
TPMI_DH_CONTEXT_Unmarshal(TPMI_DH_CONTEXT *target, BYTE **buffer, INT32 *size);

#define TPMI_DH_CONTEXT_Marshal(source, buffer, size) \
            TPM_HANDLE_Marshal((TPM_HANDLE *)(source), buffer, size)


// Table 2:48 - Definition of TPMI_RH_HIERARCHY Type  (TypeTable)
TPM_RC
TPMI_RH_HIERARCHY_Unmarshal(TPMI_RH_HIERARCHY *target, BYTE **buffer, INT32 *size, BOOL flag);

#define TPMI_RH_HIERARCHY_Marshal(source, buffer, size) \
            TPM_HANDLE_Marshal((TPM_HANDLE *)(source), buffer, size)


// Table 2:49 - Definition of TPMI_RH_ENABLES Type  (TypeTable)
TPM_RC
TPMI_RH_ENABLES_Unmarshal(TPMI_RH_ENABLES *target, BYTE **buffer, INT32 *size, BOOL flag);

//     TPMI_RH_ENABLES_Marshal not referenced


// Table 2:50 - Definition of TPMI_RH_HIERARCHY_AUTH Type  (TypeTable)
TPM_RC
TPMI_RH_HIERARCHY_AUTH_Unmarshal(TPMI_RH_HIERARCHY_AUTH *target, BYTE **buffer, INT32 *size);

//     TPMI_RH_HIERARCHY_AUTH_Marshal not referenced


// Table 2:51 - Definition of TPMI_RH_PLATFORM Type  (TypeTable)
TPM_RC
TPMI_RH_PLATFORM_Unmarshal(TPMI_RH_PLATFORM *target, BYTE **buffer, INT32 *size);

//     TPMI_RH_PLATFORM_Marshal not referenced


// Table 2:52 - Definition of TPMI_RH_OWNER Type  (TypeTable)
//     TPMI_RH_OWNER_Unmarshal not referenced
//     TPMI_RH_OWNER_Marshal not referenced


// Table 2:53 - Definition of TPMI_RH_ENDORSEMENT Type  (TypeTable)
TPM_RC
TPMI_RH_ENDORSEMENT_Unmarshal(TPMI_RH_ENDORSEMENT *target, BYTE **buffer, INT32 *size, BOOL flag);

//     TPMI_RH_ENDORSEMENT_Marshal not referenced


// Table 2:54 - Definition of TPMI_RH_PROVISION Type  (TypeTable)
TPM_RC
TPMI_RH_PROVISION_Unmarshal(TPMI_RH_PROVISION *target, BYTE **buffer, INT32 *size);

//     TPMI_RH_PROVISION_Marshal not referenced


// Table 2:55 - Definition of TPMI_RH_CLEAR Type  (TypeTable)
TPM_RC
TPMI_RH_CLEAR_Unmarshal(TPMI_RH_CLEAR *target, BYTE **buffer, INT32 *size);

//     TPMI_RH_CLEAR_Marshal not referenced


// Table 2:56 - Definition of TPMI_RH_NV_AUTH Type  (TypeTable)
TPM_RC
TPMI_RH_NV_AUTH_Unmarshal(TPMI_RH_NV_AUTH *target, BYTE **buffer, INT32 *size);

//     TPMI_RH_NV_AUTH_Marshal not referenced


// Table 2:57 - Definition of TPMI_RH_LOCKOUT Type  (TypeTable)
TPM_RC
TPMI_RH_LOCKOUT_Unmarshal(TPMI_RH_LOCKOUT *target, BYTE **buffer, INT32 *size);

//     TPMI_RH_LOCKOUT_Marshal not referenced


// Table 2:58 - Definition of TPMI_RH_NV_INDEX Type  (TypeTable)
TPM_RC
TPMI_RH_NV_INDEX_Unmarshal(TPMI_RH_NV_INDEX *target, BYTE **buffer, INT32 *size);

#define TPMI_RH_NV_INDEX_Marshal(source, buffer, size) \
            TPM_HANDLE_Marshal((TPM_HANDLE *)(source), buffer, size)


// Table 2:59 - Definition of TPMI_ALG_HASH Type  (TypeTable)
TPM_RC
TPMI_ALG_HASH_Unmarshal(TPMI_ALG_HASH *target, BYTE **buffer, INT32 *size, BOOL flag);

#define TPMI_ALG_HASH_Marshal(source, buffer, size) \
            TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)


// Table 2:60 - Definition of TPMI_ALG_ASYM Type (TypeTable)
//     TPMI_ALG_ASYM_Unmarshal not referenced
//     TPMI_ALG_ASYM_Marshal not referenced


// Table 2:61 - Definition of TPMI_ALG_SYM Type (TypeTable)
TPM_RC
TPMI_ALG_SYM_Unmarshal(TPMI_ALG_SYM *target, BYTE **buffer, INT32 *size, BOOL flag);

//     TPMI_ALG_SYM_Marshal not referenced


// Table 2:62 - Definition of TPMI_ALG_SYM_OBJECT Type (TypeTable)
TPM_RC
TPMI_ALG_SYM_OBJECT_Unmarshal(TPMI_ALG_SYM_OBJECT *target, BYTE **buffer, INT32 *size, BOOL flag);

#define TPMI_ALG_SYM_OBJECT_Marshal(source, buffer, size) \
            TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)


// Table 2:63 - Definition of TPMI_ALG_SYM_MODE Type (TypeTable)
TPM_RC
TPMI_ALG_SYM_MODE_Unmarshal(TPMI_ALG_SYM_MODE *target, BYTE **buffer, INT32 *size, BOOL flag);

#define TPMI_ALG_SYM_MODE_Marshal(source, buffer, size) \
            TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)


// Table 2:64 - Definition of TPMI_ALG_KDF Type (TypeTable)
TPM_RC
TPMI_ALG_KDF_Unmarshal(TPMI_ALG_KDF *target, BYTE **buffer, INT32 *size, BOOL flag);

#define TPMI_ALG_KDF_Marshal(source, buffer, size) \
            TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)


// Table 2:65 - Definition of TPMI_ALG_SIG_SCHEME Type (TypeTable)
TPM_RC
TPMI_ALG_SIG_SCHEME_Unmarshal(TPMI_ALG_SIG_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);

#define TPMI_ALG_SIG_SCHEME_Marshal(source, buffer, size) \
            TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)


// Table 2:66 - Definition of TPMI_ECC_KEY_EXCHANGE Type (TypeTable)
#ifdef    TPM_ALG_ECC
TPM_RC
TPMI_ECC_KEY_EXCHANGE_Unmarshal(TPMI_ECC_KEY_EXCHANGE *target, BYTE **buffer, INT32 *size, BOOL flag);

//     TPMI_ECC_KEY_EXCHANGE_Marshal not referenced
#endif // TPM_ALG_ECC


// Table 2:67 - Definition of TPMI_ST_COMMAND_TAG Type (TypeTable)
TPM_RC
TPMI_ST_COMMAND_TAG_Unmarshal(TPMI_ST_COMMAND_TAG *target, BYTE **buffer, INT32 *size);

//     TPMI_ST_COMMAND_TAG_Marshal not referenced
TPM_RC
TPMS_EMPTY_Unmarshal(TPMS_EMPTY *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_EMPTY_Marshal(TPMS_EMPTY *source, BYTE **buffer, INT32 *size);


// Table 2:69 - Definition of TPMS_ALGORITHM_DESCRIPTION Structure  (StructureTable)
//     TPMS_ALGORITHM_DESCRIPTION_Unmarshal not referenced
//     TPMS_ALGORITHM_DESCRIPTION_Marshal not referenced


// Table 2:70 - Definition of TPMU_HA Union  (UnionTable)
TPM_RC
TPMU_HA_Unmarshal(TPMU_HA *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_HA_Marshal(TPMU_HA *source, BYTE **buffer, INT32 *size, UINT32 selector);


// Table 2:71 - Definition of TPMT_HA Structure  (StructureTable)
TPM_RC
TPMT_HA_Unmarshal(TPMT_HA *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_HA_Marshal(TPMT_HA *source, BYTE **buffer, INT32 *size);


// Table 2:72 - Definition of TPM2B_DIGEST Structure (StructureTable)
TPM_RC
TPM2B_DIGEST_Unmarshal(TPM2B_DIGEST *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_DIGEST_Marshal(TPM2B_DIGEST *source, BYTE **buffer, INT32 *size);


// Table 2:73 - Definition of TPM2B_DATA Structure (StructureTable)
TPM_RC
TPM2B_DATA_Unmarshal(TPM2B_DATA *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_DATA_Marshal(TPM2B_DATA *source, BYTE **buffer, INT32 *size);


// Table 2:74 - Definition of Types for TPM2B_NONCE (TypesTable)
//   TPM2B_DIGEST definition from table 2:74
#define TPM2B_NONCE_Unmarshal(target, buffer, size) \
            TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)(target), buffer, size)
#define TPM2B_NONCE_Marshal(source, buffer, size) \
            TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)(source), buffer, size)


// Table 2:75 - Definition of Types for TPM2B_AUTH (TypesTable)
//   TPM2B_DIGEST definition from table 2:75
#define TPM2B_AUTH_Unmarshal(target, buffer, size) \
            TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)(target), buffer, size)
#define TPM2B_AUTH_Marshal(source, buffer, size) \
            TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)(source), buffer, size)


// Table 2:76 - Definition of Types for TPM2B_OPERAND (TypesTable)
//   TPM2B_DIGEST definition from table 2:76
#define TPM2B_OPERAND_Unmarshal(target, buffer, size) \
            TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)(target), buffer, size)
//     TPM2B_OPERAND_Marshal not referenced


// Table 2:77 - Definition of TPM2B_EVENT Structure (StructureTable)
TPM_RC
TPM2B_EVENT_Unmarshal(TPM2B_EVENT *target, BYTE **buffer, INT32 *size);

//     TPM2B_EVENT_Marshal not referenced


// Table 2:78 - Definition of TPM2B_MAX_BUFFER Structure (StructureTable)
TPM_RC
TPM2B_MAX_BUFFER_Unmarshal(TPM2B_MAX_BUFFER *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_MAX_BUFFER_Marshal(TPM2B_MAX_BUFFER *source, BYTE **buffer, INT32 *size);


// Table 2:79 - Definition of TPM2B_MAX_NV_BUFFER Structure (StructureTable)
TPM_RC
TPM2B_MAX_NV_BUFFER_Unmarshal(TPM2B_MAX_NV_BUFFER *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_MAX_NV_BUFFER_Marshal(TPM2B_MAX_NV_BUFFER *source, BYTE **buffer, INT32 *size);


// Table 2:80 - Definition of TPM2B_TIMEOUT Structure  (StructureTable)
TPM_RC
TPM2B_TIMEOUT_Unmarshal(TPM2B_TIMEOUT *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_TIMEOUT_Marshal(TPM2B_TIMEOUT *source, BYTE **buffer, INT32 *size);


// Table 2:81 - Definition of TPM2B_IV Structure  (StructureTable)
TPM_RC
TPM2B_IV_Unmarshal(TPM2B_IV *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_IV_Marshal(TPM2B_IV *source, BYTE **buffer, INT32 *size);


// Table 2:82 - Definition of TPMU_NAME Union  (UnionTable)


// Table 2:83 - Definition of TPM2B_NAME Structure (StructureTable)
TPM_RC
TPM2B_NAME_Unmarshal(TPM2B_NAME *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_NAME_Marshal(TPM2B_NAME *source, BYTE **buffer, INT32 *size);


// Table 2:84 - Definition of TPMS_PCR_SELECT Structure (StructureTable)
//     TPMS_PCR_SELECT_Unmarshal not referenced
//     TPMS_PCR_SELECT_Marshal not referenced


// Table 2:85 - Definition of TPMS_PCR_SELECTION Structure (StructureTable)
TPM_RC
TPMS_PCR_SELECTION_Unmarshal(TPMS_PCR_SELECTION *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_PCR_SELECTION_Marshal(TPMS_PCR_SELECTION *source, BYTE **buffer, INT32 *size);


// Table 2:88 - Definition of TPMT_TK_CREATION Structure (StructureTable)
TPM_RC
TPMT_TK_CREATION_Unmarshal(TPMT_TK_CREATION *target, BYTE **buffer, INT32 *size);
UINT16
TPMT_TK_CREATION_Marshal(TPMT_TK_CREATION *source, BYTE **buffer, INT32 *size);


// Table 2:89 - Definition of TPMT_TK_VERIFIED Structure (StructureTable)
TPM_RC
TPMT_TK_VERIFIED_Unmarshal(TPMT_TK_VERIFIED *target, BYTE **buffer, INT32 *size);
UINT16
TPMT_TK_VERIFIED_Marshal(TPMT_TK_VERIFIED *source, BYTE **buffer, INT32 *size);


// Table 2:90 - Definition of TPMT_TK_AUTH Structure (StructureTable)
TPM_RC
TPMT_TK_AUTH_Unmarshal(TPMT_TK_AUTH *target, BYTE **buffer, INT32 *size);
UINT16
TPMT_TK_AUTH_Marshal(TPMT_TK_AUTH *source, BYTE **buffer, INT32 *size);


// Table 2:91 - Definition of TPMT_TK_HASHCHECK Structure (StructureTable)
TPM_RC
TPMT_TK_HASHCHECK_Unmarshal(TPMT_TK_HASHCHECK *target, BYTE **buffer, INT32 *size);
UINT16
TPMT_TK_HASHCHECK_Marshal(TPMT_TK_HASHCHECK *source, BYTE **buffer, INT32 *size);


// Table 2:92 - Definition of TPMS_ALG_PROPERTY Structure  (StructureTable)
//     TPMS_ALG_PROPERTY_Unmarshal not referenced
UINT16
TPMS_ALG_PROPERTY_Marshal(TPMS_ALG_PROPERTY *source, BYTE **buffer, INT32 *size);


// Table 2:93 - Definition of TPMS_TAGGED_PROPERTY Structure  (StructureTable)
//     TPMS_TAGGED_PROPERTY_Unmarshal not referenced
UINT16
TPMS_TAGGED_PROPERTY_Marshal(TPMS_TAGGED_PROPERTY *source, BYTE **buffer, INT32 *size);


// Table 2:94 - Definition of TPMS_TAGGED_PCR_SELECT Structure  (StructureTable)
//     TPMS_TAGGED_PCR_SELECT_Unmarshal not referenced
UINT16
TPMS_TAGGED_PCR_SELECT_Marshal(TPMS_TAGGED_PCR_SELECT *source, BYTE **buffer, INT32 *size);


// Table 2:95 - Definition of TPML_CC Structure (StructureTable)
TPM_RC
TPML_CC_Unmarshal(TPML_CC *target, BYTE **buffer, INT32 *size);
UINT16
TPML_CC_Marshal(TPML_CC *source, BYTE **buffer, INT32 *size);


// Table 2:96 - Definition of TPML_CCA Structure  (StructureTable)
//     TPML_CCA_Unmarshal not referenced
UINT16
TPML_CCA_Marshal(TPML_CCA *source, BYTE **buffer, INT32 *size);


// Table 2:97 - Definition of TPML_ALG Structure (StructureTable)
TPM_RC
TPML_ALG_Unmarshal(TPML_ALG *target, BYTE **buffer, INT32 *size);
UINT16
TPML_ALG_Marshal(TPML_ALG *source, BYTE **buffer, INT32 *size);


// Table 2:98 - Definition of TPML_HANDLE Structure  (StructureTable)
//     TPML_HANDLE_Unmarshal not referenced
UINT16
TPML_HANDLE_Marshal(TPML_HANDLE *source, BYTE **buffer, INT32 *size);


// Table 2:99 - Definition of TPML_DIGEST Structure (StructureTable)
TPM_RC
TPML_DIGEST_Unmarshal(TPML_DIGEST *target, BYTE **buffer, INT32 *size);
UINT16
TPML_DIGEST_Marshal(TPML_DIGEST *source, BYTE **buffer, INT32 *size);


// Table 2:100 - Definition of TPML_DIGEST_VALUES Structure (StructureTable)
TPM_RC
TPML_DIGEST_VALUES_Unmarshal(TPML_DIGEST_VALUES *target, BYTE **buffer, INT32 *size);
UINT16
TPML_DIGEST_VALUES_Marshal(TPML_DIGEST_VALUES *source, BYTE **buffer, INT32 *size);


// Table 2:101 - Definition of TPM2B_DIGEST_VALUES Structure (StructureTable)
//     TPM2B_DIGEST_VALUES_Unmarshal not referenced
//     TPM2B_DIGEST_VALUES_Marshal not referenced


// Table 2:102 - Definition of TPML_PCR_SELECTION Structure (StructureTable)
TPM_RC
TPML_PCR_SELECTION_Unmarshal(TPML_PCR_SELECTION *target, BYTE **buffer, INT32 *size);
UINT16
TPML_PCR_SELECTION_Marshal(TPML_PCR_SELECTION *source, BYTE **buffer, INT32 *size);


// Table 2:103 - Definition of TPML_ALG_PROPERTY Structure  (StructureTable)
//     TPML_ALG_PROPERTY_Unmarshal not referenced
UINT16
TPML_ALG_PROPERTY_Marshal(TPML_ALG_PROPERTY *source, BYTE **buffer, INT32 *size);


// Table 2:104 - Definition of TPML_TAGGED_TPM_PROPERTY Structure  (StructureTable)
//     TPML_TAGGED_TPM_PROPERTY_Unmarshal not referenced
UINT16
TPML_TAGGED_TPM_PROPERTY_Marshal(TPML_TAGGED_TPM_PROPERTY *source, BYTE **buffer, INT32 *size);


// Table 2:105 - Definition of TPML_TAGGED_PCR_PROPERTY Structure  (StructureTable)
//     TPML_TAGGED_PCR_PROPERTY_Unmarshal not referenced
UINT16
TPML_TAGGED_PCR_PROPERTY_Marshal(TPML_TAGGED_PCR_PROPERTY *source, BYTE **buffer, INT32 *size);


// Table 2:106 - Definition of TPML_ECC_CURVE Structure  (StructureTable)
#ifdef    TPM_ALG_ECC
//     TPML_ECC_CURVE_Unmarshal not referenced
UINT16
TPML_ECC_CURVE_Marshal(TPML_ECC_CURVE *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_ECC


// Table 2:107 - Definition of TPMU_CAPABILITIES Union  (UnionTable)
//     TPMU_CAPABILITIES_Unmarshal not referenced
UINT16
TPMU_CAPABILITIES_Marshal(TPMU_CAPABILITIES *source, BYTE **buffer, INT32 *size, UINT32 selector);


// Table 2:108 - Definition of TPMS_CAPABILITY_DATA Structure  (StructureTable)
//     TPMS_CAPABILITY_DATA_Unmarshal not referenced
UINT16
TPMS_CAPABILITY_DATA_Marshal(TPMS_CAPABILITY_DATA *source, BYTE **buffer, INT32 *size);


// Table 2:109 - Definition of TPMS_CLOCK_INFO Structure (StructureTable)
//     TPMS_CLOCK_INFO_Unmarshal not referenced
UINT16
TPMS_CLOCK_INFO_Marshal(TPMS_CLOCK_INFO *source, BYTE **buffer, INT32 *size);


// Table 2:110 - Definition of TPMS_TIME_INFO Structure (StructureTable)
//     TPMS_TIME_INFO_Unmarshal not referenced
UINT16
TPMS_TIME_INFO_Marshal(TPMS_TIME_INFO *source, BYTE **buffer, INT32 *size);


// Table 2:111 - Definition of TPMS_TIME_ATTEST_INFO Structure  (StructureTable)
//     TPMS_TIME_ATTEST_INFO_Unmarshal not referenced
UINT16
TPMS_TIME_ATTEST_INFO_Marshal(TPMS_TIME_ATTEST_INFO *source, BYTE **buffer, INT32 *size);


// Table 2:112 - Definition of TPMS_CERTIFY_INFO Structure  (StructureTable)
//     TPMS_CERTIFY_INFO_Unmarshal not referenced
UINT16
TPMS_CERTIFY_INFO_Marshal(TPMS_CERTIFY_INFO *source, BYTE **buffer, INT32 *size);


// Table 2:113 - Definition of TPMS_QUOTE_INFO Structure  (StructureTable)
//     TPMS_QUOTE_INFO_Unmarshal not referenced
UINT16
TPMS_QUOTE_INFO_Marshal(TPMS_QUOTE_INFO *source, BYTE **buffer, INT32 *size);


// Table 2:114 - Definition of TPMS_COMMAND_AUDIT_INFO Structure  (StructureTable)
//     TPMS_COMMAND_AUDIT_INFO_Unmarshal not referenced
UINT16
TPMS_COMMAND_AUDIT_INFO_Marshal(TPMS_COMMAND_AUDIT_INFO *source, BYTE **buffer, INT32 *size);


// Table 2:115 - Definition of TPMS_SESSION_AUDIT_INFO Structure  (StructureTable)
//     TPMS_SESSION_AUDIT_INFO_Unmarshal not referenced
UINT16
TPMS_SESSION_AUDIT_INFO_Marshal(TPMS_SESSION_AUDIT_INFO *source, BYTE **buffer, INT32 *size);


// Table 2:116 - Definition of TPMS_CREATION_INFO Structure  (StructureTable)
//     TPMS_CREATION_INFO_Unmarshal not referenced
UINT16
TPMS_CREATION_INFO_Marshal(TPMS_CREATION_INFO *source, BYTE **buffer, INT32 *size);


// Table 2:117 - Definition of TPMS_NV_CERTIFY_INFO Structure  (StructureTable)
//     TPMS_NV_CERTIFY_INFO_Unmarshal not referenced
UINT16
TPMS_NV_CERTIFY_INFO_Marshal(TPMS_NV_CERTIFY_INFO *source, BYTE **buffer, INT32 *size);


// Table 2:118 - Definition of TPMI_ST_ATTEST Type  (TypeTable)
//     TPMI_ST_ATTEST_Unmarshal not referenced
#define TPMI_ST_ATTEST_Marshal(source, buffer, size) \
            TPM_ST_Marshal((TPM_ST *)(source), buffer, size)


// Table 2:119 - Definition of TPMU_ATTEST Union  (UnionTable)
//     TPMU_ATTEST_Unmarshal not referenced
UINT16
TPMU_ATTEST_Marshal(TPMU_ATTEST *source, BYTE **buffer, INT32 *size, UINT32 selector);


// Table 2:120 - Definition of TPMS_ATTEST Structure  (StructureTable)
//     TPMS_ATTEST_Unmarshal not referenced
UINT16
TPMS_ATTEST_Marshal(TPMS_ATTEST *source, BYTE **buffer, INT32 *size);


// Table 2:121 - Definition of TPM2B_ATTEST Structure  (StructureTable)
//     TPM2B_ATTEST_Unmarshal not referenced
UINT16
TPM2B_ATTEST_Marshal(TPM2B_ATTEST *source, BYTE **buffer, INT32 *size);


// Table 2:122 - Definition of TPMS_AUTH_COMMAND Structure  (StructureTable)
//     TPMS_AUTH_COMMAND_Unmarshal not referenced
//     TPMS_AUTH_COMMAND_Marshal not referenced


// Table 2:123 - Definition of TPMS_AUTH_RESPONSE Structure  (StructureTable)
//     TPMS_AUTH_RESPONSE_Unmarshal not referenced
//     TPMS_AUTH_RESPONSE_Marshal not referenced


// Table 2:124 - Definition of TPMI_AES_KEY_BITS Type (TypeTable)
#ifdef    TPM_ALG_AES
TPM_RC
TPMI_AES_KEY_BITS_Unmarshal(TPMI_AES_KEY_BITS *target, BYTE **buffer, INT32 *size);

#define TPMI_AES_KEY_BITS_Marshal(source, buffer, size) \
            TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)(source), buffer, size)
#endif // TPM_ALG_AES


// Table 2:124 - Definition of TPMI_SM4_KEY_BITS Type (TypeTable)
#ifdef    TPM_ALG_SM4
TPM_RC
TPMI_SM4_KEY_BITS_Unmarshal(TPMI_SM4_KEY_BITS *target, BYTE **buffer, INT32 *size);

#define TPMI_SM4_KEY_BITS_Marshal(source, buffer, size) \
            TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)(source), buffer, size)
#endif // TPM_ALG_SM4


// Table 2:124 - Definition of TPMI_CAMELLIA_KEY_BITS Type (TypeTable)
#ifdef    TPM_ALG_CAMELLIA
TPM_RC
TPMI_CAMELLIA_KEY_BITS_Unmarshal(TPMI_CAMELLIA_KEY_BITS *target, BYTE **buffer, INT32 *size);

#define TPMI_CAMELLIA_KEY_BITS_Marshal(source, buffer, size) \
            TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)(source), buffer, size)
#endif // TPM_ALG_CAMELLIA


// Table 2:125 - Definition of TPMU_SYM_KEY_BITS Union (UnionTable)
TPM_RC
TPMU_SYM_KEY_BITS_Unmarshal(TPMU_SYM_KEY_BITS *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_SYM_KEY_BITS_Marshal(TPMU_SYM_KEY_BITS *source, BYTE **buffer, INT32 *size, UINT32 selector);


// Table 2:126 - Definition of TPMU_SYM_MODE Union (UnionTable)
TPM_RC
TPMU_SYM_MODE_Unmarshal(TPMU_SYM_MODE *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_SYM_MODE_Marshal(TPMU_SYM_MODE *source, BYTE **buffer, INT32 *size, UINT32 selector);


// Table 2:128 - Definition of TPMT_SYM_DEF Structure (StructureTable)
TPM_RC
TPMT_SYM_DEF_Unmarshal(TPMT_SYM_DEF *target, BYTE **buffer, INT32 *size, BOOL flag);

//     TPMT_SYM_DEF_Marshal not referenced


// Table 2:129 - Definition of TPMT_SYM_DEF_OBJECT Structure (StructureTable)
TPM_RC
TPMT_SYM_DEF_OBJECT_Unmarshal(TPMT_SYM_DEF_OBJECT *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_SYM_DEF_OBJECT_Marshal(TPMT_SYM_DEF_OBJECT *source, BYTE **buffer, INT32 *size);


// Table 2:130 - Definition of TPM2B_SYM_KEY Structure (StructureTable)
TPM_RC
TPM2B_SYM_KEY_Unmarshal(TPM2B_SYM_KEY *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_SYM_KEY_Marshal(TPM2B_SYM_KEY *source, BYTE **buffer, INT32 *size);


// Table 2:131 - Definition of TPMS_SYMCIPHER_PARMS Structure (StructureTable)
#define TPMS_SYMCIPHER_PARMS_Unmarshal(target, buffer, size) \
            TPMT_SYM_DEF_OBJECT_Unmarshal((TPMT_SYM_DEF_OBJECT *)&((target)->sym), buffer, size, 0)
#define TPMS_SYMCIPHER_PARMS_Marshal(source, buffer, size) \
            TPMT_SYM_DEF_OBJECT_Marshal((TPMT_SYM_DEF_OBJECT *)&((source)->sym), buffer, size)


// Table 2:132 - Definition of TPM2B_SENSITIVE_DATA Structure (StructureTable)
TPM_RC
TPM2B_SENSITIVE_DATA_Unmarshal(TPM2B_SENSITIVE_DATA *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_SENSITIVE_DATA_Marshal(TPM2B_SENSITIVE_DATA *source, BYTE **buffer, INT32 *size);


// Table 2:133 - Definition of TPMS_SENSITIVE_CREATE Structure  (StructureTable)
TPM_RC
TPMS_SENSITIVE_CREATE_Unmarshal(TPMS_SENSITIVE_CREATE *target, BYTE **buffer, INT32 *size);

//     TPMS_SENSITIVE_CREATE_Marshal not referenced


// Table 2:134 - Definition of TPM2B_SENSITIVE_CREATE Structure  (StructureTable)
TPM_RC
TPM2B_SENSITIVE_CREATE_Unmarshal(TPM2B_SENSITIVE_CREATE *target, BYTE **buffer, INT32 *size);

//     TPM2B_SENSITIVE_CREATE_Marshal not referenced


// Table 2:135 - Definition of TPMS_SCHEME_HASH Structure (StructureTable)
#define TPMS_SCHEME_HASH_Unmarshal(target, buffer, size) \
            TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&((target)->hashAlg), buffer, size, 0)
#define TPMS_SCHEME_HASH_Marshal(source, buffer, size) \
            TPMI_ALG_HASH_Marshal((TPMI_ALG_HASH *)&((source)->hashAlg), buffer, size)


// Table 2:136 - Definition of TPMS_SCHEME_ECDAA Structure (StructureTable)
#ifdef    TPM_ALG_ECC
TPM_RC
TPMS_SCHEME_ECDAA_Unmarshal(TPMS_SCHEME_ECDAA *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_SCHEME_ECDAA_Marshal(TPMS_SCHEME_ECDAA *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_ECC


// Table 2:137 - Definition of TPMI_ALG_KEYEDHASH_SCHEME Type (TypeTable)
TPM_RC
TPMI_ALG_KEYEDHASH_SCHEME_Unmarshal(TPMI_ALG_KEYEDHASH_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);

#define TPMI_ALG_KEYEDHASH_SCHEME_Marshal(source, buffer, size) \
            TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)


// Table 2:138 - Definition of Types for HMAC_SIG_SCHEME (TypesTable)
//   TPMS_SCHEME_HASH definition from table 2:138
#define TPMS_SCHEME_HMAC_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SCHEME_HMAC_Marshal(source, buffer, size) \
            TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)


// Table 2:139 - Definition of TPMS_SCHEME_XOR Structure (StructureTable)
TPM_RC
TPMS_SCHEME_XOR_Unmarshal(TPMS_SCHEME_XOR *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMS_SCHEME_XOR_Marshal(TPMS_SCHEME_XOR *source, BYTE **buffer, INT32 *size);


// Table 2:140 - Definition of TPMU_SCHEME_KEYEDHASH Union  (UnionTable)
TPM_RC
TPMU_SCHEME_KEYEDHASH_Unmarshal(TPMU_SCHEME_KEYEDHASH *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_SCHEME_KEYEDHASH_Marshal(TPMU_SCHEME_KEYEDHASH *source, BYTE **buffer, INT32 *size, UINT32 selector);


// Table 2:141 - Definition of TPMT_KEYEDHASH_SCHEME Structure (StructureTable)
TPM_RC
TPMT_KEYEDHASH_SCHEME_Unmarshal(TPMT_KEYEDHASH_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_KEYEDHASH_SCHEME_Marshal(TPMT_KEYEDHASH_SCHEME *source, BYTE **buffer, INT32 *size);


// Table 2:142 - Definition of Types for RSA Signature Schemes  (TypesTable)
#ifdef    TPM_ALG_RSA
//   TPMS_SCHEME_HASH definition from table 2:142
#ifdef    TPM_ALG_RSA
#define TPMS_SIG_SCHEME_RSASSA_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SIG_SCHEME_RSASSA_Marshal(source, buffer, size) \
            TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
#endif // TPM_ALG_RSA
//   TPMS_SCHEME_HASH definition from table 2:142
#ifdef    TPM_ALG_RSA
#define TPMS_SIG_SCHEME_RSAPSS_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SIG_SCHEME_RSAPSS_Marshal(source, buffer, size) \
            TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
#endif // TPM_ALG_RSA
#endif // TPM_ALG_RSA


// Table 2:143 - Definition of Types for ECC Signature Schemes  (TypesTable)
#ifdef    TPM_ALG_ECC
//   TPMS_SCHEME_HASH definition from table 2:143
#ifdef    TPM_ALG_ECC
#define TPMS_SIG_SCHEME_ECDSA_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SIG_SCHEME_ECDSA_Marshal(source, buffer, size) \
            TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
#endif // TPM_ALG_ECC
//   TPMS_SCHEME_HASH definition from table 2:143
#ifdef    TPM_ALG_ECC
#define TPMS_SIG_SCHEME_SM2_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SIG_SCHEME_SM2_Marshal(source, buffer, size) \
            TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
#endif // TPM_ALG_ECC
//   TPMS_SCHEME_HASH definition from table 2:143
#ifdef    TPM_ALG_ECC
#define TPMS_SIG_SCHEME_ECSCHNORR_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SIG_SCHEME_ECSCHNORR_Marshal(source, buffer, size) \
            TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
#endif // TPM_ALG_ECC
//   TPMS_SCHEME_ECDAA definition from table 2:143
#ifdef    TPM_ALG_ECC
#define TPMS_SIG_SCHEME_ECDAA_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_ECDAA_Unmarshal((TPMS_SCHEME_ECDAA *)(target), buffer, size)
#define TPMS_SIG_SCHEME_ECDAA_Marshal(source, buffer, size) \
            TPMS_SCHEME_ECDAA_Marshal((TPMS_SCHEME_ECDAA *)(source), buffer, size)
#endif // TPM_ALG_ECC
#endif // TPM_ALG_ECC


// Table 2:144 - Definition of TPMU_SIG_SCHEME Union  (UnionTable)
TPM_RC
TPMU_SIG_SCHEME_Unmarshal(TPMU_SIG_SCHEME *target, BYTE **buffer, INT32 *size, UINT32 selector);

//     TPMU_SIG_SCHEME_Marshal not referenced


// Table 2:145 - Definition of TPMT_SIG_SCHEME Structure (StructureTable)
TPM_RC
TPMT_SIG_SCHEME_Unmarshal(TPMT_SIG_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);

//     TPMT_SIG_SCHEME_Marshal not referenced


// Table 2:146 - Definition of Types for Encryption Schemes (TypesTable)
#ifdef    TPM_ALG_RSA
//   TPMS_SCHEME_HASH definition from table 2:146
#ifdef    TPM_ALG_RSA
#define TPMS_ENC_SCHEME_OAEP_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_ENC_SCHEME_OAEP_Marshal(source, buffer, size) \
            TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
#endif // TPM_ALG_RSA
//   TPMS_EMPTY definition from table 2:146
#ifdef    TPM_ALG_RSA
#define TPMS_ENC_SCHEME_RSAES_Unmarshal(target, buffer, size) \
            TPMS_EMPTY_Unmarshal((TPMS_EMPTY *)(target), buffer, size)
#define TPMS_ENC_SCHEME_RSAES_Marshal(source, buffer, size) \
            TPMS_EMPTY_Marshal((TPMS_EMPTY *)(source), buffer, size)
#endif // TPM_ALG_RSA
#endif // TPM_ALG_RSA


// Table 2:147 - Definition of Types for ECC Key Exchange (TypesTable)
#ifdef    TPM_ALG_ECC
//   TPMS_SCHEME_HASH definition from table 2:147
#ifdef    TPM_ALG_ECC
#define TPMS_KEY_SCHEME_ECDH_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_KEY_SCHEME_ECDH_Marshal(source, buffer, size) \
            TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
#endif // TPM_ALG_ECC
//   TPMS_SCHEME_HASH definition from table 2:147
#ifdef    TPM_ALG_ECC
#define TPMS_KEY_SCHEME_ECMQV_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_KEY_SCHEME_ECMQV_Marshal(source, buffer, size) \
            TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
#endif // TPM_ALG_ECC
#endif // TPM_ALG_ECC


// Table 2:148 - Definition of Types for KDF Schemes (TypesTable)
//   TPMS_SCHEME_HASH definition from table 2:148
#define TPMS_SCHEME_MGF1_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SCHEME_MGF1_Marshal(source, buffer, size) \
            TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
//   TPMS_SCHEME_HASH definition from table 2:148
#define TPMS_SCHEME_KDF1_SP800_56A_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SCHEME_KDF1_SP800_56A_Marshal(source, buffer, size) \
            TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
//   TPMS_SCHEME_HASH definition from table 2:148
#define TPMS_SCHEME_KDF2_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SCHEME_KDF2_Marshal(source, buffer, size) \
            TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)
//   TPMS_SCHEME_HASH definition from table 2:148
#define TPMS_SCHEME_KDF1_SP800_108_Unmarshal(target, buffer, size) \
            TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), buffer, size)
#define TPMS_SCHEME_KDF1_SP800_108_Marshal(source, buffer, size) \
            TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), buffer, size)


// Table 2:149 - Definition of TPMU_KDF_SCHEME Union  (UnionTable)
TPM_RC
TPMU_KDF_SCHEME_Unmarshal(TPMU_KDF_SCHEME *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_KDF_SCHEME_Marshal(TPMU_KDF_SCHEME *source, BYTE **buffer, INT32 *size, UINT32 selector);


// Table 2:150 - Definition of TPMT_KDF_SCHEME Structure (StructureTable)
TPM_RC
TPMT_KDF_SCHEME_Unmarshal(TPMT_KDF_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_KDF_SCHEME_Marshal(TPMT_KDF_SCHEME *source, BYTE **buffer, INT32 *size);


// Table 2:151 - Definition of TPMI_ALG_ASYM_SCHEME Type  (TypeTable)
//     TPMI_ALG_ASYM_SCHEME_Unmarshal not referenced
//     TPMI_ALG_ASYM_SCHEME_Marshal not referenced


// Table 2:152 - Definition of TPMU_ASYM_SCHEME Union (UnionTable)
TPM_RC
TPMU_ASYM_SCHEME_Unmarshal(TPMU_ASYM_SCHEME *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_ASYM_SCHEME_Marshal(TPMU_ASYM_SCHEME *source, BYTE **buffer, INT32 *size, UINT32 selector);


// Table 2:153 - Definition of TPMT_ASYM_SCHEME Structure  (StructureTable)
//     TPMT_ASYM_SCHEME_Unmarshal not referenced
//     TPMT_ASYM_SCHEME_Marshal not referenced


// Table 2:154 - Definition of TPMI_ALG_RSA_SCHEME Type (TypeTable)
#ifdef    TPM_ALG_RSA
TPM_RC
TPMI_ALG_RSA_SCHEME_Unmarshal(TPMI_ALG_RSA_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);

#define TPMI_ALG_RSA_SCHEME_Marshal(source, buffer, size) \
            TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)
#endif // TPM_ALG_RSA


// Table 2:155 - Definition of TPMT_RSA_SCHEME Structure (StructureTable)
#ifdef    TPM_ALG_RSA
TPM_RC
TPMT_RSA_SCHEME_Unmarshal(TPMT_RSA_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_RSA_SCHEME_Marshal(TPMT_RSA_SCHEME *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_RSA


// Table 2:156 - Definition of TPMI_ALG_RSA_DECRYPT Type (TypeTable)
#ifdef    TPM_ALG_RSA
TPM_RC
TPMI_ALG_RSA_DECRYPT_Unmarshal(TPMI_ALG_RSA_DECRYPT *target, BYTE **buffer, INT32 *size, BOOL flag);

//     TPMI_ALG_RSA_DECRYPT_Marshal not referenced
#endif // TPM_ALG_RSA


// Table 2:157 - Definition of TPMT_RSA_DECRYPT Structure (StructureTable)
#ifdef    TPM_ALG_RSA
TPM_RC
TPMT_RSA_DECRYPT_Unmarshal(TPMT_RSA_DECRYPT *target, BYTE **buffer, INT32 *size, BOOL flag);

//     TPMT_RSA_DECRYPT_Marshal not referenced
#endif // TPM_ALG_RSA


// Table 2:158 - Definition of TPM2B_PUBLIC_KEY_RSA Structure (StructureTable)
#ifdef    TPM_ALG_RSA
TPM_RC
TPM2B_PUBLIC_KEY_RSA_Unmarshal(TPM2B_PUBLIC_KEY_RSA *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_PUBLIC_KEY_RSA_Marshal(TPM2B_PUBLIC_KEY_RSA *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_RSA


// Table 2:159 - Definition of TPMI_RSA_KEY_BITS Type (TypeTable)
#ifdef    TPM_ALG_RSA
TPM_RC
TPMI_RSA_KEY_BITS_Unmarshal(TPMI_RSA_KEY_BITS *target, BYTE **buffer, INT32 *size);

#define TPMI_RSA_KEY_BITS_Marshal(source, buffer, size) \
            TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)(source), buffer, size)
#endif // TPM_ALG_RSA


// Table 2:160 - Definition of TPM2B_PRIVATE_KEY_RSA Structure (StructureTable)
#ifdef    TPM_ALG_RSA
TPM_RC
TPM2B_PRIVATE_KEY_RSA_Unmarshal(TPM2B_PRIVATE_KEY_RSA *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_PRIVATE_KEY_RSA_Marshal(TPM2B_PRIVATE_KEY_RSA *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_RSA


// Table 2:161 - Definition of TPM2B_ECC_PARAMETER Structure (StructureTable)
#ifdef    TPM_ALG_ECC
TPM_RC
TPM2B_ECC_PARAMETER_Unmarshal(TPM2B_ECC_PARAMETER *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_ECC_PARAMETER_Marshal(TPM2B_ECC_PARAMETER *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_ECC


// Table 2:162 - Definition of TPMS_ECC_POINT Structure (StructureTable)
#ifdef    TPM_ALG_ECC
TPM_RC
TPMS_ECC_POINT_Unmarshal(TPMS_ECC_POINT *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_ECC_POINT_Marshal(TPMS_ECC_POINT *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_ECC


// Table 2:163 - Definition of TPM2B_ECC_POINT Structure (StructureTable)
#ifdef    TPM_ALG_ECC
TPM_RC
TPM2B_ECC_POINT_Unmarshal(TPM2B_ECC_POINT *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_ECC_POINT_Marshal(TPM2B_ECC_POINT *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_ECC


// Table 2:164 - Definition of TPMI_ALG_ECC_SCHEME Type (TypeTable)
#ifdef    TPM_ALG_ECC
TPM_RC
TPMI_ALG_ECC_SCHEME_Unmarshal(TPMI_ALG_ECC_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);

#define TPMI_ALG_ECC_SCHEME_Marshal(source, buffer, size) \
            TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)
#endif // TPM_ALG_ECC


// Table 2:165 - Definition of TPMI_ECC_CURVE Type (TypeTable)
#ifdef    TPM_ALG_ECC
TPM_RC
TPMI_ECC_CURVE_Unmarshal(TPMI_ECC_CURVE *target, BYTE **buffer, INT32 *size);

#define TPMI_ECC_CURVE_Marshal(source, buffer, size) \
            TPM_ECC_CURVE_Marshal((TPM_ECC_CURVE *)(source), buffer, size)
#endif // TPM_ALG_ECC


// Table 2:166 - Definition of TPMT_ECC_SCHEME Structure (StructureTable)
#ifdef    TPM_ALG_ECC
TPM_RC
TPMT_ECC_SCHEME_Unmarshal(TPMT_ECC_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_ECC_SCHEME_Marshal(TPMT_ECC_SCHEME *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_ECC


// Table 2:167 - Definition of TPMS_ALGORITHM_DETAIL_ECC Structure  (StructureTable)
#ifdef    TPM_ALG_ECC
//     TPMS_ALGORITHM_DETAIL_ECC_Unmarshal not referenced
UINT16
TPMS_ALGORITHM_DETAIL_ECC_Marshal(TPMS_ALGORITHM_DETAIL_ECC *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_ECC


// Table 2:168 - Definition of TPMS_SIGNATURE_RSA Structure (StructureTable)
#ifdef    TPM_ALG_RSA
TPM_RC
TPMS_SIGNATURE_RSA_Unmarshal(TPMS_SIGNATURE_RSA *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_SIGNATURE_RSA_Marshal(TPMS_SIGNATURE_RSA *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_RSA


// Table 2:169 - Definition of Types for Signature  (TypesTable)
#ifdef    TPM_ALG_RSA
//   TPMS_SIGNATURE_RSA definition from table 2:169
#ifdef    TPM_ALG_RSA
#define TPMS_SIGNATURE_RSASSA_Unmarshal(target, buffer, size) \
            TPMS_SIGNATURE_RSA_Unmarshal((TPMS_SIGNATURE_RSA *)(target), buffer, size)
#define TPMS_SIGNATURE_RSASSA_Marshal(source, buffer, size) \
            TPMS_SIGNATURE_RSA_Marshal((TPMS_SIGNATURE_RSA *)(source), buffer, size)
#endif // TPM_ALG_RSA
//   TPMS_SIGNATURE_RSA definition from table 2:169
#ifdef    TPM_ALG_RSA
#define TPMS_SIGNATURE_RSAPSS_Unmarshal(target, buffer, size) \
            TPMS_SIGNATURE_RSA_Unmarshal((TPMS_SIGNATURE_RSA *)(target), buffer, size)
#define TPMS_SIGNATURE_RSAPSS_Marshal(source, buffer, size) \
            TPMS_SIGNATURE_RSA_Marshal((TPMS_SIGNATURE_RSA *)(source), buffer, size)
#endif // TPM_ALG_RSA
#endif // TPM_ALG_RSA


// Table 2:170 - Definition of TPMS_SIGNATURE_ECC Structure (StructureTable)
#ifdef    TPM_ALG_ECC
TPM_RC
TPMS_SIGNATURE_ECC_Unmarshal(TPMS_SIGNATURE_ECC *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_SIGNATURE_ECC_Marshal(TPMS_SIGNATURE_ECC *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_ECC


// Table 2:171 - Definition of Types for TPMS_SIGNATUE_ECC (TypesTable)
#ifdef    TPM_ALG_ECC
//   TPMS_SIGNATURE_ECC definition from table 2:171
#ifdef    TPM_ALG_ECC
#define TPMS_SIGNATURE_ECDSA_Unmarshal(target, buffer, size) \
            TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)(target), buffer, size)
#define TPMS_SIGNATURE_ECDSA_Marshal(source, buffer, size) \
            TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)(source), buffer, size)
#endif // TPM_ALG_ECC
//   TPMS_SIGNATURE_ECC definition from table 2:171
#ifdef    TPM_ALG_ECC
#define TPMS_SIGNATURE_SM2_Unmarshal(target, buffer, size) \
            TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)(target), buffer, size)
#define TPMS_SIGNATURE_SM2_Marshal(source, buffer, size) \
            TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)(source), buffer, size)
#endif // TPM_ALG_ECC
//   TPMS_SIGNATURE_ECC definition from table 2:171
#ifdef    TPM_ALG_ECC
#define TPMS_SIGNATURE_ECSCHNORR_Unmarshal(target, buffer, size) \
            TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)(target), buffer, size)
#define TPMS_SIGNATURE_ECSCHNORR_Marshal(source, buffer, size) \
            TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)(source), buffer, size)
#endif // TPM_ALG_ECC
//   TPMS_SIGNATURE_ECC definition from table 2:171
#ifdef    TPM_ALG_ECC
#define TPMS_SIGNATURE_ECDAA_Unmarshal(target, buffer, size) \
            TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)(target), buffer, size)
#define TPMS_SIGNATURE_ECDAA_Marshal(source, buffer, size) \
            TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)(source), buffer, size)
#endif // TPM_ALG_ECC
#endif // TPM_ALG_ECC


// Table 2:172 - Definition of TPMU_SIGNATURE Union  (UnionTable)
TPM_RC
TPMU_SIGNATURE_Unmarshal(TPMU_SIGNATURE *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_SIGNATURE_Marshal(TPMU_SIGNATURE *source, BYTE **buffer, INT32 *size, UINT32 selector);


// Table 2:173 - Definition of TPMT_SIGNATURE Structure (StructureTable)
TPM_RC
TPMT_SIGNATURE_Unmarshal(TPMT_SIGNATURE *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_SIGNATURE_Marshal(TPMT_SIGNATURE *source, BYTE **buffer, INT32 *size);


// Table 2:174 - Definition of TPMU_ENCRYPTED_SECRET Union  (UnionTable)
//     TPMU_ENCRYPTED_SECRET_Unmarshal not referenced
//     TPMU_ENCRYPTED_SECRET_Marshal not referenced


// Table 2:175 - Definition of TPM2B_ENCRYPTED_SECRET Structure (StructureTable)
TPM_RC
TPM2B_ENCRYPTED_SECRET_Unmarshal(TPM2B_ENCRYPTED_SECRET *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_ENCRYPTED_SECRET_Marshal(TPM2B_ENCRYPTED_SECRET *source, BYTE **buffer, INT32 *size);


// Table 2:176 - Definition of TPMI_ALG_PUBLIC Type (TypeTable)
TPM_RC
TPMI_ALG_PUBLIC_Unmarshal(TPMI_ALG_PUBLIC *target, BYTE **buffer, INT32 *size);

#define TPMI_ALG_PUBLIC_Marshal(source, buffer, size) \
            TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), buffer, size)


// Table 2:177 - Definition of TPMU_PUBLIC_ID Union  (UnionTable)
TPM_RC
TPMU_PUBLIC_ID_Unmarshal(TPMU_PUBLIC_ID *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_PUBLIC_ID_Marshal(TPMU_PUBLIC_ID *source, BYTE **buffer, INT32 *size, UINT32 selector);


// Table 2:178 - Definition of TPMS_KEYEDHASH_PARMS Structure (StructureTable)
#define TPMS_KEYEDHASH_PARMS_Unmarshal(target, buffer, size) \
            TPMT_KEYEDHASH_SCHEME_Unmarshal((TPMT_KEYEDHASH_SCHEME *)&((target)->scheme), buffer, size, 1)
#define TPMS_KEYEDHASH_PARMS_Marshal(source, buffer, size) \
            TPMT_KEYEDHASH_SCHEME_Marshal((TPMT_KEYEDHASH_SCHEME *)&((source)->scheme), buffer, size)


// Table 2:179 - Definition of TPMS_ASYM_PARMS Structure  (StructureTable)
//     TPMS_ASYM_PARMS_Unmarshal not referenced
//     TPMS_ASYM_PARMS_Marshal not referenced


// Table 2:180 - Definition of TPMS_RSA_PARMS Structure (StructureTable)
#ifdef    TPM_ALG_RSA
TPM_RC
TPMS_RSA_PARMS_Unmarshal(TPMS_RSA_PARMS *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_RSA_PARMS_Marshal(TPMS_RSA_PARMS *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_RSA


// Table 2:181 - Definition of TPMS_ECC_PARMS Structure (StructureTable)
#ifdef    TPM_ALG_ECC
TPM_RC
TPMS_ECC_PARMS_Unmarshal(TPMS_ECC_PARMS *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_ECC_PARMS_Marshal(TPMS_ECC_PARMS *source, BYTE **buffer, INT32 *size);

#endif // TPM_ALG_ECC


// Table 2:182 - Definition of TPMU_PUBLIC_PARMS Union  (UnionTable)
TPM_RC
TPMU_PUBLIC_PARMS_Unmarshal(TPMU_PUBLIC_PARMS *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_PUBLIC_PARMS_Marshal(TPMU_PUBLIC_PARMS *source, BYTE **buffer, INT32 *size, UINT32 selector);


// Table 2:183 - Definition of TPMT_PUBLIC_PARMS Structure (StructureTable)
TPM_RC
TPMT_PUBLIC_PARMS_Unmarshal(TPMT_PUBLIC_PARMS *target, BYTE **buffer, INT32 *size);

//     TPMT_PUBLIC_PARMS_Marshal not referenced


// Table 2:184 - Definition of TPMT_PUBLIC Structure (StructureTable)
TPM_RC
TPMT_PUBLIC_Unmarshal(TPMT_PUBLIC *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPMT_PUBLIC_Marshal(TPMT_PUBLIC *source, BYTE **buffer, INT32 *size);


// Table 2:185 - Definition of TPM2B_PUBLIC Structure (StructureTable)
TPM_RC
TPM2B_PUBLIC_Unmarshal(TPM2B_PUBLIC *target, BYTE **buffer, INT32 *size, BOOL flag);
UINT16
TPM2B_PUBLIC_Marshal(TPM2B_PUBLIC *source, BYTE **buffer, INT32 *size);


// Table 2:186 - Definition of TPM2B_PRIVATE_VENDOR_SPECIFIC Structure (StructureTable)
//     TPM2B_PRIVATE_VENDOR_SPECIFIC_Unmarshal not referenced
//     TPM2B_PRIVATE_VENDOR_SPECIFIC_Marshal not referenced


// Table 2:187 - Definition of TPMU_SENSITIVE_COMPOSITE Union  (UnionTable)
TPM_RC
TPMU_SENSITIVE_COMPOSITE_Unmarshal(TPMU_SENSITIVE_COMPOSITE *target, BYTE **buffer, INT32 *size, UINT32 selector);
UINT16
TPMU_SENSITIVE_COMPOSITE_Marshal(TPMU_SENSITIVE_COMPOSITE *source, BYTE **buffer, INT32 *size, UINT32 selector);


// Table 2:188 - Definition of TPMT_SENSITIVE Structure (StructureTable)
TPM_RC
TPMT_SENSITIVE_Unmarshal(TPMT_SENSITIVE *target, BYTE **buffer, INT32 *size);
UINT16
TPMT_SENSITIVE_Marshal(TPMT_SENSITIVE *source, BYTE **buffer, INT32 *size);


// Table 2:189 - Definition of TPM2B_SENSITIVE Structure  (StructureTable)
TPM_RC
TPM2B_SENSITIVE_Unmarshal(TPM2B_SENSITIVE *target, BYTE **buffer, INT32 *size);

//     TPM2B_SENSITIVE_Marshal not referenced


// Table 2:190 - Definition of _PRIVATE Structure  (StructureTable)
//     _PRIVATE_Unmarshal not referenced
//     _PRIVATE_Marshal not referenced


// Table 2:191 - Definition of TPM2B_PRIVATE Structure  (StructureTable)
TPM_RC
TPM2B_PRIVATE_Unmarshal(TPM2B_PRIVATE *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_PRIVATE_Marshal(TPM2B_PRIVATE *source, BYTE **buffer, INT32 *size);


// Table 2:192 - Definition of _ID_OBJECT Structure  (StructureTable)
//     _ID_OBJECT_Unmarshal not referenced
//     _ID_OBJECT_Marshal not referenced


// Table 2:193 - Definition of TPM2B_ID_OBJECT Structure  (StructureTable)
TPM_RC
TPM2B_ID_OBJECT_Unmarshal(TPM2B_ID_OBJECT *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_ID_OBJECT_Marshal(TPM2B_ID_OBJECT *source, BYTE **buffer, INT32 *size);


// Table 2:194 - Definition of TPM_NV_INDEX Bits  (BitsTable)
//     TPM_NV_INDEX_Unmarshal not referenced
//     TPM_NV_INDEX_Marshal not referenced


// Table 2:195 - Definition of TPMA_NV Bits (BitsTable)
TPM_RC
TPMA_NV_Unmarshal(TPMA_NV *target, BYTE **buffer, INT32 *size);

#define TPMA_NV_Marshal(source, buffer, size) \
            UINT32_Marshal((UINT32 *)(source), buffer, size)


// Table 2:196 - Definition of TPMS_NV_PUBLIC Structure (StructureTable)
TPM_RC
TPMS_NV_PUBLIC_Unmarshal(TPMS_NV_PUBLIC *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_NV_PUBLIC_Marshal(TPMS_NV_PUBLIC *source, BYTE **buffer, INT32 *size);


// Table 2:197 - Definition of TPM2B_NV_PUBLIC Structure (StructureTable)
TPM_RC
TPM2B_NV_PUBLIC_Unmarshal(TPM2B_NV_PUBLIC *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_NV_PUBLIC_Marshal(TPM2B_NV_PUBLIC *source, BYTE **buffer, INT32 *size);


// Table 2:198 - Definition of TPM2B_CONTEXT_SENSITIVE Structure  (StructureTable)
//     TPM2B_CONTEXT_SENSITIVE_Unmarshal not referenced
//     TPM2B_CONTEXT_SENSITIVE_Marshal not referenced


// Table 2:199 - Definition of TPMS_CONTEXT_DATA Structure  (StructureTable)
//     TPMS_CONTEXT_DATA_Unmarshal not referenced
//     TPMS_CONTEXT_DATA_Marshal not referenced


// Table 2:200 - Definition of TPM2B_CONTEXT_DATA Structure  (StructureTable)
TPM_RC
TPM2B_CONTEXT_DATA_Unmarshal(TPM2B_CONTEXT_DATA *target, BYTE **buffer, INT32 *size);
UINT16
TPM2B_CONTEXT_DATA_Marshal(TPM2B_CONTEXT_DATA *source, BYTE **buffer, INT32 *size);


// Table 2:201 - Definition of TPMS_CONTEXT Structure (StructureTable)
TPM_RC
TPMS_CONTEXT_Unmarshal(TPMS_CONTEXT *target, BYTE **buffer, INT32 *size);
UINT16
TPMS_CONTEXT_Marshal(TPMS_CONTEXT *source, BYTE **buffer, INT32 *size);


// Table 2:203 - Definition of TPMS_CREATION_DATA Structure  (StructureTable)
//     TPMS_CREATION_DATA_Unmarshal not referenced
UINT16
TPMS_CREATION_DATA_Marshal(TPMS_CREATION_DATA *source, BYTE **buffer, INT32 *size);


// Table 2:204 - Definition of TPM2B_CREATION_DATA Structure  (StructureTable)
//     TPM2B_CREATION_DATA_Unmarshal not referenced
UINT16
TPM2B_CREATION_DATA_Marshal(TPM2B_CREATION_DATA *source, BYTE **buffer, INT32 *size);

// Array Marshal/Unmarshal for TPMS_TAGGED_PROPERTY
//     TPMS_TAGGED_PROPERTY_Array_Unmarshal not referenced
UINT16
TPMS_TAGGED_PROPERTY_Array_Marshal(TPMS_TAGGED_PROPERTY *source, BYTE **buffer, INT32 *size, INT32 count);

// Array Marshal/Unmarshal for TPMS_ALG_PROPERTY
//     TPMS_ALG_PROPERTY_Array_Unmarshal not referenced
UINT16
TPMS_ALG_PROPERTY_Array_Marshal(TPMS_ALG_PROPERTY *source, BYTE **buffer, INT32 *size, INT32 count);

// Array Marshal/Unmarshal for TPMS_PCR_SELECTION
TPM_RC
TPMS_PCR_SELECTION_Array_Unmarshal(TPMS_PCR_SELECTION *target, BYTE **buffer, INT32 *size, INT32 count);
UINT16
TPMS_PCR_SELECTION_Array_Marshal(TPMS_PCR_SELECTION *source, BYTE **buffer, INT32 *size, INT32 count);

// Array Marshal/Unmarshal for TPMT_HA
TPM_RC
TPMT_HA_Array_Unmarshal(TPMT_HA *target, BYTE **buffer, INT32 *size, BOOL flag, INT32 count);
UINT16
TPMT_HA_Array_Marshal(TPMT_HA *source, BYTE **buffer, INT32 *size, INT32 count);

// Array Marshal/Unmarshal for BYTE
TPM_RC
BYTE_Array_Unmarshal(BYTE *target, BYTE **buffer, INT32 *size, INT32 count);
UINT16
BYTE_Array_Marshal(BYTE *source, BYTE **buffer, INT32 *size, INT32 count);

// Array Marshal/Unmarshal for TPM_HANDLE
//     TPM_HANDLE_Array_Unmarshal not referenced
UINT16
TPM_HANDLE_Array_Marshal(TPM_HANDLE *source, BYTE **buffer, INT32 *size, INT32 count);

// Array Marshal/Unmarshal for TPMA_CC
//     TPMA_CC_Array_Unmarshal not referenced
UINT16
TPMA_CC_Array_Marshal(TPMA_CC *source, BYTE **buffer, INT32 *size, INT32 count);

// Array Marshal/Unmarshal for TPMS_TAGGED_PCR_SELECT
//     TPMS_TAGGED_PCR_SELECT_Array_Unmarshal not referenced
UINT16
TPMS_TAGGED_PCR_SELECT_Array_Marshal(TPMS_TAGGED_PCR_SELECT *source, BYTE **buffer, INT32 *size, INT32 count);

// Array Marshal/Unmarshal for TPM_ECC_CURVE
#ifdef    TPM_ALG_ECC
//     TPM_ECC_CURVE_Array_Unmarshal not referenced
UINT16
TPM_ECC_CURVE_Array_Marshal(TPM_ECC_CURVE *source, BYTE **buffer, INT32 *size, INT32 count);

#endif // TPM_ALG_ECC
// Array Marshal/Unmarshal for TPM2B_DIGEST
TPM_RC
TPM2B_DIGEST_Array_Unmarshal(TPM2B_DIGEST *target, BYTE **buffer, INT32 *size, INT32 count);
UINT16
TPM2B_DIGEST_Array_Marshal(TPM2B_DIGEST *source, BYTE **buffer, INT32 *size, INT32 count);

// Array Marshal/Unmarshal for TPM_CC
TPM_RC
TPM_CC_Array_Unmarshal(TPM_CC *target, BYTE **buffer, INT32 *size, INT32 count);
UINT16
TPM_CC_Array_Marshal(TPM_CC *source, BYTE **buffer, INT32 *size, INT32 count);

// Array Marshal/Unmarshal for TPM_ALG_ID
TPM_RC
TPM_ALG_ID_Array_Unmarshal(TPM_ALG_ID *target, BYTE **buffer, INT32 *size, INT32 count);
UINT16
TPM_ALG_ID_Array_Marshal(TPM_ALG_ID *source, BYTE **buffer, INT32 *size, INT32 count);

#endif // _MARSHAL_FP_H