summaryrefslogtreecommitdiff
path: root/src/include/tss/tspi.h
blob: 1d188f75042737cd8971cb0b3a457c7ff3ca8db5 (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
#if !defined(_TSPI_H_)
#define _TSPI_H_

#include <tss/tss_defines.h>
#include <tss/tss_typedef.h>
#include <tss/tss_structs.h>
#include <tss/tss_error.h>
#include <tss/tss_error_basics.h>

#if !defined( TSPICALL )
  #if !defined(WIN32) || defined (TSP_STATIC)
    // Linux, or a Win32 static library
    #define TSPICALL extern TSS_RESULT
  #elif defined (TSPDLL_EXPORTS)
    // Win32 DLL build
    #define TSPICALL extern __declspec(dllexport) TSS_RESULT
  #else
    // Win32 DLL import
    #define TSPICALL extern __declspec(dllimport) TSS_RESULT
  #endif
#endif /* TSPICALL */

#if defined ( __cplusplus )
extern "C" {
#endif /* __cplusplus */


// Class-independent ASN.1 conversion functions
TSPICALL Tspi_EncodeDER_TssBlob
(
    UINT32              rawBlobSize,                   // in
    BYTE*               rawBlob,                       // in
    UINT32              blobType,                      // in
    UINT32*             derBlobSize,                   // in, out
    BYTE*               derBlob                        // out
);

TSPICALL Tspi_DecodeBER_TssBlob
(
    UINT32              berBlobSize,                   // in
    BYTE*               berBlob,                       // in
    UINT32*             blobType,                      // out
    UINT32*             rawBlobSize,                   // in, out
    BYTE*               rawBlob                        // out
);



// Common Methods
TSPICALL Tspi_SetAttribUint32
(
    TSS_HOBJECT         hObject,                       // in
    TSS_FLAG            attribFlag,                    // in
    TSS_FLAG            subFlag,                       // in
    UINT32              ulAttrib                       // in
);

TSPICALL Tspi_GetAttribUint32
(
    TSS_HOBJECT         hObject,                       // in
    TSS_FLAG            attribFlag,                    // in
    TSS_FLAG            subFlag,                       // in
    UINT32*             pulAttrib                      // out
);

TSPICALL Tspi_SetAttribData
(
    TSS_HOBJECT         hObject,                       // in
    TSS_FLAG            attribFlag,                    // in
    TSS_FLAG            subFlag,                       // in
    UINT32              ulAttribDataSize,              // in
    BYTE*               rgbAttribData                  // in
);

TSPICALL Tspi_GetAttribData
(
    TSS_HOBJECT         hObject,                       // in
    TSS_FLAG            attribFlag,                    // in
    TSS_FLAG            subFlag,                       // in
    UINT32*             pulAttribDataSize,             // out
    BYTE**              prgbAttribData                 // out
);

TSPICALL Tspi_ChangeAuth
(
    TSS_HOBJECT         hObjectToChange,               // in
    TSS_HOBJECT         hParentObject,                 // in
    TSS_HPOLICY         hNewPolicy                     // in
);

TSPICALL Tspi_ChangeAuthAsym
(
    TSS_HOBJECT         hObjectToChange,               // in
    TSS_HOBJECT         hParentObject,                 // in
    TSS_HKEY            hIdentKey,                     // in
    TSS_HPOLICY         hNewPolicy                     // in
);

TSPICALL Tspi_GetPolicyObject
(
    TSS_HOBJECT         hObject,                       // in
    TSS_FLAG            policyType,                    // in
    TSS_HPOLICY*        phPolicy                       // out
);



// Tspi_Context Class Definitions
TSPICALL Tspi_Context_Create
(
    TSS_HCONTEXT*       phContext                      // out
);

TSPICALL Tspi_Context_Close
(
    TSS_HCONTEXT        hContext                       // in
);

TSPICALL Tspi_Context_Connect
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_UNICODE*        wszDestination                 // in
);

TSPICALL Tspi_Context_FreeMemory
(
    TSS_HCONTEXT        hContext,                      // in
    BYTE*               rgbMemory                      // in
);

TSPICALL Tspi_Context_GetDefaultPolicy
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_HPOLICY*        phPolicy                       // out
);

TSPICALL Tspi_Context_CreateObject
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_FLAG            objectType,                    // in
    TSS_FLAG            initFlags,                     // in
    TSS_HOBJECT*        phObject                       // out
);

TSPICALL Tspi_Context_CloseObject
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_HOBJECT         hObject                        // in
);

TSPICALL Tspi_Context_GetCapability
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_FLAG            capArea,                       // in
    UINT32              ulSubCapLength,                // in
    BYTE*               rgbSubCap,                     // in
    UINT32*             pulRespDataLength,             // out
    BYTE**              prgbRespData                   // out
);

TSPICALL Tspi_Context_GetTpmObject
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_HTPM*           phTPM                          // out
);

TSPICALL Tspi_Context_SetTransEncryptionKey
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_HKEY            hKey                           // in
);

TSPICALL Tspi_Context_CloseSignTransport
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_HKEY            hSigningKey,                   // in
    TSS_VALIDATION*     pValidationData                // in, out
);

TSPICALL Tspi_Context_LoadKeyByBlob
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_HKEY            hUnwrappingKey,                // in
    UINT32              ulBlobLength,                  // in
    BYTE*               rgbBlobData,                   // in
    TSS_HKEY*           phKey                          // out
);

TSPICALL Tspi_Context_LoadKeyByUUID
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_FLAG            persistentStorageType,         // in
    TSS_UUID            uuidData,                      // in
    TSS_HKEY*           phKey                          // out
);

TSPICALL Tspi_Context_RegisterKey
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_HKEY            hKey,                          // in
    TSS_FLAG            persistentStorageType,         // in
    TSS_UUID            uuidKey,                       // in
    TSS_FLAG            persistentStorageTypeParent,   // in
    TSS_UUID            uuidParentKey                  // in
);

TSPICALL Tspi_Context_UnregisterKey
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_FLAG            persistentStorageType,         // in
    TSS_UUID            uuidKey,                       // in
    TSS_HKEY*           phkey                          // out
);

TSPICALL Tspi_Context_GetKeyByUUID
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_FLAG            persistentStorageType,         // in
    TSS_UUID            uuidData,                      // in
    TSS_HKEY*           phKey                          // out
);

TSPICALL Tspi_Context_GetKeyByPublicInfo
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_FLAG            persistentStorageType,         // in
    TSS_ALGORITHM_ID    algID,                         // in
    UINT32              ulPublicInfoLength,            // in
    BYTE*               rgbPublicInfo,                 // in
    TSS_HKEY*           phKey                          // out
);

TSPICALL Tspi_Context_GetRegisteredKeysByUUID
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_FLAG            persistentStorageType,         // in
    TSS_UUID*           pUuidData,                     // in
    UINT32*             pulKeyHierarchySize,           // out
    TSS_KM_KEYINFO**    ppKeyHierarchy                 // out
);

TSPICALL Tspi_Context_GetRegisteredKeysByUUID2
(
    TSS_HCONTEXT        hContext,                      // in
    TSS_FLAG            persistentStorageType,         // in
    TSS_UUID*           pUuidData,                     // in
    UINT32*             pulKeyHierarchySize,           // out
    TSS_KM_KEYINFO2**   ppKeyHierarchy                 // out
);


// Policy class definitions
TSPICALL Tspi_Policy_SetSecret
(
    TSS_HPOLICY         hPolicy,                       // in
    TSS_FLAG            secretMode,                    // in
    UINT32              ulSecretLength,                // in
    BYTE*               rgbSecret                      // in
);

TSPICALL Tspi_Policy_FlushSecret
(
    TSS_HPOLICY         hPolicy                        // in
);

TSPICALL Tspi_Policy_AssignToObject
(
    TSS_HPOLICY         hPolicy,                       // in
    TSS_HOBJECT         hObject                        // in
);



// TPM Class Definitions
TSPICALL Tspi_TPM_KeyControlOwner
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hKey,                          // in
    UINT32              attribName,                    // in
    TSS_BOOL            attribValue,                   // in
    TSS_UUID*           pUuidData                      // out
);

TSPICALL Tspi_TPM_CreateEndorsementKey
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hKey,                          // in
    TSS_VALIDATION*     pValidationData                // in, out
);

TSPICALL Tspi_TPM_CreateRevocableEndorsementKey
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hKey,                          // in
    TSS_VALIDATION*     pValidationData,               // in, out
    UINT32*             pulEkResetDataLength,          // in, out
    BYTE**              rgbEkResetData                 // in, out
);

TSPICALL Tspi_TPM_RevokeEndorsementKey
(
    TSS_HTPM            hTPM,                          // in
    UINT32              ulEkResetDataLength,           // in
    BYTE*               rgbEkResetData                 // in
);

TSPICALL Tspi_TPM_GetPubEndorsementKey
(
    TSS_HTPM            hTPM,                          // in
    TSS_BOOL            fOwnerAuthorized,              // in
    TSS_VALIDATION*     pValidationData,               // in, out
    TSS_HKEY*           phEndorsementPubKey            // out
);

TSPICALL Tspi_TPM_OwnerGetSRKPubKey
(
    TSS_HTPM            hTPM,                          // in
    UINT32*             pulPubKeyLength,               // out
    BYTE**              prgbPubKey                     // out
);

TSPICALL Tspi_TPM_TakeOwnership
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hKeySRK,                       // in
    TSS_HKEY            hEndorsementPubKey             // in
);

TSPICALL Tspi_TPM_ClearOwner
(
    TSS_HTPM            hTPM,                          // in
    TSS_BOOL            fForcedClear                   // in
);

TSPICALL Tspi_TPM_CollateIdentityRequest
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hKeySRK,                       // in
    TSS_HKEY            hCAPubKey,                     // in
    UINT32              ulIdentityLabelLength,         // in
    BYTE*               rgbIdentityLabelData,          // in
    TSS_HKEY            hIdentityKey,                  // in
    TSS_ALGORITHM_ID    algID,                         // in
    UINT32*             pulTCPAIdentityReqLength,      // out
    BYTE**              prgbTCPAIdentityReq            // out
);

TSPICALL Tspi_TPM_ActivateIdentity
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hIdentKey,                     // in
    UINT32              ulAsymCAContentsBlobLength,    // in
    BYTE*               rgbAsymCAContentsBlob,         // in
    UINT32              ulSymCAAttestationBlobLength,  // in
    BYTE*               rgbSymCAAttestationBlob,       // in
    UINT32*             pulCredentialLength,           // out
    BYTE**              prgbCredential                 // out
);

TSPICALL Tspi_TPM_CreateMaintenanceArchive
(
    TSS_HTPM            hTPM,                          // in
    TSS_BOOL            fGenerateRndNumber,            // in
    UINT32*             pulRndNumberLength,            // out
    BYTE**              prgbRndNumber,                 // out
    UINT32*             pulArchiveDataLength,          // out
    BYTE**              prgbArchiveData                // out
);

TSPICALL Tspi_TPM_KillMaintenanceFeature
(
    TSS_HTPM            hTPM                           // in
);

TSPICALL Tspi_TPM_LoadMaintenancePubKey
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hMaintenanceKey,               // in
    TSS_VALIDATION*     pValidationData                // in, out
);

TSPICALL Tspi_TPM_CheckMaintenancePubKey
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hMaintenanceKey,               // in
    TSS_VALIDATION*     pValidationData                // in, out
);

TSPICALL Tspi_TPM_SetOperatorAuth
(
    TSS_HTPM            hTPM,                          // in
    TSS_HPOLICY         hOperatorPolicy                // in
);

TSPICALL Tspi_TPM_SetStatus
(
    TSS_HTPM            hTPM,                          // in
    TSS_FLAG            statusFlag,                    // in
    TSS_BOOL            fTpmState                      // in
);

TSPICALL Tspi_TPM_GetStatus
(
    TSS_HTPM            hTPM,                          // in
    TSS_FLAG            statusFlag,                    // in
    TSS_BOOL*           pfTpmState                     // out
);

TSPICALL Tspi_TPM_GetCapability
(
    TSS_HTPM            hTPM,                          // in
    TSS_FLAG            capArea,                       // in
    UINT32              ulSubCapLength,                // in
    BYTE*               rgbSubCap,                     // in
    UINT32*             pulRespDataLength,             // out
    BYTE**              prgbRespData                   // out
);

TSPICALL Tspi_TPM_GetCapabilitySigned
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hKey,                          // in
    TSS_FLAG            capArea,                       // in
    UINT32              ulSubCapLength,                // in
    BYTE*               rgbSubCap,                     // in
    TSS_VALIDATION*     pValidationData,               // in, out
    UINT32*             pulRespDataLength,             // out
    BYTE**              prgbRespData                   // out
);

TSPICALL Tspi_TPM_SelfTestFull
(
    TSS_HTPM            hTPM                           // in
);

TSPICALL Tspi_TPM_CertifySelfTest
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hKey,                          // in
    TSS_VALIDATION*     pValidationData                // in, out
);

TSPICALL Tspi_TPM_GetTestResult
(
    TSS_HTPM            hTPM,                          // in
    UINT32*             pulTestResultLength,           // out
    BYTE**              prgbTestResult                 // out
);

TSPICALL Tspi_TPM_GetRandom
(
    TSS_HTPM            hTPM,                          // in
    UINT32              ulRandomDataLength,            // in
    BYTE**              prgbRandomData                 // out
);

TSPICALL Tspi_TPM_StirRandom
(
    TSS_HTPM            hTPM,                          // in
    UINT32              ulEntropyDataLength,           // in
    BYTE*               rgbEntropyData                 // in
);

TSPICALL Tspi_TPM_GetEvent
(
    TSS_HTPM            hTPM,                          // in
    UINT32              ulPcrIndex,                    // in
    UINT32              ulEventNumber,                 // in
    TSS_PCR_EVENT*      pPcrEvent                      // out
);

TSPICALL Tspi_TPM_GetEvents
(
    TSS_HTPM            hTPM,                          // in
    UINT32              ulPcrIndex,                    // in
    UINT32              ulStartNumber,                 // in
    UINT32*             pulEventNumber,                // in, out
    TSS_PCR_EVENT**     prgPcrEvents                   // out
);

TSPICALL Tspi_TPM_GetEventLog
(
    TSS_HTPM            hTPM,                          // in
    UINT32*             pulEventNumber,                // out
    TSS_PCR_EVENT**     prgPcrEvents                   // out
);

TSPICALL Tspi_TPM_Quote
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hIdentKey,                     // in
    TSS_HPCRS           hPcrComposite,                 // in
    TSS_VALIDATION*     pValidationData                // in, out
);

TSPICALL Tspi_TPM_Quote2
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hIdentKey,                     // in
    TSS_BOOL            fAddVersion,                   // in
    TSS_HPCRS           hPcrComposite,                 // in
    TSS_VALIDATION*     pValidationData,               // in, out
    UINT32*             versionInfoSize,               // out
    BYTE**              versionInfo                    // out
);

TSPICALL Tspi_TPM_PcrExtend
(
    TSS_HTPM            hTPM,                          // in
    UINT32              ulPcrIndex,                    // in
    UINT32              ulPcrDataLength,               // in
    BYTE*               pbPcrData,                     // in
    TSS_PCR_EVENT*      pPcrEvent,                     // in
    UINT32*             pulPcrValueLength,             // out
    BYTE**              prgbPcrValue                   // out
);

TSPICALL Tspi_TPM_PcrRead
(
    TSS_HTPM            hTPM,                          // in
    UINT32              ulPcrIndex,                    // in
    UINT32*             pulPcrValueLength,             // out
    BYTE**              prgbPcrValue                   // out
);

TSPICALL Tspi_TPM_PcrReset
(
    TSS_HTPM            hTPM,                          // in
    TSS_HPCRS           hPcrComposite                  // in
);

TSPICALL Tspi_TPM_AuthorizeMigrationTicket
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hMigrationKey,                 // in
    TSS_MIGRATE_SCHEME  migrationScheme,               // in
    UINT32*             pulMigTicketLength,            // out
    BYTE**              prgbMigTicket                  // out
);

TSPICALL Tspi_TPM_CMKSetRestrictions
(
    TSS_HTPM            hTPM,                          // in
    TSS_CMK_DELEGATE    CmkDelegate                    // in
);

TSPICALL Tspi_TPM_CMKApproveMA
(
    TSS_HTPM            hTPM,                          // in
    TSS_HMIGDATA        hMaAuthData                    // in
);

TSPICALL Tspi_TPM_CMKCreateTicket
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hVerifyKey,                    // in
    TSS_HMIGDATA        hSigData                       // in
);

TSPICALL Tspi_TPM_ReadCounter
(
    TSS_HTPM            hTPM,                          // in
    UINT32*             counterValue                   // out
);

TSPICALL Tspi_TPM_ReadCurrentTicks
(
    TSS_HTPM            hTPM,                          // in
    TPM_CURRENT_TICKS*  tickCount                      // out
);

TSPICALL Tspi_TPM_DirWrite
(
    TSS_HTPM            hTPM,                          // in
    UINT32              ulDirIndex,                    // in
    UINT32              ulDirDataLength,               // in
    BYTE*               rgbDirData                     // in
);

TSPICALL Tspi_TPM_DirRead
(
    TSS_HTPM            hTPM,                          // in
    UINT32              ulDirIndex,                    // in
    UINT32*             pulDirDataLength,              // out
    BYTE**              prgbDirData                    // out
);

TSPICALL Tspi_TPM_Delegate_AddFamily
(
    TSS_HTPM            hTPM,                          // in, must not be NULL
    BYTE                bLabel,                        // in
    TSS_HDELFAMILY*     phFamily                       // out
);

TSPICALL Tspi_TPM_Delegate_GetFamily
(
    TSS_HTPM            hTPM,                          // in, must not NULL
    UINT32              ulFamilyID,                    // in
    TSS_HDELFAMILY*     phFamily                       // out
);

TSPICALL Tspi_TPM_Delegate_InvalidateFamily
(
    TSS_HTPM            hTPM,                          // in, must not be NULL
    TSS_HDELFAMILY      hFamily                        // in
);

TSPICALL Tspi_TPM_Delegate_CreateDelegation
(
    TSS_HOBJECT         hObject,                       // in
    BYTE                bLabel,                        // in
    UINT32              ulFlags,                       // in
    TSS_HPCRS           hPcr,                          // in, may be NULL
    TSS_HDELFAMILY      hFamily,                       // in
    TSS_HPOLICY         hDelegation                    // in, out
);

TSPICALL Tspi_TPM_Delegate_CacheOwnerDelegation
(
    TSS_HTPM            hTPM,                          // in, must not be NULL
    TSS_HPOLICY         hDelegation,                   // in, out
    UINT32              ulIndex,                       // in
    UINT32              ulFlags                        // in
);

TSPICALL Tspi_TPM_Delegate_UpdateVerificationCount
(
    TSS_HTPM            hTPM,                          // in
    TSS_HPOLICY         hDelegation                    // in, out
);

TSPICALL Tspi_TPM_Delegate_VerifyDelegation
(
    TSS_HPOLICY         hDelegation                    // in, out
);

TSPICALL Tspi_TPM_Delegate_ReadTables
(
    TSS_HCONTEXT                  hContext,                      // in
    UINT32*                       pulFamilyTableSize,            // out
    TSS_FAMILY_TABLE_ENTRY**      ppFamilyTable,                 // out
    UINT32*                       pulDelegateTableSize,          // out
    TSS_DELEGATION_TABLE_ENTRY**  ppDelegateTable                // out
);

TSPICALL Tspi_TPM_DAA_JoinInit
(
    TSS_HTPM                      hTPM,                          // in
    TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
    UINT32                        daaCounter,                    // in
    UINT32                        issuerAuthPKsLength,           // in
    TSS_HKEY*                     issuerAuthPKs,                 // in
    UINT32                        issuerAuthPKSignaturesLength,  // in
    UINT32                        issuerAuthPKSignaturesLength2, // in
    BYTE**                        issuerAuthPKSignatures,        // in
    UINT32*                       capitalUprimeLength,           // out
    BYTE**                        capitalUprime,                 // out
    TSS_DAA_IDENTITY_PROOF**      identityProof,                 // out
    UINT32*                       joinSessionLength,             // out
    BYTE**                        joinSession                    // out
);

TSPICALL Tspi_TPM_DAA_JoinCreateDaaPubKey
(
    TSS_HTPM                      hTPM,                          // in
    TSS_HDAA_CREDENTIAL           hDAACredential,                // in
    UINT32                        authenticationChallengeLength, // in
    BYTE*                         authenticationChallenge,       // in
    UINT32                        nonceIssuerLength,             // in
    BYTE*                         nonceIssuer,                   // in
    UINT32                        attributesPlatformLength,      // in
    UINT32                        attributesPlatformLength2,     // in
    BYTE**                        attributesPlatform,            // in
    UINT32                        joinSessionLength,             // in
    BYTE*                         joinSession,                   // in
    TSS_DAA_CREDENTIAL_REQUEST**  credentialRequest              // out
);

TSPICALL Tspi_TPM_DAA_JoinStoreCredential
(
    TSS_HTPM                      hTPM,                          // in
    TSS_HDAA_CREDENTIAL           hDAACredential,                // in
    TSS_DAA_CRED_ISSUER*          credIssuer,                    // in
    UINT32                        joinSessionLength,             // in
    BYTE*                         joinSession                    // in
);

TSPICALL Tspi_TPM_DAA_Sign
(
    TSS_HTPM                      hTPM,                          // in
    TSS_HDAA_CREDENTIAL           hDAACredential,                // in
    TSS_HDAA_ARA_KEY              hARAKey,                       // in
    TSS_DAA_SELECTED_ATTRIB*      revealAttributes,              // in
    UINT32                        verifierNonceLength,           // in
    BYTE*                         verifierNonce,                 // in
    UINT32                        verifierBaseNameLength,        // in
    BYTE*                         verifierBaseName,              // in
    TSS_HOBJECT                   signData,                      // in
    TSS_DAA_SIGNATURE**           daaSignature                   // out
);

TSPICALL Tspi_TPM_GetAuditDigest
(
    TSS_HTPM            hTPM,                          // in
    TSS_HKEY            hKey,                          // in
    TSS_BOOL            closeAudit,                    // in
    UINT32*             pulAuditDigestSize,            // out
    BYTE**              prgbAuditDigest,               // out
    TPM_COUNTER_VALUE*  pCounterValue,                 // out
    TSS_VALIDATION*     pValidationData,               // out
    UINT32*             ordSize,                       // out
    UINT32**            ordList                        // out
);



// PcrComposite Class Definitions
TSPICALL Tspi_PcrComposite_SelectPcrIndex
(
    TSS_HPCRS           hPcrComposite,                 // in
    UINT32              ulPcrIndex                     // in
);

TSPICALL Tspi_PcrComposite_SelectPcrIndexEx
(
    TSS_HPCRS           hPcrComposite,                 // in
    UINT32              ulPcrIndex,                    // in
    UINT32              direction                      // in
);

TSPICALL Tspi_PcrComposite_SetPcrValue
(
    TSS_HPCRS           hPcrComposite,                 // in
    UINT32              ulPcrIndex,                    // in
    UINT32              ulPcrValueLength,              // in
    BYTE*               rgbPcrValue                    // in
);

TSPICALL Tspi_PcrComposite_GetPcrValue
(
    TSS_HPCRS           hPcrComposite,                 // in
    UINT32              ulPcrIndex,                    // in
    UINT32*             pulPcrValueLength,             // out
    BYTE**              prgbPcrValue                   // out
);

TSPICALL Tspi_PcrComposite_SetPcrLocality
(
    TSS_HPCRS           hPcrComposite,                 // in
    UINT32              LocalityValue                  // in
);

TSPICALL Tspi_PcrComposite_GetPcrLocality
(
    TSS_HPCRS           hPcrComposite,                 // in
    UINT32*             pLocalityValue                 // out
);

TSPICALL Tspi_PcrComposite_GetCompositeHash
(
    TSS_HPCRS           hPcrComposite,                 // in
    UINT32*             pLen,                          // in
    BYTE**              ppbHashData                    // out
);



// Key Class Definition
TSPICALL Tspi_Key_LoadKey
(
    TSS_HKEY            hKey,                          // in
    TSS_HKEY            hUnwrappingKey                 // in
);

TSPICALL Tspi_Key_UnloadKey
(
    TSS_HKEY            hKey                           // in
);

TSPICALL Tspi_Key_GetPubKey
(
    TSS_HKEY            hKey,                          // in
    UINT32*             pulPubKeyLength,               // out
    BYTE**              prgbPubKey                     // out
);

TSPICALL Tspi_Key_CertifyKey
(
    TSS_HKEY            hKey,                          // in
    TSS_HKEY            hCertifyingKey,                // in
    TSS_VALIDATION*     pValidationData                // in, out
);

TSPICALL Tspi_Key_CreateKey
(
    TSS_HKEY            hKey,                          // in
    TSS_HKEY            hWrappingKey,                  // in
    TSS_HPCRS           hPcrComposite                  // in, may be NULL
);

TSPICALL Tspi_Key_WrapKey
(
    TSS_HKEY            hKey,                          // in
    TSS_HKEY            hWrappingKey,                  // in
    TSS_HPCRS           hPcrComposite                  // in, may be NULL
);

TSPICALL Tspi_Key_CreateMigrationBlob
(
    TSS_HKEY            hKeyToMigrate,                 // in
    TSS_HKEY            hParentKey,                    // in
    UINT32              ulMigTicketLength,             // in
    BYTE*               rgbMigTicket,                  // in
    UINT32*             pulRandomLength,               // out
    BYTE**              prgbRandom,                    // out
    UINT32*             pulMigrationBlobLength,        // out
    BYTE**              prgbMigrationBlob              // out
);

TSPICALL Tspi_Key_ConvertMigrationBlob
(
    TSS_HKEY            hKeyToMigrate,                 // in
    TSS_HKEY            hParentKey,                    // in
    UINT32              ulRandomLength,                // in
    BYTE*               rgbRandom,                     // in
    UINT32              ulMigrationBlobLength,         // in
    BYTE*               rgbMigrationBlob               // in
);

TSPICALL Tspi_Key_MigrateKey
(
    TSS_HKEY            hMaKey,                        // in
    TSS_HKEY            hPublicKey,                    // in
    TSS_HKEY            hMigData                       // in
);

TSPICALL Tspi_Key_CMKCreateBlob
(
    TSS_HKEY            hKeyToMigrate,                 // in
    TSS_HKEY            hParentKey,                    // in
    TSS_HMIGDATA        hMigrationData,                // in
    UINT32*             pulRandomLength,               // out
    BYTE**              prgbRandom                     // out
);

TSPICALL Tspi_Key_CMKConvertMigration
(
    TSS_HKEY            hKeyToMigrate,                 // in
    TSS_HKEY            hParentKey,                    // in
    TSS_HMIGDATA        hMigrationData,                // in
    UINT32              ulRandomLength,                // in
    BYTE*               rgbRandom                      // in
);



// Hash Class Definition
TSPICALL Tspi_Hash_Sign
(
    TSS_HHASH           hHash,                         // in
    TSS_HKEY            hKey,                          // in
    UINT32*             pulSignatureLength,            // out
    BYTE**              prgbSignature                  // out
);

TSPICALL Tspi_Hash_VerifySignature
(
    TSS_HHASH           hHash,                         // in
    TSS_HKEY            hKey,                          // in
    UINT32              ulSignatureLength,             // in
    BYTE*               rgbSignature                   // in
);

TSPICALL Tspi_Hash_SetHashValue
(
    TSS_HHASH           hHash,                         // in
    UINT32              ulHashValueLength,             // in
    BYTE*               rgbHashValue                   // in
);

TSPICALL Tspi_Hash_GetHashValue
(
    TSS_HHASH           hHash,                         // in
    UINT32*             pulHashValueLength,            // out
    BYTE**              prgbHashValue                  // out
);

TSPICALL Tspi_Hash_UpdateHashValue
(
    TSS_HHASH           hHash,                         // in
    UINT32              ulDataLength,                  // in
    BYTE*               rgbData                        // in
);

TSPICALL Tspi_Hash_TickStampBlob
(
    TSS_HHASH           hHash,                         // in
    TSS_HKEY            hIdentKey,                     // in
    TSS_VALIDATION*     pValidationData                // in
);



// EncData Class Definition
TSPICALL Tspi_Data_Bind
(
    TSS_HENCDATA        hEncData,                      // in
    TSS_HKEY            hEncKey,                       // in
    UINT32              ulDataLength,                  // in
    BYTE*               rgbDataToBind                  // in
);

TSPICALL Tspi_Data_Unbind
(
    TSS_HENCDATA        hEncData,                      // in
    TSS_HKEY            hKey,                          // in
    UINT32*             pulUnboundDataLength,          // out
    BYTE**              prgbUnboundData                // out
);

TSPICALL Tspi_Data_Seal
(
    TSS_HENCDATA        hEncData,                      // in
    TSS_HKEY            hEncKey,                       // in
    UINT32              ulDataLength,                  // in
    BYTE*               rgbDataToSeal,                 // in
    TSS_HPCRS           hPcrComposite                  // in
);

TSPICALL Tspi_Data_Unseal
(
    TSS_HENCDATA        hEncData,                      // in
    TSS_HKEY            hKey,                          // in
    UINT32*             pulUnsealedDataLength,         // out
    BYTE**              prgbUnsealedData               // out
);



// NV Class Definition
TSPICALL Tspi_NV_DefineSpace
(
    TSS_HNVSTORE        hNVStore,                      // in
    TSS_HPCRS           hReadPcrComposite,             // in, may be NULL
    TSS_HPCRS           hWritePcrComposite             // in, may be NULL
);

TSPICALL Tspi_NV_ReleaseSpace
(
    TSS_HNVSTORE        hNVStore                       // in
);

TSPICALL Tspi_NV_WriteValue
(
    TSS_HNVSTORE        hNVStore,                      // in
    UINT32              offset,                        // in
    UINT32              ulDataLength,                  // in
    BYTE*               rgbDataToWrite                 // in
);

TSPICALL Tspi_NV_ReadValue
(
    TSS_HNVSTORE        hNVStore,                      // in
    UINT32              offset,                        // in
    UINT32*             ulDataLength,                  // in, out
    BYTE**              rgbDataRead                    // out
);


// DAA Utility functions (optional, do not require a TPM or TCS)
TSPICALL Tspi_DAA_IssuerKeyVerify
(
    TSS_HDAA_CREDENTIAL           hDAACredential,                // in
    TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
    TSS_BOOL*                     isCorrect                      // out
);

TSPICALL Tspi_DAA_Issuer_GenerateKey
(
    TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
    UINT32                        issuerBaseNameLength,          // in
    BYTE*                         issuerBaseName                 // in
);

TSPICALL Tspi_DAA_Issuer_InitCredential
(
    TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
    TSS_HKEY                      issuerAuthPK,                  // in
    TSS_DAA_IDENTITY_PROOF*       identityProof,                 // in
    UINT32                        capitalUprimeLength,           // in
    BYTE*                         capitalUprime,                 // in
    UINT32                        daaCounter,                    // in
    UINT32*                       nonceIssuerLength,             // out
    BYTE**                        nonceIssuer,                   // out
    UINT32*                       authenticationChallengeLength, // out
    BYTE**                        authenticationChallenge,       // out
    UINT32*                       joinSessionLength,             // out
    BYTE**                        joinSession                    // out
);

TSPICALL Tspi_DAA_Issuer_IssueCredential
(
    TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
    TSS_DAA_CREDENTIAL_REQUEST*   credentialRequest,             // in
    UINT32                        issuerJoinSessionLength,       // in
    BYTE*                         issuerJoinSession,             // in
    TSS_DAA_CRED_ISSUER**         credIssuer                     // out
);

TSPICALL Tspi_DAA_Verifier_Init
(
    TSS_HDAA_CREDENTIAL           hDAACredential,                // in
    UINT32*                       nonceVerifierLength,           // out
    BYTE**                        nonceVerifier,                 // out
    UINT32*                       baseNameLength,                // out
    BYTE**                        baseName                       // out
);

TSPICALL Tspi_DAA_VerifySignature
(
    TSS_HDAA_CREDENTIAL           hDAACredential,                // in
    TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
    TSS_HDAA_ARA_KEY              hARAKey,                       // in
    TSS_HHASH                     hARACondition,                 // in
    UINT32                        attributesLength,              // in
    UINT32                        attributesLength2,             // in
    BYTE**                        attributes,                    // in
    UINT32                        verifierNonceLength,           // in
    BYTE*                         verifierNonce,                 // in
    UINT32                        verifierBaseNameLength,        // in
    BYTE*                         verifierBaseName,              // in
    TSS_HOBJECT                   signData,                      // in
    TSS_DAA_SIGNATURE*            daaSignature,                  // in
    TSS_BOOL*                     isCorrect                      // out
);

TSPICALL Tspi_DAA_ARA_GenerateKey
(
    TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
    TSS_HDAA_ARA_KEY              hARAKey                        // in
);

TSPICALL Tspi_DAA_ARA_RevokeAnonymity
(
    TSS_HDAA_ARA_KEY              hARAKey,                       // in
    TSS_HHASH                     hARACondition,                 // in
    TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
    TSS_DAA_PSEUDONYM_ENCRYPTED*  encryptedPseudonym,            // in
    TSS_DAA_PSEUDONYM_PLAIN**     pseudonym                      // out
);



// Callback typedefs
typedef TSS_RESULT (*Tspicb_CallbackHMACAuth)
(
    PVOID            lpAppData,          // in
    TSS_HOBJECT      hAuthorizedObject,  // in
    TSS_BOOL         ReturnOrVerify,     // in
    UINT32           ulPendingFunction,  // in
    TSS_BOOL         ContinueUse,        // in
    UINT32           ulSizeNonces,       // in
    BYTE*            rgbNonceEven,       // in
    BYTE*            rgbNonceOdd,        // in
    BYTE*            rgbNonceEvenOSAP,   // in
    BYTE*            rgbNonceOddOSAP,    // in
    UINT32           ulSizeDigestHmac,   // in
    BYTE*            rgbParamDigest,     // in
    BYTE*            rgbHmacData         // in, out
);

typedef TSS_RESULT (*Tspicb_CallbackXorEnc)
(
   PVOID            lpAppData,            // in
   TSS_HOBJECT      hOSAPObject,          // in
   TSS_HOBJECT      hObject,              // in
   TSS_FLAG         PurposeSecret,        // in
   UINT32           ulSizeNonces,         // in
   BYTE*            rgbNonceEven,         // in
   BYTE*            rgbNonceOdd,          // in
   BYTE*            rgbNonceEvenOSAP,     // in
   BYTE*            rgbNonceOddOSAP,      // in
   UINT32           ulSizeEncAuth,        // in
   BYTE*            rgbEncAuthUsage,      // out
   BYTE*            rgbEncAuthMigration   // out
);

typedef TSS_RESULT (*Tspicb_CallbackTakeOwnership)
(
   PVOID            lpAppData,         // in
   TSS_HOBJECT      hObject,           // in
   TSS_HKEY         hObjectPubKey,     // in
   UINT32           ulSizeEncAuth,     // in
   BYTE*            rgbEncAuth         // out
);

typedef TSS_RESULT (*Tspicb_CallbackSealxMask)
(
    PVOID            lpAppData,        // in
    TSS_HKEY         hKey,             // in
    TSS_HENCDATA     hEncData,         // in
    TSS_ALGORITHM_ID algID,            // in
    UINT32           ulSizeNonces,     // in
    BYTE*            rgbNonceEven,     // in
    BYTE*            rgbNonceOdd,      // in
    BYTE*            rgbNonceEvenOSAP, // in
    BYTE*            rgbNonceOddOSAP,  // in
    UINT32           ulDataLength,     // in
    BYTE*            rgbDataToMask,    // in
    BYTE*            rgbMaskedData     // out
);

typedef TSS_RESULT (*Tspicb_CallbackChangeAuthAsym)
(
   PVOID            lpAppData,        // in
   TSS_HOBJECT      hObject,          // in
   TSS_HKEY         hObjectPubKey,    // in
   UINT32           ulSizeEncAuth,    // in
   UINT32           ulSizeAuthLink,   // in
   BYTE*            rgbEncAuth,       // out
   BYTE*            rgbAuthLink       // out
);

typedef TSS_RESULT (*Tspicb_CollateIdentity)
(
   PVOID            lpAppData,                      // in
   UINT32           ulTCPAPlainIdentityProofLength, // in
   BYTE*            rgbTCPAPlainIdentityProof,      // in
   TSS_ALGORITHM_ID algID,                          // in
   UINT32           ulSessionKeyLength,             // out
   BYTE*            rgbSessionKey,                  // out
   UINT32*          pulTCPAIdentityProofLength,     // out
   BYTE*            rgbTCPAIdentityProof            // out
);


typedef TSS_RESULT (*Tspicb_ActivateIdentity)
(
   PVOID            lpAppData,                    // in
   UINT32           ulSessionKeyLength,           // in
   BYTE*            rgbSessionKey,                // in
   UINT32           ulSymCAAttestationBlobLength, // in
   BYTE*            rgbSymCAAttestationBlob,      // in
   UINT32*          pulCredentialLength,          // out
   BYTE*            rgbCredential                 // out
);


typedef TSS_RESULT (*Tspicb_DAA_Sign)
(
    PVOID                        lpAppData,                 // in
    TSS_HDAA_ISSUER_KEY          daaPublicKey,              // in
    UINT32                       gammasLength,              // in
    BYTE**                       gammas,                    // in
    UINT32                       attributesLength,          // in
    BYTE**                       attributes,                // in
    UINT32                       randomAttributesLength,    // in
    BYTE**                       randomAttributes,          // in
    UINT32                       attributeCommitmentsLength,// in
    TSS_DAA_ATTRIB_COMMIT*       attributeCommitments,      // in
    TSS_DAA_ATTRIB_COMMIT*       attributeCommitmentsProof, // in
    TSS_DAA_PSEUDONYM_PLAIN*     pseudonym,                 // in
    TSS_DAA_PSEUDONYM_PLAIN*     pseudonymTilde,            // in
    TSS_DAA_PSEUDONYM_ENCRYPTED* pseudonymEncrypted,        // in
    TSS_DAA_PSEUDONYM_ENCRYPTED* pseudonymEncProof,         // in
    TSS_DAA_SIGN_CALLBACK**      additionalProof            // out
);

typedef TSS_RESULT (*Tspicb_DAA_VerifySignature)
(
    PVOID                        lpAppData,                 // in
    UINT32                       challengeLength,           // in
    BYTE*                        challenge,                 // in
    TSS_DAA_SIGN_CALLBACK*       additionalProof,           // in
    TSS_HDAA_ISSUER_KEY          daaPublicKey,              // in
    UINT32                       gammasLength,              // in
    BYTE**                       gammas,                    // in
    UINT32                       sAttributesLength,         // in
    BYTE**                       sAttributes,               // in
    UINT32                       attributeCommitmentsLength,// in
    TSS_DAA_ATTRIB_COMMIT*       attributeCommitments,      // in
    TSS_DAA_ATTRIB_COMMIT*       attributeCommitmentsProof, // in
    UINT32                       zetaLength,                // in
    BYTE*                        zeta,                      // in
    UINT32                       sFLength,                  // in
    BYTE*                        sF,                        // in
    TSS_DAA_PSEUDONYM*           pseudonym,                 // in
    TSS_DAA_PSEUDONYM*           pseudonymProof,            // in
    TSS_BOOL*                    isCorrect                  // out
);


#if defined ( __cplusplus )
}
#endif /* __cplusplus */


#endif /* _TSPI_H_ */