summaryrefslogtreecommitdiff
path: root/pcr/xen/patch-gcc7-vtpmmgr-make-inline-static.patch
blob: a2c96691a95f0a55fa016e1c209f292259975dbb (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
gcc7 is more strict with functions marked as inline. They are not
automatically inlined. Instead a function call is generated, but the
actual code is not visible by the linker.

Do a mechanical change and mark every 'inline' as 'static inline'. For
simpler review the static goes into an extra line.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 stubdom/vtpmmgr/marshal.h      | 76 ++++++++++++++++++++++++++++++++++++++++++
 stubdom/vtpmmgr/tcg.h          | 14 ++++++++
 stubdom/vtpmmgr/tpm2_marshal.h | 58 ++++++++++++++++++++++++++++++++
 stubdom/vtpmmgr/tpmrsa.h       |  1 +
 4 files changed, 149 insertions(+)

diff --git a/stubdom/vtpmmgr/marshal.h b/stubdom/vtpmmgr/marshal.h
index d826f19d89..dce19c6439 100644
--- a/stubdom/vtpmmgr/marshal.h
+++ b/stubdom/vtpmmgr/marshal.h
@@ -47,16 +47,19 @@ typedef enum UnpackPtr {
 	UNPACK_ALLOC
 } UnpackPtr;
 
+static
 inline BYTE* pack_BYTE(BYTE* ptr, BYTE t) {
 	ptr[0] = t;
 	return ++ptr;
 }
 
+static
 inline BYTE* unpack_BYTE(BYTE* ptr, BYTE* t) {
 	t[0] = ptr[0];
 	return ++ptr;
 }
 
+static
 inline int unpack3_BYTE(BYTE* ptr, UINT32* pos, UINT32 max, BYTE *t)
 {
 	if (*pos + 1 > max)
@@ -72,18 +75,21 @@ inline int unpack3_BYTE(BYTE* ptr, UINT32* pos, UINT32 max, BYTE *t)
 #define unpack3_BOOL(p, x, m, t) unpack3_BYTE(p, x, m, t)
 #define sizeof_BOOL(t) 1
 
+static
 inline BYTE* pack_UINT16(void* ptr, UINT16 t) {
 	UINT16* p = ptr;
 	*p = cpu_to_be16(t);
 	return ptr + sizeof(UINT16);
 }
 
+static
 inline BYTE* unpack_UINT16(void* ptr, UINT16* t) {
 	UINT16* p = ptr;
 	*t = be16_to_cpu(*p);
 	return ptr + sizeof(UINT16);
 }
 
+static
 inline int unpack3_UINT16(BYTE* ptr, UINT32* pos, UINT32 max, UINT16 *t)
 {
 	if (*pos + 2 > max)
@@ -93,18 +99,21 @@ inline int unpack3_UINT16(BYTE* ptr, UINT32* pos, UINT32 max, UINT16 *t)
 	return 0;
 }
 
+static
 inline BYTE* pack_UINT32(void* ptr, UINT32 t) {
 	UINT32* p = ptr;
 	*p = cpu_to_be32(t);
 	return ptr + sizeof(UINT32);
 }
 
+static
 inline BYTE* unpack_UINT32(void* ptr, UINT32* t) {
 	UINT32* p = ptr;
 	*t = be32_to_cpu(*p);
 	return ptr + sizeof(UINT32);
 }
 
+static
 inline int unpack3_UINT32(BYTE* ptr, UINT32* pos, UINT32 max, UINT32 *t)
 {
 	if (*pos + 4 > max)
@@ -236,16 +245,19 @@ inline int unpack3_UINT32(BYTE* ptr, UINT32* pos, UINT32 max, UINT32 *t)
 #define sizeof_TCS_KEY_HANDLE(t) sizeof_UINT32(t)
 
 
+static
 inline BYTE* pack_BUFFER(BYTE* ptr, const BYTE* buf, UINT32 size) {
 	memcpy(ptr, buf, size);
 	return ptr + size;
 }
 
+static
 inline BYTE* unpack_BUFFER(BYTE* ptr, BYTE* buf, UINT32 size) {
 	memcpy(buf, ptr, size);
 	return ptr + size;
 }
 
+static
 inline int unpack3_BUFFER(BYTE* ptr, UINT32* pos, UINT32 max, BYTE* buf, UINT32 size) {
 	if (*pos + size > max)
 		return TPM_SIZE;
@@ -256,11 +268,13 @@ inline int unpack3_BUFFER(BYTE* ptr, UINT32* pos, UINT32 max, BYTE* buf, UINT32
 
 #define sizeof_BUFFER(b, s) s
 
+static
 inline BYTE* unpack_ALIAS(BYTE* ptr, BYTE** buf, UINT32 size) {
 	*buf = ptr;
 	return ptr + size;
 }
 
+static
 inline BYTE* unpack_ALLOC(BYTE* ptr, BYTE** buf, UINT32 size) {
 	if(size) {
 		*buf = malloc(size);
@@ -271,6 +285,7 @@ inline BYTE* unpack_ALLOC(BYTE* ptr, BYTE** buf, UINT32 size) {
 	return ptr + size;
 }
 
+static
 inline BYTE* unpack_PTR(BYTE* ptr, BYTE** buf, UINT32 size, UnpackPtr alloc) {
 	if(alloc == UNPACK_ALLOC) {
 		return unpack_ALLOC(ptr, buf, size);
@@ -279,6 +294,7 @@ inline BYTE* unpack_PTR(BYTE* ptr, BYTE** buf, UINT32 size, UnpackPtr alloc) {
 	}
 }
 
+static
 inline int unpack3_PTR(BYTE* ptr, UINT32* pos, UINT32 max, BYTE** buf, UINT32 size, UnpackPtr alloc) {
 	if (size > max || *pos + size > max)
 		return TPM_SIZE;
@@ -292,14 +308,17 @@ inline int unpack3_PTR(BYTE* ptr, UINT32* pos, UINT32 max, BYTE** buf, UINT32 si
 }
 #define unpack3_VPTR(ptr, pos, max, buf, size, alloc) unpack3_PTR(ptr, pos, max, (void*)(buf), size, alloc)
 
+static
 inline BYTE* pack_TPM_AUTHDATA(BYTE* ptr, const TPM_AUTHDATA* d) {
 	return pack_BUFFER(ptr, *d, TPM_DIGEST_SIZE);
 }
 
+static
 inline BYTE* unpack_TPM_AUTHDATA(BYTE* ptr, TPM_AUTHDATA* d) {
 	return unpack_BUFFER(ptr, *d, TPM_DIGEST_SIZE);
 }
 
+static
 inline int unpack3_TPM_AUTHDATA(BYTE* ptr, UINT32* pos, UINT32 len, TPM_AUTHDATA* d) {
 	return unpack3_BUFFER(ptr, pos, len, *d, TPM_DIGEST_SIZE);
 }
@@ -325,6 +344,7 @@ inline int unpack3_TPM_AUTHDATA(BYTE* ptr, UINT32* pos, UINT32 len, TPM_AUTHDATA
 #define sizeof_TPM_TAG(t) sizeof_UINT16(t)
 #define sizeof_TPM_STRUCTURE_TAG(t) sizeof_UINT16(t)
 
+static
 inline BYTE* pack_TPM_VERSION(BYTE* ptr, const TPM_VERSION* t) {
 	ptr[0] = t->major;
 	ptr[1] = t->minor;
@@ -333,6 +353,7 @@ inline BYTE* pack_TPM_VERSION(BYTE* ptr, const TPM_VERSION* t) {
 	return ptr + 4;
 }
 
+static
 inline BYTE* unpack_TPM_VERSION(BYTE* ptr, TPM_VERSION* t) {
 	t->major = ptr[0];
 	t->minor = ptr[1];
@@ -341,6 +362,7 @@ inline BYTE* unpack_TPM_VERSION(BYTE* ptr, TPM_VERSION* t) {
 	return ptr + 4;
 }
 
+static
 inline int unpack3_TPM_VERSION(BYTE* ptr, UINT32 *pos, UINT32 max, TPM_VERSION* t) {
 	if (*pos + 4 > max)
 		return TPM_SIZE;
@@ -355,6 +377,7 @@ inline int unpack3_TPM_VERSION(BYTE* ptr, UINT32 *pos, UINT32 max, TPM_VERSION*
 
 #define sizeof_TPM_VERSION(x) 4
 
+static
 inline BYTE* pack_TPM_CAP_VERSION_INFO(BYTE* ptr, const TPM_CAP_VERSION_INFO* v) {
 	ptr = pack_TPM_STRUCTURE_TAG(ptr, v->tag);
 	ptr = pack_TPM_VERSION(ptr, &v->version);
@@ -366,6 +389,7 @@ inline BYTE* pack_TPM_CAP_VERSION_INFO(BYTE* ptr, const TPM_CAP_VERSION_INFO* v)
 	return ptr;
 }
 
+static
 inline BYTE* unpack_TPM_CAP_VERSION_INFO(BYTE* ptr, TPM_CAP_VERSION_INFO* v, UnpackPtr alloc) {
 	ptr = unpack_TPM_STRUCTURE_TAG(ptr, &v->tag);
 	ptr = unpack_TPM_VERSION(ptr, &v->version);
@@ -377,14 +401,17 @@ inline BYTE* unpack_TPM_CAP_VERSION_INFO(BYTE* ptr, TPM_CAP_VERSION_INFO* v, Unp
 	return ptr;
 }
 
+static
 inline BYTE* pack_TPM_DIGEST(BYTE* ptr, const TPM_DIGEST* d) {
 	return pack_BUFFER(ptr, d->digest, TPM_DIGEST_SIZE);
 }
 
+static
 inline BYTE* unpack_TPM_DIGEST(BYTE* ptr, TPM_DIGEST* d) {
 	return unpack_BUFFER(ptr, d->digest, TPM_DIGEST_SIZE);
 }
 
+static
 inline int unpack3_TPM_DIGEST(BYTE* ptr, UINT32* pos, UINT32 max, TPM_DIGEST* d) {
 	return unpack3_BUFFER(ptr, pos, max, d->digest, TPM_DIGEST_SIZE);
 }
@@ -409,20 +436,24 @@ inline int unpack3_TPM_DIGEST(BYTE* ptr, UINT32* pos, UINT32 max, TPM_DIGEST* d)
 #define pack_TPM_CHOSENID_HASH(ptr, d) pack_TPM_DIGEST(ptr, d)
 #define unpack_TPM_CHOSENID_HASH(ptr, d) unpack_TPM_DIGEST(ptr, d)
 
+static
 inline BYTE* pack_TPM_NONCE(BYTE* ptr, const TPM_NONCE* n) {
 	return pack_BUFFER(ptr, n->nonce, TPM_DIGEST_SIZE);
 }
 
+static
 inline BYTE* unpack_TPM_NONCE(BYTE* ptr, TPM_NONCE* n) {
 	return unpack_BUFFER(ptr, n->nonce, TPM_DIGEST_SIZE);
 }
 
 #define sizeof_TPM_NONCE(x) TPM_DIGEST_SIZE
 
+static
 inline int unpack3_TPM_NONCE(BYTE* ptr, UINT32* pos, UINT32 max, TPM_NONCE* n) {
 	return unpack3_BUFFER(ptr, pos, max, n->nonce, TPM_DIGEST_SIZE);
 }
 
+static
 inline BYTE* pack_TPM_SYMMETRIC_KEY_PARMS(BYTE* ptr, const TPM_SYMMETRIC_KEY_PARMS* k) {
 	ptr = pack_UINT32(ptr, k->keyLength);
 	ptr = pack_UINT32(ptr, k->blockSize);
@@ -430,6 +461,7 @@ inline BYTE* pack_TPM_SYMMETRIC_KEY_PARMS(BYTE* ptr, const TPM_SYMMETRIC_KEY_PAR
 	return pack_BUFFER(ptr, k->IV, k->ivSize);
 }
 
+static
 inline BYTE* pack_TPM_SYMMETRIC_KEY(BYTE* ptr, const TPM_SYMMETRIC_KEY* k) {
 	ptr = pack_UINT32(ptr, k->algId);
 	ptr = pack_UINT16(ptr, k->encScheme);
@@ -437,6 +469,7 @@ inline BYTE* pack_TPM_SYMMETRIC_KEY(BYTE* ptr, const TPM_SYMMETRIC_KEY* k) {
 	return pack_BUFFER(ptr, k->data, k->size);
 }
 
+static
 inline int unpack3_TPM_SYMMETRIC_KEY_PARMS(BYTE* ptr, UINT32* pos, UINT32 max, TPM_SYMMETRIC_KEY_PARMS* k, UnpackPtr alloc) {
 	return unpack3_UINT32(ptr, pos, max, &k->keyLength) ||
 		unpack3_UINT32(ptr, pos, max, &k->blockSize) ||
@@ -444,10 +477,12 @@ inline int unpack3_TPM_SYMMETRIC_KEY_PARMS(BYTE* ptr, UINT32* pos, UINT32 max, T
 		unpack3_PTR(ptr, pos, max, &k->IV, k->ivSize, alloc);
 }
 
+static
 inline int sizeof_TPM_SYMMETRIC_KEY_PARMS(const TPM_SYMMETRIC_KEY_PARMS* k) {
 	return 12 + k->ivSize;
 }
 
+static
 inline int unpack3_TPM_SYMMETRIC_KEY(BYTE* ptr, UINT32* pos, UINT32 max, TPM_SYMMETRIC_KEY* k, UnpackPtr alloc) {
 	return unpack3_UINT32(ptr, pos, max, &k->algId) ||
 		unpack3_UINT16(ptr, pos, max, &k->encScheme) ||
@@ -455,6 +490,7 @@ inline int unpack3_TPM_SYMMETRIC_KEY(BYTE* ptr, UINT32* pos, UINT32 max, TPM_SYM
 		unpack3_PTR(ptr, pos, max, &k->data, k->size, alloc);
 }
 
+static
 inline BYTE* pack_TPM_RSA_KEY_PARMS(BYTE* ptr, const TPM_RSA_KEY_PARMS* k) {
 	ptr = pack_UINT32(ptr, k->keyLength);
 	ptr = pack_UINT32(ptr, k->numPrimes);
@@ -462,6 +498,7 @@ inline BYTE* pack_TPM_RSA_KEY_PARMS(BYTE* ptr, const TPM_RSA_KEY_PARMS* k) {
 	return pack_BUFFER(ptr, k->exponent, k->exponentSize);
 }
 
+static
 inline int unpack3_TPM_RSA_KEY_PARMS(BYTE* ptr, UINT32* pos, UINT32 max, TPM_RSA_KEY_PARMS* k, UnpackPtr alloc) {
 	return unpack3_UINT32(ptr, pos, max, &k->keyLength) ||
 		unpack3_UINT32(ptr, pos, max, &k->numPrimes) ||
@@ -469,11 +506,13 @@ inline int unpack3_TPM_RSA_KEY_PARMS(BYTE* ptr, UINT32* pos, UINT32 max, TPM_RSA
 		unpack3_PTR(ptr, pos, max, &k->exponent, k->exponentSize, alloc);
 }
 
+static
 inline int sizeof_TPM_RSA_KEY_PARMS(const TPM_RSA_KEY_PARMS* k) {
 	return 12 + k->exponentSize;
 }
 
 
+static
 inline BYTE* pack_TPM_KEY_PARMS(BYTE* ptr, const TPM_KEY_PARMS* k) {
 	ptr = pack_TPM_ALGORITHM_ID(ptr, k->algorithmID);
 	ptr = pack_TPM_ENC_SCHEME(ptr, k->encScheme);
@@ -493,6 +532,7 @@ inline BYTE* pack_TPM_KEY_PARMS(BYTE* ptr, const TPM_KEY_PARMS* k) {
 	return ptr;
 }
 
+static
 inline int unpack3_TPM_KEY_PARMS(BYTE* ptr, UINT32* pos, UINT32 len, TPM_KEY_PARMS* k, UnpackPtr alloc) {
 	int rc = unpack3_TPM_ALGORITHM_ID(ptr, pos, len, &k->algorithmID) ||
 		unpack3_TPM_ENC_SCHEME(ptr, pos, len, &k->encScheme) ||
@@ -511,6 +551,7 @@ inline int unpack3_TPM_KEY_PARMS(BYTE* ptr, UINT32* pos, UINT32 len, TPM_KEY_PAR
 	return TPM_FAIL;
 }
 
+static
 inline int sizeof_TPM_KEY_PARMS(const TPM_KEY_PARMS* k) {
 	int rc = 0;
 	rc += sizeof_TPM_ALGORITHM_ID(&k->algorithmID);
@@ -532,52 +573,62 @@ inline int sizeof_TPM_KEY_PARMS(const TPM_KEY_PARMS* k) {
 	return rc;
 }
 
+static
 inline BYTE* pack_TPM_STORE_PUBKEY(BYTE* ptr, const TPM_STORE_PUBKEY* k) {
 	ptr = pack_UINT32(ptr, k->keyLength);
 	ptr = pack_BUFFER(ptr, k->key, k->keyLength);
 	return ptr;
 }
 
+static
 inline int unpack3_TPM_STORE_PUBKEY(BYTE* ptr, UINT32* pos, UINT32 max, TPM_STORE_PUBKEY* k, UnpackPtr alloc) {
 	return unpack3_UINT32(ptr, pos, max, &k->keyLength) ||
 		unpack3_PTR(ptr, pos, max, &k->key, k->keyLength, alloc);
 }
 
+static
 inline int sizeof_TPM_STORE_PUBKEY(const TPM_STORE_PUBKEY* k) {
 	return 4 + k->keyLength;
 }
 
+static
 inline BYTE* pack_TPM_PUBKEY(BYTE* ptr, const TPM_PUBKEY* k) {
 	ptr = pack_TPM_KEY_PARMS(ptr, &k->algorithmParms);
 	return pack_TPM_STORE_PUBKEY(ptr, &k->pubKey);
 }
 
+static
 inline int unpack3_TPM_PUBKEY(BYTE* ptr, UINT32* pos, UINT32 len, TPM_PUBKEY* k, UnpackPtr alloc) {
 	return unpack3_TPM_KEY_PARMS(ptr, pos, len, &k->algorithmParms, alloc) ||
 		unpack3_TPM_STORE_PUBKEY(ptr, pos, len, &k->pubKey, alloc);
 }
 
+static
 inline BYTE* pack_TPM_PCR_SELECTION(BYTE* ptr, const TPM_PCR_SELECTION* p) {
 	ptr = pack_UINT16(ptr, p->sizeOfSelect);
 	ptr = pack_BUFFER(ptr, p->pcrSelect, p->sizeOfSelect);
 	return ptr;
 }
 
+static
 inline BYTE* unpack_TPM_PCR_SELECTION(BYTE* ptr, TPM_PCR_SELECTION* p, UnpackPtr alloc) {
 	ptr = unpack_UINT16(ptr, &p->sizeOfSelect);
 	ptr = unpack_PTR(ptr, &p->pcrSelect, p->sizeOfSelect, alloc);
 	return ptr;
 }
 
+static
 inline int unpack3_TPM_PCR_SELECTION(BYTE* ptr, UINT32* pos, UINT32 max, TPM_PCR_SELECTION* p, UnpackPtr alloc) {
 	return unpack3_UINT16(ptr, pos, max, &p->sizeOfSelect) ||
 		unpack3_PTR(ptr, pos, max, &p->pcrSelect, p->sizeOfSelect, alloc);
 }
 
+static
 inline int sizeof_TPM_PCR_SELECTION(const TPM_PCR_SELECTION* p) {
 	return 2 + p->sizeOfSelect;
 }
 
+static
 inline BYTE* pack_TPM_PCR_INFO(BYTE* ptr, const TPM_PCR_INFO* p) {
 	ptr = pack_TPM_PCR_SELECTION(ptr, &p->pcrSelection);
 	ptr = pack_TPM_COMPOSITE_HASH(ptr, &p->digestAtRelease);
@@ -585,12 +636,14 @@ inline BYTE* pack_TPM_PCR_INFO(BYTE* ptr, const TPM_PCR_INFO* p) {
 	return ptr;
 }
 
+static
 inline int unpack3_TPM_PCR_INFO(BYTE* ptr, UINT32* pos, UINT32 max, TPM_PCR_INFO* p, UnpackPtr alloc) {
 	return unpack3_TPM_PCR_SELECTION(ptr, pos, max, &p->pcrSelection, alloc) ||
 		unpack3_TPM_COMPOSITE_HASH(ptr, pos, max, &p->digestAtRelease) ||
 		unpack3_TPM_COMPOSITE_HASH(ptr, pos, max, &p->digestAtCreation);
 }
 
+static
 inline int sizeof_TPM_PCR_INFO(const TPM_PCR_INFO* p) {
 	int rc = 0;
 	rc += sizeof_TPM_PCR_SELECTION(&p->pcrSelection);
@@ -599,6 +652,7 @@ inline int sizeof_TPM_PCR_INFO(const TPM_PCR_INFO* p) {
 	return rc;
 }
 
+static
 inline BYTE* pack_TPM_PCR_INFO_LONG(BYTE* ptr, const TPM_PCR_INFO_LONG* p) {
 	ptr = pack_TPM_STRUCTURE_TAG(ptr, p->tag);
 	ptr = pack_TPM_LOCALITY_SELECTION(ptr, p->localityAtCreation);
@@ -610,6 +664,7 @@ inline BYTE* pack_TPM_PCR_INFO_LONG(BYTE* ptr, const TPM_PCR_INFO_LONG* p) {
 	return ptr;
 }
 
+static
 inline int sizeof_TPM_PCR_INFO_LONG(const TPM_PCR_INFO_LONG* p) {
 	int rc = 0;
 	rc += sizeof_TPM_STRUCTURE_TAG(p->tag);
@@ -622,6 +677,7 @@ inline int sizeof_TPM_PCR_INFO_LONG(const TPM_PCR_INFO_LONG* p) {
 	return rc;
 }
 
+static
 inline int unpack3_TPM_PCR_INFO_LONG(BYTE* ptr, UINT32* pos, UINT32 max, TPM_PCR_INFO_LONG* p, UnpackPtr alloc) {
 	return unpack3_TPM_STRUCTURE_TAG(ptr, pos, max, &p->tag) ||
 		unpack3_TPM_LOCALITY_SELECTION(ptr, pos, max,
@@ -637,6 +693,7 @@ inline int unpack3_TPM_PCR_INFO_LONG(BYTE* ptr, UINT32* pos, UINT32 max, TPM_PCR
 		unpack3_TPM_COMPOSITE_HASH(ptr, pos, max, &p->digestAtRelease);
 }
 
+static
 inline BYTE* pack_TPM_PCR_COMPOSITE(BYTE* ptr, const TPM_PCR_COMPOSITE* p) {
 	ptr = pack_TPM_PCR_SELECTION(ptr, &p->select);
 	ptr = pack_UINT32(ptr, p->valueSize);
@@ -644,12 +701,14 @@ inline BYTE* pack_TPM_PCR_COMPOSITE(BYTE* ptr, const TPM_PCR_COMPOSITE* p) {
 	return ptr;
 }
 
+static
 inline int unpack3_TPM_PCR_COMPOSITE(BYTE* ptr, UINT32* pos, UINT32 max, TPM_PCR_COMPOSITE* p, UnpackPtr alloc) {
 	return unpack3_TPM_PCR_SELECTION(ptr, pos, max, &p->select, alloc) ||
 		unpack3_UINT32(ptr, pos, max, &p->valueSize) ||
 		unpack3_PTR(ptr, pos, max, (BYTE**)&p->pcrValue, p->valueSize, alloc);
 }
 
+static
 inline BYTE* pack_TPM_KEY(BYTE* ptr, const TPM_KEY* k) {
 	ptr = pack_TPM_VERSION(ptr, &k->ver);
 	ptr = pack_TPM_KEY_USAGE(ptr, k->keyUsage);
@@ -665,6 +724,7 @@ inline BYTE* pack_TPM_KEY(BYTE* ptr, const TPM_KEY* k) {
 	return pack_BUFFER(ptr, k->encData, k->encDataSize);
 }
 
+static
 inline int unpack3_TPM_KEY(BYTE* ptr, UINT32* pos, UINT32 max, TPM_KEY* k, UnpackPtr alloc) {
 	int rc = unpack3_TPM_VERSION(ptr, pos, max, &k->ver) ||
 		unpack3_TPM_KEY_USAGE(ptr, pos, max, &k->keyUsage) ||
@@ -682,6 +742,7 @@ inline int unpack3_TPM_KEY(BYTE* ptr, UINT32* pos, UINT32 max, TPM_KEY* k, Unpac
 		unpack3_PTR(ptr, pos, max, &k->encData, k->encDataSize, alloc);
 }
 
+static
 inline int sizeof_TPM_KEY(const TPM_KEY* k) {
 	int rc = 0;
 	rc += sizeof_TPM_VERSION(&k->ver);
@@ -699,18 +760,21 @@ inline int sizeof_TPM_KEY(const TPM_KEY* k) {
 	return rc;
 }
 
+static
 inline BYTE* pack_TPM_BOUND_DATA(BYTE* ptr, const TPM_BOUND_DATA* b, UINT32 payloadSize) {
 	ptr = pack_TPM_VERSION(ptr, &b->ver);
 	ptr = pack_TPM_PAYLOAD_TYPE(ptr, b->payload);
 	return pack_BUFFER(ptr, b->payloadData, payloadSize);
 }
 
+static
 inline BYTE* unpack_TPM_BOUND_DATA(BYTE* ptr, TPM_BOUND_DATA* b, UINT32 payloadSize, UnpackPtr alloc) {
 	ptr = unpack_TPM_VERSION(ptr, &b->ver);
 	ptr = unpack_TPM_PAYLOAD_TYPE(ptr, &b->payload);
 	return unpack_PTR(ptr, &b->payloadData, payloadSize, alloc);
 }
 
+static
 inline BYTE* pack_TPM_STORED_DATA(BYTE* ptr, const TPM_STORED_DATA* d) {
 	ptr = pack_TPM_VERSION(ptr, &d->ver);
 	ptr = pack_UINT32(ptr, d->sealInfoSize);
@@ -722,6 +786,7 @@ inline BYTE* pack_TPM_STORED_DATA(BYTE* ptr, const TPM_STORED_DATA* d) {
 	return ptr;
 }
 
+static
 inline int sizeof_TPM_STORED_DATA(const TPM_STORED_DATA* d) {
 	int rv = sizeof_TPM_VERSION(&d->ver) + sizeof_UINT32(d->sealInfoSize);
 	if (d->sealInfoSize) {
@@ -732,6 +797,7 @@ inline int sizeof_TPM_STORED_DATA(const TPM_STORED_DATA* d) {
 	return rv;
 }
 
+static
 inline int unpack3_TPM_STORED_DATA(BYTE* ptr, UINT32* pos, UINT32 len, TPM_STORED_DATA* d, UnpackPtr alloc) {
 	int rc = unpack3_TPM_VERSION(ptr, pos, len, &d->ver) ||
 		unpack3_UINT32(ptr, pos, len, &d->sealInfoSize);
@@ -746,6 +812,7 @@ inline int unpack3_TPM_STORED_DATA(BYTE* ptr, UINT32* pos, UINT32 len, TPM_STORE
 	return rc;
 }
 
+static
 inline BYTE* pack_TPM_STORED_DATA12(BYTE* ptr, const TPM_STORED_DATA12* d) {
 	ptr = pack_TPM_STRUCTURE_TAG(ptr, d->tag);
 	ptr = pack_TPM_ENTITY_TYPE(ptr, d->et);
@@ -758,6 +825,7 @@ inline BYTE* pack_TPM_STORED_DATA12(BYTE* ptr, const TPM_STORED_DATA12* d) {
 	return ptr;
 }
 
+static
 inline int sizeof_TPM_STORED_DATA12(const TPM_STORED_DATA12* d) {
 	int rv = sizeof_TPM_STRUCTURE_TAG(&d->ver) +
 		 sizeof_TPM_ENTITY_TYPE(&d->et) +
@@ -770,6 +838,7 @@ inline int sizeof_TPM_STORED_DATA12(const TPM_STORED_DATA12* d) {
 	return rv;
 }
 
+static
 inline int unpack3_TPM_STORED_DATA12(BYTE* ptr, UINT32* pos, UINT32 len, TPM_STORED_DATA12* d, UnpackPtr alloc) {
 	int rc = unpack3_TPM_STRUCTURE_TAG(ptr, pos, len, &d->tag) ||
 		unpack3_TPM_ENTITY_TYPE(ptr, pos, len, &d->et) ||
@@ -786,6 +855,7 @@ inline int unpack3_TPM_STORED_DATA12(BYTE* ptr, UINT32* pos, UINT32 len, TPM_STO
 	return rc;
 }
 
+static
 inline BYTE* pack_TPM_AUTH_SESSION(BYTE* ptr, const TPM_AUTH_SESSION* auth) {
 	ptr = pack_TPM_AUTH_HANDLE(ptr, auth->AuthHandle);
 	ptr = pack_TPM_NONCE(ptr, &auth->NonceOdd);
@@ -794,6 +864,7 @@ inline BYTE* pack_TPM_AUTH_SESSION(BYTE* ptr, const TPM_AUTH_SESSION* auth) {
 	return ptr;
 }
 
+static
 inline BYTE* unpack_TPM_AUTH_SESSION(BYTE* ptr, TPM_AUTH_SESSION* auth) {
 	ptr = unpack_TPM_NONCE(ptr, &auth->NonceEven);
 	ptr = unpack_BOOL(ptr, &auth->fContinueAuthSession);
@@ -801,6 +872,7 @@ inline BYTE* unpack_TPM_AUTH_SESSION(BYTE* ptr, TPM_AUTH_SESSION* auth) {
 	return ptr;
 }
 
+static
 inline int unpack3_TPM_AUTH_SESSION(BYTE* ptr, UINT32* pos, UINT32 len, TPM_AUTH_SESSION* auth) {
 	return unpack3_TPM_NONCE(ptr, pos, len, &auth->NonceEven) ||
 		unpack3_BOOL(ptr, pos, len, &auth->fContinueAuthSession) ||
@@ -808,6 +880,7 @@ inline int unpack3_TPM_AUTH_SESSION(BYTE* ptr, UINT32* pos, UINT32 len, TPM_AUTH
 }
 
 
+static
 inline int sizeof_TPM_AUTH_SESSION(const TPM_AUTH_SESSION* auth) {
 	int rv = 0;
 	rv += sizeof_TPM_AUTH_HANDLE(auth->AuthHandle);
@@ -817,6 +890,7 @@ inline int sizeof_TPM_AUTH_SESSION(const TPM_AUTH_SESSION* auth) {
 	return rv;
 }
 
+static
 inline BYTE* pack_TPM_RQU_HEADER(BYTE* ptr,
 		TPM_TAG tag,
 		UINT32 size,
@@ -826,6 +900,7 @@ inline BYTE* pack_TPM_RQU_HEADER(BYTE* ptr,
 	return pack_UINT32(ptr, ord);
 }
 
+static
 inline BYTE* unpack_TPM_RQU_HEADER(BYTE* ptr,
 		TPM_TAG* tag,
 		UINT32* size,
@@ -836,6 +911,7 @@ inline BYTE* unpack_TPM_RQU_HEADER(BYTE* ptr,
 	return ptr;
 }
 
+static
 inline int unpack3_TPM_RQU_HEADER(BYTE* ptr, UINT32* pos, UINT32 max,
 		TPM_TAG* tag, UINT32* size, TPM_COMMAND_CODE* ord) {
 	return
diff --git a/stubdom/vtpmmgr/tcg.h b/stubdom/vtpmmgr/tcg.h
index 813ce57a2d..423131dc25 100644
--- a/stubdom/vtpmmgr/tcg.h
+++ b/stubdom/vtpmmgr/tcg.h
@@ -461,6 +461,7 @@ typedef struct TPM_CAP_VERSION_INFO {
    BYTE* vendorSpecific;
 } TPM_CAP_VERSION_INFO;
 
+static
 inline void free_TPM_CAP_VERSION_INFO(TPM_CAP_VERSION_INFO* v) {
    free(v->vendorSpecific);
    v->vendorSpecific = NULL;
@@ -494,6 +495,7 @@ typedef struct TPM_SYMMETRIC_KEY {
    BYTE* data;
 } TPM_SYMMETRIC_KEY;
 
+static
 inline void free_TPM_SYMMETRIC_KEY_PARMS(TPM_SYMMETRIC_KEY_PARMS* p) {
    free(p->IV);
    p->IV = NULL;
@@ -510,6 +512,7 @@ typedef struct TPM_RSA_KEY_PARMS {
 
 #define TPM_RSA_KEY_PARMS_INIT { 0, 0, 0, NULL }
 
+static
 inline void free_TPM_RSA_KEY_PARMS(TPM_RSA_KEY_PARMS* p) {
    free(p->exponent);
    p->exponent = NULL;
@@ -528,6 +531,7 @@ typedef struct TPM_KEY_PARMS {
 
 #define TPM_KEY_PARMS_INIT { 0, 0, 0, 0 }
 
+static
 inline void free_TPM_KEY_PARMS(TPM_KEY_PARMS* p) {
    if(p->parmSize) {
       switch(p->algorithmID) {
@@ -550,6 +554,7 @@ typedef struct TPM_STORE_PUBKEY {
 
 #define TPM_STORE_PUBKEY_INIT { 0, NULL }
 
+static
 inline void free_TPM_STORE_PUBKEY(TPM_STORE_PUBKEY* p) {
    free(p->key);
    p->key = NULL;
@@ -562,6 +567,7 @@ typedef struct TPM_PUBKEY {
 
 #define TPM_PUBKEY_INIT { TPM_KEY_PARMS_INIT, TPM_STORE_PUBKEY_INIT }
 
+static
 inline void free_TPM_PUBKEY(TPM_PUBKEY* k) {
    free_TPM_KEY_PARMS(&k->algorithmParms);
    free_TPM_STORE_PUBKEY(&k->pubKey);
@@ -574,6 +580,7 @@ typedef struct TPM_PCR_SELECTION {
 
 #define TPM_PCR_SELECTION_INIT { 0, NULL }
 
+static
 inline void free_TPM_PCR_SELECTION(TPM_PCR_SELECTION* p) {
    free(p->pcrSelect);
    p->pcrSelect = NULL;
@@ -594,6 +601,7 @@ typedef struct TPM_PCR_INFO_LONG {
 #define TPM_PCR_INFO_LONG_INIT { 0, 0, 0, TPM_PCR_SELECTION_INIT, \
                                  TPM_PCR_SELECTION_INIT }
 
+static
 inline void free_TPM_PCR_INFO_LONG(TPM_PCR_INFO_LONG* p) {
    free_TPM_PCR_SELECTION(&p->creationPCRSelection);
    free_TPM_PCR_SELECTION(&p->releasePCRSelection);
@@ -607,6 +615,7 @@ typedef struct TPM_PCR_INFO {
 
 #define TPM_PCR_INFO_INIT { TPM_PCR_SELECTION_INIT }
 
+static
 inline void free_TPM_PCR_INFO(TPM_PCR_INFO* p) {
    free_TPM_PCR_SELECTION(&p->pcrSelection);
 }
@@ -619,6 +628,7 @@ typedef struct TPM_PCR_COMPOSITE {
 
 #define TPM_PCR_COMPOSITE_INIT { TPM_PCR_SELECTION_INIT, 0, NULL }
 
+static
 inline void free_TPM_PCR_COMPOSITE(TPM_PCR_COMPOSITE* p) {
    free_TPM_PCR_SELECTION(&p->select);
    free(p->pcrValue);
@@ -643,6 +653,7 @@ typedef struct TPM_KEY {
    .pubKey = TPM_STORE_PUBKEY_INIT, \
    .encDataSize = 0, .encData = NULL }
 
+static
 inline void free_TPM_KEY(TPM_KEY* k) {
    if(k->PCRInfoSize) {
       free_TPM_PCR_INFO(&k->PCRInfo);
@@ -660,6 +671,7 @@ typedef struct TPM_BOUND_DATA {
 
 #define TPM_BOUND_DATA_INIT { .payloadData = NULL }
 
+static
 inline void free_TPM_BOUND_DATA(TPM_BOUND_DATA* d) {
    free(d->payloadData);
    d->payloadData = NULL;
@@ -676,6 +688,7 @@ typedef struct TPM_STORED_DATA {
 #define TPM_STORED_DATA_INIT { .sealInfoSize = 0, sealInfo = TPM_PCR_INFO_INIT,\
    .encDataSize = 0, .encData = NULL }
 
+static
 inline void free_TPM_STORED_DATA(TPM_STORED_DATA* d) {
    if(d->sealInfoSize) {
       free_TPM_PCR_INFO(&d->sealInfo);
@@ -696,6 +709,7 @@ typedef struct TPM_STORED_DATA12 {
 #define TPM_STORED_DATA12_INIT { .sealInfoLongSize = 0, \
    sealInfoLong = TPM_PCR_INFO_INIT, .encDataSize = 0, .encData = NULL }
 
+static
 inline void free_TPM_STORED_DATA12(TPM_STORED_DATA12* d) {
    if(d->sealInfoLongSize) {
       free_TPM_PCR_INFO_LONG(&d->sealInfoLong);
diff --git a/stubdom/vtpmmgr/tpm2_marshal.h b/stubdom/vtpmmgr/tpm2_marshal.h
index aaa44645a2..ba070ad38e 100644
--- a/stubdom/vtpmmgr/tpm2_marshal.h
+++ b/stubdom/vtpmmgr/tpm2_marshal.h
@@ -52,6 +52,7 @@
 #define pack_TPM_BUFFER(ptr, buf, size) pack_BUFFER(ptr, buf, size)
 #define unpack_TPM_BUFFER(ptr, buf, size) unpack_BUFFER(ptr, buf, size)
 
+static
 inline BYTE* pack_BYTE_ARRAY(BYTE* ptr, const BYTE* array, UINT32 size)
 {
     int i;
@@ -60,21 +61,25 @@ inline BYTE* pack_BYTE_ARRAY(BYTE* ptr, const BYTE* array, UINT32 size)
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMA_SESSION(BYTE* ptr, const TPMA_SESSION *attr)
 {
     return pack_BYTE(ptr, (BYTE)(*attr));
 }
 
+static
 inline BYTE* unpack_TPMA_SESSION(BYTE* ptr, TPMA_SESSION *attr)
 {
     return unpack_BYTE(ptr, (BYTE *)attr);
 }
 
+static
 inline BYTE* pack_TPMI_ALG_HASH(BYTE* ptr, const TPMI_ALG_HASH *hash)
 {
     return pack_UINT16(ptr, *hash);
 }
 
+static
 inline BYTE* unpack_TPMI_ALG_HASH(BYTE *ptr, TPMI_ALG_HASH *hash)
 {
     return unpack_UINT16(ptr, hash);
@@ -125,6 +130,7 @@ inline BYTE* unpack_TPMI_ALG_HASH(BYTE *ptr, TPMI_ALG_HASH *hash)
 #define pack_TPMI_RH_LOCKOUT(ptr, l)            pack_TPM2_HANDLE(ptr, l)
 #define unpack_TPMI_RH_LOCKOUT(ptr, l)          unpack_TPM2_HANDLE(ptr, l)
 
+static
 inline BYTE* pack_TPM2B_DIGEST(BYTE* ptr, const TPM2B_DIGEST *digest)
 {
     ptr = pack_UINT16(ptr, digest->size);
@@ -132,6 +138,7 @@ inline BYTE* pack_TPM2B_DIGEST(BYTE* ptr, const TPM2B_DIGEST *digest)
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPM2B_DIGEST(BYTE* ptr, TPM2B_DIGEST *digest)
 {
     ptr = unpack_UINT16(ptr, &digest->size);
@@ -139,6 +146,7 @@ inline BYTE* unpack_TPM2B_DIGEST(BYTE* ptr, TPM2B_DIGEST *digest)
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMT_TK_CREATION(BYTE* ptr,const TPMT_TK_CREATION *ticket )
 {
     ptr = pack_TPM_ST(ptr , &ticket->tag);
@@ -147,6 +155,7 @@ inline BYTE* pack_TPMT_TK_CREATION(BYTE* ptr,const TPMT_TK_CREATION *ticket )
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPMT_TK_CREATION(BYTE* ptr, TPMT_TK_CREATION *ticket )
 {
     ptr = unpack_TPM_ST(ptr, &ticket->tag);
@@ -155,6 +164,7 @@ inline BYTE* unpack_TPMT_TK_CREATION(BYTE* ptr, TPMT_TK_CREATION *ticket )
     return ptr;
 }
 
+static
 inline BYTE* pack_TPM2B_NAME(BYTE* ptr,const TPM2B_NAME *name )
 {
     ptr = pack_UINT16(ptr, name->size);
@@ -162,6 +172,7 @@ inline BYTE* pack_TPM2B_NAME(BYTE* ptr,const TPM2B_NAME *name )
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPM2B_NAME(BYTE* ptr, TPM2B_NAME *name)
 {
     ptr = unpack_UINT16(ptr, &name->size);
@@ -169,6 +180,7 @@ inline BYTE* unpack_TPM2B_NAME(BYTE* ptr, TPM2B_NAME *name)
     return ptr;
 }
 
+static
 inline BYTE* pack_TPM2B_NONCE(BYTE* ptr, const TPM2B_NONCE *nonce)
 {
     return pack_TPM2B_DIGEST(ptr, (const TPM2B_DIGEST*)nonce);
@@ -176,6 +188,7 @@ inline BYTE* pack_TPM2B_NONCE(BYTE* ptr, const TPM2B_NONCE *nonce)
 
 #define unpack_TPM2B_NONCE(ptr, nonce)  unpack_TPM2B_DIGEST(ptr, (TPM2B_DIGEST*)nonce)
 
+static
 inline BYTE* pack_TPM2B_AUTH(BYTE* ptr, const TPM2B_AUTH *auth)
 {
     return pack_TPM2B_DIGEST(ptr, (const TPM2B_DIGEST*)auth);
@@ -183,6 +196,7 @@ inline BYTE* pack_TPM2B_AUTH(BYTE* ptr, const TPM2B_AUTH *auth)
 
 #define unpack_TPM2B_AUTH(ptr, auth)    unpack_TPM2B_DIGEST(ptr, (TPM2B_DIGEST*)auth)
 
+static
 inline BYTE* pack_TPM2B_DATA(BYTE* ptr, const TPM2B_DATA *data)
 {
     return pack_TPM2B_DIGEST(ptr, (const TPM2B_DIGEST*)data);
@@ -190,6 +204,7 @@ inline BYTE* pack_TPM2B_DATA(BYTE* ptr, const TPM2B_DATA *data)
 
 #define unpack_TPM2B_DATA(ptr, data)    unpack_TPM2B_DIGEST(ptr, (TPM2B_DIGEST*)data)
 
+static
 inline BYTE* pack_TPM2B_SENSITIVE_DATA(BYTE* ptr, const TPM2B_SENSITIVE_DATA *data)
 {
     return pack_TPM2B_DIGEST(ptr, (const TPM2B_DIGEST*)data);
@@ -197,6 +212,7 @@ inline BYTE* pack_TPM2B_SENSITIVE_DATA(BYTE* ptr, const TPM2B_SENSITIVE_DATA *da
 
 #define unpack_TPM2B_SENSITIVE_DATA(ptr, data)  unpack_TPM2B_DIGEST(ptr, (TPM2B_DIGEST*)data)
 
+static
 inline BYTE* pack_TPM2B_PUBLIC_KEY_RSA(BYTE* ptr, const TPM2B_PUBLIC_KEY_RSA *rsa)
 {
     return pack_TPM2B_DIGEST(ptr, (const TPM2B_DIGEST*)rsa);
@@ -204,6 +220,7 @@ inline BYTE* pack_TPM2B_PUBLIC_KEY_RSA(BYTE* ptr, const TPM2B_PUBLIC_KEY_RSA *rs
 
 #define unpack_TPM2B_PUBLIC_KEY_RSA(ptr, rsa)   unpack_TPM2B_DIGEST(ptr, (TPM2B_DIGEST*)rsa)
 
+static
 inline BYTE* pack_TPM2B_PRIVATE(BYTE* ptr, const TPM2B_PRIVATE *Private)
 {
     ptr = pack_UINT16(ptr, Private->size);
@@ -211,6 +228,7 @@ inline BYTE* pack_TPM2B_PRIVATE(BYTE* ptr, const TPM2B_PRIVATE *Private)
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPM2B_PRIVATE(BYTE* ptr, TPM2B_PRIVATE *Private)
 {
     ptr = unpack_UINT16(ptr, &Private->size);
@@ -218,6 +236,7 @@ inline BYTE* unpack_TPM2B_PRIVATE(BYTE* ptr, TPM2B_PRIVATE *Private)
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMS_PCR_SELECTION_ARRAY(BYTE* ptr, const TPMS_PCR_SELECTION *sel, UINT32 count)
 {
     int i;
@@ -229,6 +248,7 @@ inline BYTE* pack_TPMS_PCR_SELECTION_ARRAY(BYTE* ptr, const TPMS_PCR_SELECTION *
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPMS_PCR_SELECTION_ARRAY(BYTE* ptr, TPMS_PCR_SELECTION *sel, UINT32 count)
 {
     int i;
@@ -240,6 +260,7 @@ inline BYTE* unpack_TPMS_PCR_SELECTION_ARRAY(BYTE* ptr, TPMS_PCR_SELECTION *sel,
     return ptr;
 }
 
+static
 inline BYTE* pack_TPML_PCR_SELECTION(BYTE* ptr, const TPML_PCR_SELECTION *sel)
 {
     ptr = pack_UINT32(ptr, sel->count);
@@ -247,6 +268,7 @@ inline BYTE* pack_TPML_PCR_SELECTION(BYTE* ptr, const TPML_PCR_SELECTION *sel)
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPML_PCR_SELECTION(BYTE* ptr, TPML_PCR_SELECTION *sel)
 {
     ptr = unpack_UINT32(ptr, &sel->count);
@@ -254,6 +276,7 @@ inline BYTE* unpack_TPML_PCR_SELECTION(BYTE* ptr, TPML_PCR_SELECTION *sel)
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPML_DIGEST(BYTE* ptr,TPML_DIGEST *digest)
 {
     int i;
@@ -265,6 +288,7 @@ inline BYTE* unpack_TPML_DIGEST(BYTE* ptr,TPML_DIGEST *digest)
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMS_CREATION_DATA(BYTE* ptr,const TPMS_CREATION_DATA *data)
 {
     ptr = pack_TPML_PCR_SELECTION(ptr, &data->pcrSelect);
@@ -276,6 +300,7 @@ inline BYTE* pack_TPMS_CREATION_DATA(BYTE* ptr,const TPMS_CREATION_DATA *data)
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPMS_CREATION_DATA(BYTE* ptr, TPMS_CREATION_DATA *data)
 {
     ptr = unpack_TPML_PCR_SELECTION(ptr, &data->pcrSelect);
@@ -288,6 +313,7 @@ inline BYTE* unpack_TPMS_CREATION_DATA(BYTE* ptr, TPMS_CREATION_DATA *data)
     return ptr;
 }
 
+static
 inline BYTE* pack_TPM2B_CREATION_DATA(BYTE* ptr, const TPM2B_CREATION_DATA *data )
 {
     ptr = pack_UINT16(ptr, data->size);
@@ -295,6 +321,7 @@ inline BYTE* pack_TPM2B_CREATION_DATA(BYTE* ptr, const TPM2B_CREATION_DATA *data
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPM2B_CREATION_DATA(BYTE* ptr, TPM2B_CREATION_DATA * data)
 {
     ptr = unpack_UINT16(ptr, &data->size);
@@ -302,6 +329,7 @@ inline BYTE* unpack_TPM2B_CREATION_DATA(BYTE* ptr, TPM2B_CREATION_DATA * data)
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMS_SENSITIVE_CREATE(BYTE* ptr, const TPMS_SENSITIVE_CREATE *create)
 {
     ptr = pack_TPM2B_AUTH(ptr, &create->userAuth);
@@ -309,6 +337,7 @@ inline BYTE* pack_TPMS_SENSITIVE_CREATE(BYTE* ptr, const TPMS_SENSITIVE_CREATE *
     return ptr;
 }
 
+static
 inline BYTE* pack_TPM2B_SENSITIVE_CREATE(BYTE* ptr, const TPM2B_SENSITIVE_CREATE *create)
 {
     BYTE* sizePtr = ptr;
@@ -318,6 +347,7 @@ inline BYTE* pack_TPM2B_SENSITIVE_CREATE(BYTE* ptr, const TPM2B_SENSITIVE_CREATE
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMU_SYM_MODE(BYTE* ptr, const TPMU_SYM_MODE *p,
                                 const TPMI_ALG_SYM_OBJECT *sel)
 {
@@ -336,6 +366,7 @@ inline BYTE* pack_TPMU_SYM_MODE(BYTE* ptr, const TPMU_SYM_MODE *p,
     }
     return ptr;
 }
+static
 inline BYTE* unpack_TPMU_SYM_MODE(BYTE* ptr, TPMU_SYM_MODE *p,
                                   const TPMI_ALG_SYM_OBJECT *sel)
 {
@@ -355,6 +386,7 @@ inline BYTE* unpack_TPMU_SYM_MODE(BYTE* ptr, TPMU_SYM_MODE *p,
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMU_SYM_KEY_BITS(BYTE* ptr, const TPMU_SYM_KEY_BITS *p,
                                     const TPMI_ALG_SYM_OBJECT *sel)
 {
@@ -376,6 +408,7 @@ inline BYTE* pack_TPMU_SYM_KEY_BITS(BYTE* ptr, const TPMU_SYM_KEY_BITS *p,
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPMU_SYM_KEY_BITS(BYTE* ptr, TPMU_SYM_KEY_BITS *p,
                                       const TPMI_ALG_SYM_OBJECT *sel)
 {
@@ -397,6 +430,7 @@ inline BYTE* unpack_TPMU_SYM_KEY_BITS(BYTE* ptr, TPMU_SYM_KEY_BITS *p,
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMT_SYM_DEF_OBJECT(BYTE* ptr, const TPMT_SYM_DEF_OBJECT *p)
 {
     ptr = pack_TPMI_ALG_SYM_OBJECT(ptr, &p->algorithm);
@@ -405,6 +439,7 @@ inline BYTE* pack_TPMT_SYM_DEF_OBJECT(BYTE* ptr, const TPMT_SYM_DEF_OBJECT *p)
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPMT_SYM_DEF_OBJECT(BYTE *ptr, TPMT_SYM_DEF_OBJECT *p)
 {
     ptr = unpack_TPMI_ALG_SYM_OBJECT(ptr, &p->algorithm);
@@ -416,6 +451,7 @@ inline BYTE* unpack_TPMT_SYM_DEF_OBJECT(BYTE *ptr, TPMT_SYM_DEF_OBJECT *p)
 #define pack_TPMS_SCHEME_OAEP(p, t)     pack_TPMI_ALG_HASH(p, &((t)->hashAlg))
 #define unpack_TPMS_SCHEME_OAEP(p, t)   unpack_TPMI_ALG_HASH(p, &((t)->hashAlg))
 
+static
 inline BYTE* pack_TPMU_ASYM_SCHEME(BYTE *ptr, const TPMU_ASYM_SCHEME *p,
                                    const TPMI_ALG_RSA_SCHEME *s)
 {
@@ -438,6 +474,7 @@ inline BYTE* pack_TPMU_ASYM_SCHEME(BYTE *ptr, const TPMU_ASYM_SCHEME *p,
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPMU_ASYM_SCHEME(BYTE *ptr, TPMU_ASYM_SCHEME *p,
                                      const TPMI_ALG_RSA_SCHEME *s)
 {
@@ -462,6 +499,7 @@ inline BYTE* unpack_TPMU_ASYM_SCHEME(BYTE *ptr, TPMU_ASYM_SCHEME *p,
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMT_RSA_SCHEME(BYTE* ptr, const TPMT_RSA_SCHEME *p)
 {
     ptr = pack_TPMI_ALG_RSA_SCHEME(ptr, &p->scheme);
@@ -469,6 +507,7 @@ inline BYTE* pack_TPMT_RSA_SCHEME(BYTE* ptr, const TPMT_RSA_SCHEME *p)
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPMT_RSA_SCHEME(BYTE* ptr, TPMT_RSA_SCHEME *p)
 {
     ptr = unpack_TPMI_ALG_RSA_SCHEME(ptr, &p->scheme);
@@ -476,6 +515,7 @@ inline BYTE* unpack_TPMT_RSA_SCHEME(BYTE* ptr, TPMT_RSA_SCHEME *p)
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMT_RSA_DECRYPT(BYTE* ptr, const TPMT_RSA_DECRYPT *p)
 {
     ptr = pack_TPMI_ALG_RSA_SCHEME(ptr, &p->scheme);
@@ -483,6 +523,7 @@ inline BYTE* pack_TPMT_RSA_DECRYPT(BYTE* ptr, const TPMT_RSA_DECRYPT *p)
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMS_RSA_PARMS(BYTE* ptr, const TPMS_RSA_PARMS *p)
 {
     ptr = pack_TPMT_SYM_DEF_OBJECT(ptr, &p->symmetric);
@@ -492,6 +533,7 @@ inline BYTE* pack_TPMS_RSA_PARMS(BYTE* ptr, const TPMS_RSA_PARMS *p)
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPMS_RSA_PARMS(BYTE *ptr, TPMS_RSA_PARMS *p)
 {
     ptr = unpack_TPMT_SYM_DEF_OBJECT(ptr, &p->symmetric);
@@ -501,6 +543,7 @@ inline BYTE* unpack_TPMS_RSA_PARMS(BYTE *ptr, TPMS_RSA_PARMS *p)
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMU_PUBLIC_PARMS(BYTE* ptr, const TPMU_PUBLIC_PARMS *param,
                                     const TPMI_ALG_PUBLIC *selector)
 {
@@ -518,6 +561,7 @@ inline BYTE* pack_TPMU_PUBLIC_PARMS(BYTE* ptr, const TPMU_PUBLIC_PARMS *param,
     return NULL;
 }
 
+static
 inline BYTE* unpack_TPMU_PUBLIC_PARMS(BYTE* ptr, TPMU_PUBLIC_PARMS *param,
                                       const TPMI_ALG_PUBLIC *selector)
 {
@@ -535,18 +579,21 @@ inline BYTE* unpack_TPMU_PUBLIC_PARMS(BYTE* ptr, TPMU_PUBLIC_PARMS *param,
     return NULL;
 }
 
+static
 inline BYTE* pack_TPMS_ECC_POINT(BYTE* ptr, const TPMS_ECC_POINT *point)
 {
     assert(false);
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPMS_ECC_POINT(BYTE* ptr, TPMS_ECC_POINT *point)
 {
     assert(false);
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMU_PUBLIC_ID(BYTE* ptr, const TPMU_PUBLIC_ID *id,
                                  const TPMI_ALG_PUBLIC *selector)
 {
@@ -564,6 +611,7 @@ inline BYTE* pack_TPMU_PUBLIC_ID(BYTE* ptr, const TPMU_PUBLIC_ID *id,
     return NULL;
 }
 
+static
 inline BYTE* unpack_TPMU_PUBLIC_ID(BYTE* ptr, TPMU_PUBLIC_ID *id, TPMI_ALG_PUBLIC *selector)
 {
     switch (*selector) {
@@ -580,6 +628,7 @@ inline BYTE* unpack_TPMU_PUBLIC_ID(BYTE* ptr, TPMU_PUBLIC_ID *id, TPMI_ALG_PUBLI
     return NULL;
 }
 
+static
 inline BYTE* pack_TPMT_PUBLIC(BYTE* ptr, const TPMT_PUBLIC *public)
 {
     ptr = pack_TPMI_ALG_PUBLIC(ptr, &public->type);
@@ -591,6 +640,7 @@ inline BYTE* pack_TPMT_PUBLIC(BYTE* ptr, const TPMT_PUBLIC *public)
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPMT_PUBLIC(BYTE* ptr, TPMT_PUBLIC *public)
 {
     ptr = unpack_TPMI_ALG_PUBLIC(ptr, &public->type);
@@ -602,6 +652,7 @@ inline BYTE* unpack_TPMT_PUBLIC(BYTE* ptr, TPMT_PUBLIC *public)
     return ptr;
 }
 
+static
 inline BYTE* pack_TPM2B_PUBLIC(BYTE* ptr, const TPM2B_PUBLIC *public)
 {
     BYTE *sizePtr = ptr;
@@ -611,6 +662,7 @@ inline BYTE* pack_TPM2B_PUBLIC(BYTE* ptr, const TPM2B_PUBLIC *public)
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPM2B_PUBLIC(BYTE* ptr, TPM2B_PUBLIC *public)
 {
     ptr = unpack_UINT16(ptr, &public->size);
@@ -618,6 +670,7 @@ inline BYTE* unpack_TPM2B_PUBLIC(BYTE* ptr, TPM2B_PUBLIC *public)
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMS_PCR_SELECTION(BYTE* ptr, const TPMS_PCR_SELECTION *selection)
 {
     ptr = pack_TPMI_ALG_HASH(ptr, &selection->hash);
@@ -626,6 +679,7 @@ inline BYTE* pack_TPMS_PCR_SELECTION(BYTE* ptr, const TPMS_PCR_SELECTION *select
     return ptr;
 }
 
+static
 inline BYTE* pack_TPMS_PCR_SELECTION_Array(BYTE* ptr, const TPMS_PCR_SELECTION *selections,
                                            const UINT32 cnt)
 {
@@ -635,6 +689,7 @@ inline BYTE* pack_TPMS_PCR_SELECTION_Array(BYTE* ptr, const TPMS_PCR_SELECTION *
     return ptr;
 }
 
+static
 inline BYTE* pack_TPM_AuthArea(BYTE* ptr, const TPM_AuthArea *auth)
 {
     BYTE* sizePtr = ptr;
@@ -647,6 +702,7 @@ inline BYTE* pack_TPM_AuthArea(BYTE* ptr, const TPM_AuthArea *auth)
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPM_AuthArea(BYTE* ptr, TPM_AuthArea *auth)
 {
     ptr = unpack_UINT32(ptr, &auth->size);
@@ -657,6 +713,7 @@ inline BYTE* unpack_TPM_AuthArea(BYTE* ptr, TPM_AuthArea *auth)
     return ptr;
 }
 
+static
 inline BYTE* pack_TPM2_RSA_KEY(BYTE* ptr, const TPM2_RSA_KEY *key)
 {
     ptr = pack_TPM2B_PRIVATE(ptr, &key->Private);
@@ -664,6 +721,7 @@ inline BYTE* pack_TPM2_RSA_KEY(BYTE* ptr, const TPM2_RSA_KEY *key)
     return ptr;
 }
 
+static
 inline BYTE* unpack_TPM2_RSA_KEY(BYTE* ptr, TPM2_RSA_KEY *key)
 {
     ptr = unpack_TPM2B_PRIVATE(ptr, &key->Private);
diff --git a/stubdom/vtpmmgr/tpmrsa.h b/stubdom/vtpmmgr/tpmrsa.h
index 08213bbb7a..65fd32a45c 100644
--- a/stubdom/vtpmmgr/tpmrsa.h
+++ b/stubdom/vtpmmgr/tpmrsa.h
@@ -62,6 +62,7 @@ TPM_RESULT tpmrsa_pub_encrypt_oaep( tpmrsa_context *ctx,
       unsigned char *output );
 
 /* free tpmrsa key */
+static
 inline void tpmrsa_free( tpmrsa_context *ctx ) {
    mpi_free( &ctx->RN ); mpi_free( &ctx->E  ); mpi_free( &ctx->N  );
 }

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel