1 #if !defined(_TSPI_H_)
2 #define _TSPI_H_
3 
4 #include <tss/tss_defines.h>
5 #include <tss/tss_typedef.h>
6 #include <tss/tss_structs.h>
7 #include <tss/tss_error.h>
8 #include <tss/tss_error_basics.h>
9 
10 #if !defined( TSPICALL )
11   #if !defined(WIN32) || defined (TSP_STATIC)
12     // Linux, or a Win32 static library
13     #define TSPICALL extern TSS_RESULT
14   #elif defined (TSPDLL_EXPORTS)
15     // Win32 DLL build
16     #define TSPICALL extern __declspec(dllexport) TSS_RESULT
17   #else
18     // Win32 DLL import
19     #define TSPICALL extern __declspec(dllimport) TSS_RESULT
20   #endif
21 #endif /* TSPICALL */
22 
23 #if defined ( __cplusplus )
24 extern "C" {
25 #endif /* __cplusplus */
26 
27 
28 // Class-independent ASN.1 conversion functions
29 TSPICALL Tspi_EncodeDER_TssBlob
30 (
31     UINT32              rawBlobSize,                   // in
32     BYTE*               rawBlob,                       // in
33     UINT32              blobType,                      // in
34     UINT32*             derBlobSize,                   // in, out
35     BYTE*               derBlob                        // out
36 );
37 
38 TSPICALL Tspi_DecodeBER_TssBlob
39 (
40     UINT32              berBlobSize,                   // in
41     BYTE*               berBlob,                       // in
42     UINT32*             blobType,                      // out
43     UINT32*             rawBlobSize,                   // in, out
44     BYTE*               rawBlob                        // out
45 );
46 
47 
48 
49 // Common Methods
50 TSPICALL Tspi_SetAttribUint32
51 (
52     TSS_HOBJECT         hObject,                       // in
53     TSS_FLAG            attribFlag,                    // in
54     TSS_FLAG            subFlag,                       // in
55     UINT32              ulAttrib                       // in
56 );
57 
58 TSPICALL Tspi_GetAttribUint32
59 (
60     TSS_HOBJECT         hObject,                       // in
61     TSS_FLAG            attribFlag,                    // in
62     TSS_FLAG            subFlag,                       // in
63     UINT32*             pulAttrib                      // out
64 );
65 
66 TSPICALL Tspi_SetAttribData
67 (
68     TSS_HOBJECT         hObject,                       // in
69     TSS_FLAG            attribFlag,                    // in
70     TSS_FLAG            subFlag,                       // in
71     UINT32              ulAttribDataSize,              // in
72     BYTE*               rgbAttribData                  // in
73 );
74 
75 TSPICALL Tspi_GetAttribData
76 (
77     TSS_HOBJECT         hObject,                       // in
78     TSS_FLAG            attribFlag,                    // in
79     TSS_FLAG            subFlag,                       // in
80     UINT32*             pulAttribDataSize,             // out
81     BYTE**              prgbAttribData                 // out
82 );
83 
84 TSPICALL Tspi_ChangeAuth
85 (
86     TSS_HOBJECT         hObjectToChange,               // in
87     TSS_HOBJECT         hParentObject,                 // in
88     TSS_HPOLICY         hNewPolicy                     // in
89 );
90 
91 TSPICALL Tspi_ChangeAuthAsym
92 (
93     TSS_HOBJECT         hObjectToChange,               // in
94     TSS_HOBJECT         hParentObject,                 // in
95     TSS_HKEY            hIdentKey,                     // in
96     TSS_HPOLICY         hNewPolicy                     // in
97 );
98 
99 TSPICALL Tspi_GetPolicyObject
100 (
101     TSS_HOBJECT         hObject,                       // in
102     TSS_FLAG            policyType,                    // in
103     TSS_HPOLICY*        phPolicy                       // out
104 );
105 
106 
107 
108 // Tspi_Context Class Definitions
109 TSPICALL Tspi_Context_Create
110 (
111     TSS_HCONTEXT*       phContext                      // out
112 );
113 
114 TSPICALL Tspi_Context_Close
115 (
116     TSS_HCONTEXT        hContext                       // in
117 );
118 
119 TSPICALL Tspi_Context_Connect
120 (
121     TSS_HCONTEXT        hContext,                      // in
122     TSS_UNICODE*        wszDestination                 // in
123 );
124 
125 TSPICALL Tspi_Context_FreeMemory
126 (
127     TSS_HCONTEXT        hContext,                      // in
128     BYTE*               rgbMemory                      // in
129 );
130 
131 TSPICALL Tspi_Context_GetDefaultPolicy
132 (
133     TSS_HCONTEXT        hContext,                      // in
134     TSS_HPOLICY*        phPolicy                       // out
135 );
136 
137 TSPICALL Tspi_Context_CreateObject
138 (
139     TSS_HCONTEXT        hContext,                      // in
140     TSS_FLAG            objectType,                    // in
141     TSS_FLAG            initFlags,                     // in
142     TSS_HOBJECT*        phObject                       // out
143 );
144 
145 TSPICALL Tspi_Context_CloseObject
146 (
147     TSS_HCONTEXT        hContext,                      // in
148     TSS_HOBJECT         hObject                        // in
149 );
150 
151 TSPICALL Tspi_Context_GetCapability
152 (
153     TSS_HCONTEXT        hContext,                      // in
154     TSS_FLAG            capArea,                       // in
155     UINT32              ulSubCapLength,                // in
156     BYTE*               rgbSubCap,                     // in
157     UINT32*             pulRespDataLength,             // out
158     BYTE**              prgbRespData                   // out
159 );
160 
161 TSPICALL Tspi_Context_GetTpmObject
162 (
163     TSS_HCONTEXT        hContext,                      // in
164     TSS_HTPM*           phTPM                          // out
165 );
166 
167 TSPICALL Tspi_Context_SetTransEncryptionKey
168 (
169     TSS_HCONTEXT        hContext,                      // in
170     TSS_HKEY            hKey                           // in
171 );
172 
173 TSPICALL Tspi_Context_CloseSignTransport
174 (
175     TSS_HCONTEXT        hContext,                      // in
176     TSS_HKEY            hSigningKey,                   // in
177     TSS_VALIDATION*     pValidationData                // in, out
178 );
179 
180 TSPICALL Tspi_Context_LoadKeyByBlob
181 (
182     TSS_HCONTEXT        hContext,                      // in
183     TSS_HKEY            hUnwrappingKey,                // in
184     UINT32              ulBlobLength,                  // in
185     BYTE*               rgbBlobData,                   // in
186     TSS_HKEY*           phKey                          // out
187 );
188 
189 TSPICALL Tspi_Context_LoadKeyByUUID
190 (
191     TSS_HCONTEXT        hContext,                      // in
192     TSS_FLAG            persistentStorageType,         // in
193     TSS_UUID            uuidData,                      // in
194     TSS_HKEY*           phKey                          // out
195 );
196 
197 TSPICALL Tspi_Context_RegisterKey
198 (
199     TSS_HCONTEXT        hContext,                      // in
200     TSS_HKEY            hKey,                          // in
201     TSS_FLAG            persistentStorageType,         // in
202     TSS_UUID            uuidKey,                       // in
203     TSS_FLAG            persistentStorageTypeParent,   // in
204     TSS_UUID            uuidParentKey                  // in
205 );
206 
207 TSPICALL Tspi_Context_UnregisterKey
208 (
209     TSS_HCONTEXT        hContext,                      // in
210     TSS_FLAG            persistentStorageType,         // in
211     TSS_UUID            uuidKey,                       // in
212     TSS_HKEY*           phkey                          // out
213 );
214 
215 TSPICALL Tspi_Context_GetKeyByUUID
216 (
217     TSS_HCONTEXT        hContext,                      // in
218     TSS_FLAG            persistentStorageType,         // in
219     TSS_UUID            uuidData,                      // in
220     TSS_HKEY*           phKey                          // out
221 );
222 
223 TSPICALL Tspi_Context_GetKeyByPublicInfo
224 (
225     TSS_HCONTEXT        hContext,                      // in
226     TSS_FLAG            persistentStorageType,         // in
227     TSS_ALGORITHM_ID    algID,                         // in
228     UINT32              ulPublicInfoLength,            // in
229     BYTE*               rgbPublicInfo,                 // in
230     TSS_HKEY*           phKey                          // out
231 );
232 
233 TSPICALL Tspi_Context_GetRegisteredKeysByUUID
234 (
235     TSS_HCONTEXT        hContext,                      // in
236     TSS_FLAG            persistentStorageType,         // in
237     TSS_UUID*           pUuidData,                     // in
238     UINT32*             pulKeyHierarchySize,           // out
239     TSS_KM_KEYINFO**    ppKeyHierarchy                 // out
240 );
241 
242 TSPICALL Tspi_Context_GetRegisteredKeysByUUID2
243 (
244     TSS_HCONTEXT        hContext,                      // in
245     TSS_FLAG            persistentStorageType,         // in
246     TSS_UUID*           pUuidData,                     // in
247     UINT32*             pulKeyHierarchySize,           // out
248     TSS_KM_KEYINFO2**   ppKeyHierarchy                 // out
249 );
250 
251 
252 // Policy class definitions
253 TSPICALL Tspi_Policy_SetSecret
254 (
255     TSS_HPOLICY         hPolicy,                       // in
256     TSS_FLAG            secretMode,                    // in
257     UINT32              ulSecretLength,                // in
258     BYTE*               rgbSecret                      // in
259 );
260 
261 TSPICALL Tspi_Policy_FlushSecret
262 (
263     TSS_HPOLICY         hPolicy                        // in
264 );
265 
266 TSPICALL Tspi_Policy_AssignToObject
267 (
268     TSS_HPOLICY         hPolicy,                       // in
269     TSS_HOBJECT         hObject                        // in
270 );
271 
272 
273 
274 // TPM Class Definitions
275 TSPICALL Tspi_TPM_KeyControlOwner
276 (
277     TSS_HTPM            hTPM,                          // in
278     TSS_HKEY            hKey,                          // in
279     UINT32              attribName,                    // in
280     TSS_BOOL            attribValue,                   // in
281     TSS_UUID*           pUuidData                      // out
282 );
283 
284 TSPICALL Tspi_TPM_CreateEndorsementKey
285 (
286     TSS_HTPM            hTPM,                          // in
287     TSS_HKEY            hKey,                          // in
288     TSS_VALIDATION*     pValidationData                // in, out
289 );
290 
291 TSPICALL Tspi_TPM_CreateRevocableEndorsementKey
292 (
293     TSS_HTPM            hTPM,                          // in
294     TSS_HKEY            hKey,                          // in
295     TSS_VALIDATION*     pValidationData,               // in, out
296     UINT32*             pulEkResetDataLength,          // in, out
297     BYTE**              rgbEkResetData                 // in, out
298 );
299 
300 TSPICALL Tspi_TPM_RevokeEndorsementKey
301 (
302     TSS_HTPM            hTPM,                          // in
303     UINT32              ulEkResetDataLength,           // in
304     BYTE*               rgbEkResetData                 // in
305 );
306 
307 TSPICALL Tspi_TPM_GetPubEndorsementKey
308 (
309     TSS_HTPM            hTPM,                          // in
310     TSS_BOOL            fOwnerAuthorized,              // in
311     TSS_VALIDATION*     pValidationData,               // in, out
312     TSS_HKEY*           phEndorsementPubKey            // out
313 );
314 
315 TSPICALL Tspi_TPM_OwnerGetSRKPubKey
316 (
317     TSS_HTPM            hTPM,                          // in
318     UINT32*             pulPubKeyLength,               // out
319     BYTE**              prgbPubKey                     // out
320 );
321 
322 TSPICALL Tspi_TPM_TakeOwnership
323 (
324     TSS_HTPM            hTPM,                          // in
325     TSS_HKEY            hKeySRK,                       // in
326     TSS_HKEY            hEndorsementPubKey             // in
327 );
328 
329 TSPICALL Tspi_TPM_ClearOwner
330 (
331     TSS_HTPM            hTPM,                          // in
332     TSS_BOOL            fForcedClear                   // in
333 );
334 
335 TSPICALL Tspi_TPM_CollateIdentityRequest
336 (
337     TSS_HTPM            hTPM,                          // in
338     TSS_HKEY            hKeySRK,                       // in
339     TSS_HKEY            hCAPubKey,                     // in
340     UINT32              ulIdentityLabelLength,         // in
341     BYTE*               rgbIdentityLabelData,          // in
342     TSS_HKEY            hIdentityKey,                  // in
343     TSS_ALGORITHM_ID    algID,                         // in
344     UINT32*             pulTCPAIdentityReqLength,      // out
345     BYTE**              prgbTCPAIdentityReq            // out
346 );
347 
348 TSPICALL Tspi_TPM_ActivateIdentity
349 (
350     TSS_HTPM            hTPM,                          // in
351     TSS_HKEY            hIdentKey,                     // in
352     UINT32              ulAsymCAContentsBlobLength,    // in
353     BYTE*               rgbAsymCAContentsBlob,         // in
354     UINT32              ulSymCAAttestationBlobLength,  // in
355     BYTE*               rgbSymCAAttestationBlob,       // in
356     UINT32*             pulCredentialLength,           // out
357     BYTE**              prgbCredential                 // out
358 );
359 
360 TSPICALL Tspi_TPM_CreateMaintenanceArchive
361 (
362     TSS_HTPM            hTPM,                          // in
363     TSS_BOOL            fGenerateRndNumber,            // in
364     UINT32*             pulRndNumberLength,            // out
365     BYTE**              prgbRndNumber,                 // out
366     UINT32*             pulArchiveDataLength,          // out
367     BYTE**              prgbArchiveData                // out
368 );
369 
370 TSPICALL Tspi_TPM_KillMaintenanceFeature
371 (
372     TSS_HTPM            hTPM                           // in
373 );
374 
375 TSPICALL Tspi_TPM_LoadMaintenancePubKey
376 (
377     TSS_HTPM            hTPM,                          // in
378     TSS_HKEY            hMaintenanceKey,               // in
379     TSS_VALIDATION*     pValidationData                // in, out
380 );
381 
382 TSPICALL Tspi_TPM_CheckMaintenancePubKey
383 (
384     TSS_HTPM            hTPM,                          // in
385     TSS_HKEY            hMaintenanceKey,               // in
386     TSS_VALIDATION*     pValidationData                // in, out
387 );
388 
389 TSPICALL Tspi_TPM_SetOperatorAuth
390 (
391     TSS_HTPM            hTPM,                          // in
392     TSS_HPOLICY         hOperatorPolicy                // in
393 );
394 
395 TSPICALL Tspi_TPM_SetStatus
396 (
397     TSS_HTPM            hTPM,                          // in
398     TSS_FLAG            statusFlag,                    // in
399     TSS_BOOL            fTpmState                      // in
400 );
401 
402 TSPICALL Tspi_TPM_GetStatus
403 (
404     TSS_HTPM            hTPM,                          // in
405     TSS_FLAG            statusFlag,                    // in
406     TSS_BOOL*           pfTpmState                     // out
407 );
408 
409 TSPICALL Tspi_TPM_GetCapability
410 (
411     TSS_HTPM            hTPM,                          // in
412     TSS_FLAG            capArea,                       // in
413     UINT32              ulSubCapLength,                // in
414     BYTE*               rgbSubCap,                     // in
415     UINT32*             pulRespDataLength,             // out
416     BYTE**              prgbRespData                   // out
417 );
418 
419 TSPICALL Tspi_TPM_GetCapabilitySigned
420 (
421     TSS_HTPM            hTPM,                          // in
422     TSS_HKEY            hKey,                          // in
423     TSS_FLAG            capArea,                       // in
424     UINT32              ulSubCapLength,                // in
425     BYTE*               rgbSubCap,                     // in
426     TSS_VALIDATION*     pValidationData,               // in, out
427     UINT32*             pulRespDataLength,             // out
428     BYTE**              prgbRespData                   // out
429 );
430 
431 TSPICALL Tspi_TPM_SelfTestFull
432 (
433     TSS_HTPM            hTPM                           // in
434 );
435 
436 TSPICALL Tspi_TPM_CertifySelfTest
437 (
438     TSS_HTPM            hTPM,                          // in
439     TSS_HKEY            hKey,                          // in
440     TSS_VALIDATION*     pValidationData                // in, out
441 );
442 
443 TSPICALL Tspi_TPM_GetTestResult
444 (
445     TSS_HTPM            hTPM,                          // in
446     UINT32*             pulTestResultLength,           // out
447     BYTE**              prgbTestResult                 // out
448 );
449 
450 TSPICALL Tspi_TPM_GetRandom
451 (
452     TSS_HTPM            hTPM,                          // in
453     UINT32              ulRandomDataLength,            // in
454     BYTE**              prgbRandomData                 // out
455 );
456 
457 TSPICALL Tspi_TPM_StirRandom
458 (
459     TSS_HTPM            hTPM,                          // in
460     UINT32              ulEntropyDataLength,           // in
461     BYTE*               rgbEntropyData                 // in
462 );
463 
464 TSPICALL Tspi_TPM_GetEvent
465 (
466     TSS_HTPM            hTPM,                          // in
467     UINT32              ulPcrIndex,                    // in
468     UINT32              ulEventNumber,                 // in
469     TSS_PCR_EVENT*      pPcrEvent                      // out
470 );
471 
472 TSPICALL Tspi_TPM_GetEvents
473 (
474     TSS_HTPM            hTPM,                          // in
475     UINT32              ulPcrIndex,                    // in
476     UINT32              ulStartNumber,                 // in
477     UINT32*             pulEventNumber,                // in, out
478     TSS_PCR_EVENT**     prgPcrEvents                   // out
479 );
480 
481 TSPICALL Tspi_TPM_GetEventLog
482 (
483     TSS_HTPM            hTPM,                          // in
484     UINT32*             pulEventNumber,                // out
485     TSS_PCR_EVENT**     prgPcrEvents                   // out
486 );
487 
488 TSPICALL Tspi_TPM_Quote
489 (
490     TSS_HTPM            hTPM,                          // in
491     TSS_HKEY            hIdentKey,                     // in
492     TSS_HPCRS           hPcrComposite,                 // in
493     TSS_VALIDATION*     pValidationData                // in, out
494 );
495 
496 TSPICALL Tspi_TPM_Quote2
497 (
498     TSS_HTPM            hTPM,                          // in
499     TSS_HKEY            hIdentKey,                     // in
500     TSS_BOOL            fAddVersion,                   // in
501     TSS_HPCRS           hPcrComposite,                 // in
502     TSS_VALIDATION*     pValidationData,               // in, out
503     UINT32*             versionInfoSize,               // out
504     BYTE**              versionInfo                    // out
505 );
506 
507 TSPICALL Tspi_TPM_PcrExtend
508 (
509     TSS_HTPM            hTPM,                          // in
510     UINT32              ulPcrIndex,                    // in
511     UINT32              ulPcrDataLength,               // in
512     BYTE*               pbPcrData,                     // in
513     TSS_PCR_EVENT*      pPcrEvent,                     // in
514     UINT32*             pulPcrValueLength,             // out
515     BYTE**              prgbPcrValue                   // out
516 );
517 
518 TSPICALL Tspi_TPM_PcrRead
519 (
520     TSS_HTPM            hTPM,                          // in
521     UINT32              ulPcrIndex,                    // in
522     UINT32*             pulPcrValueLength,             // out
523     BYTE**              prgbPcrValue                   // out
524 );
525 
526 TSPICALL Tspi_TPM_PcrReset
527 (
528     TSS_HTPM            hTPM,                          // in
529     TSS_HPCRS           hPcrComposite                  // in
530 );
531 
532 TSPICALL Tspi_TPM_AuthorizeMigrationTicket
533 (
534     TSS_HTPM            hTPM,                          // in
535     TSS_HKEY            hMigrationKey,                 // in
536     TSS_MIGRATE_SCHEME  migrationScheme,               // in
537     UINT32*             pulMigTicketLength,            // out
538     BYTE**              prgbMigTicket                  // out
539 );
540 
541 TSPICALL Tspi_TPM_CMKSetRestrictions
542 (
543     TSS_HTPM            hTPM,                          // in
544     TSS_CMK_DELEGATE    CmkDelegate                    // in
545 );
546 
547 TSPICALL Tspi_TPM_CMKApproveMA
548 (
549     TSS_HTPM            hTPM,                          // in
550     TSS_HMIGDATA        hMaAuthData                    // in
551 );
552 
553 TSPICALL Tspi_TPM_CMKCreateTicket
554 (
555     TSS_HTPM            hTPM,                          // in
556     TSS_HKEY            hVerifyKey,                    // in
557     TSS_HMIGDATA        hSigData                       // in
558 );
559 
560 TSPICALL Tspi_TPM_ReadCounter
561 (
562     TSS_HTPM            hTPM,                          // in
563     UINT32*             counterValue                   // out
564 );
565 
566 TSPICALL Tspi_TPM_ReadCurrentTicks
567 (
568     TSS_HTPM            hTPM,                          // in
569     TPM_CURRENT_TICKS*  tickCount                      // out
570 );
571 
572 TSPICALL Tspi_TPM_DirWrite
573 (
574     TSS_HTPM            hTPM,                          // in
575     UINT32              ulDirIndex,                    // in
576     UINT32              ulDirDataLength,               // in
577     BYTE*               rgbDirData                     // in
578 );
579 
580 TSPICALL Tspi_TPM_DirRead
581 (
582     TSS_HTPM            hTPM,                          // in
583     UINT32              ulDirIndex,                    // in
584     UINT32*             pulDirDataLength,              // out
585     BYTE**              prgbDirData                    // out
586 );
587 
588 TSPICALL Tspi_TPM_Delegate_AddFamily
589 (
590     TSS_HTPM            hTPM,                          // in, must not be NULL
591     BYTE                bLabel,                        // in
592     TSS_HDELFAMILY*     phFamily                       // out
593 );
594 
595 TSPICALL Tspi_TPM_Delegate_GetFamily
596 (
597     TSS_HTPM            hTPM,                          // in, must not NULL
598     UINT32              ulFamilyID,                    // in
599     TSS_HDELFAMILY*     phFamily                       // out
600 );
601 
602 TSPICALL Tspi_TPM_Delegate_InvalidateFamily
603 (
604     TSS_HTPM            hTPM,                          // in, must not be NULL
605     TSS_HDELFAMILY      hFamily                        // in
606 );
607 
608 TSPICALL Tspi_TPM_Delegate_CreateDelegation
609 (
610     TSS_HOBJECT         hObject,                       // in
611     BYTE                bLabel,                        // in
612     UINT32              ulFlags,                       // in
613     TSS_HPCRS           hPcr,                          // in, may be NULL
614     TSS_HDELFAMILY      hFamily,                       // in
615     TSS_HPOLICY         hDelegation                    // in, out
616 );
617 
618 TSPICALL Tspi_TPM_Delegate_CacheOwnerDelegation
619 (
620     TSS_HTPM            hTPM,                          // in, must not be NULL
621     TSS_HPOLICY         hDelegation,                   // in, out
622     UINT32              ulIndex,                       // in
623     UINT32              ulFlags                        // in
624 );
625 
626 TSPICALL Tspi_TPM_Delegate_UpdateVerificationCount
627 (
628     TSS_HTPM            hTPM,                          // in
629     TSS_HPOLICY         hDelegation                    // in, out
630 );
631 
632 TSPICALL Tspi_TPM_Delegate_VerifyDelegation
633 (
634     TSS_HPOLICY         hDelegation                    // in, out
635 );
636 
637 TSPICALL Tspi_TPM_Delegate_ReadTables
638 (
639     TSS_HCONTEXT                  hContext,                      // in
640     UINT32*                       pulFamilyTableSize,            // out
641     TSS_FAMILY_TABLE_ENTRY**      ppFamilyTable,                 // out
642     UINT32*                       pulDelegateTableSize,          // out
643     TSS_DELEGATION_TABLE_ENTRY**  ppDelegateTable                // out
644 );
645 
646 TSPICALL Tspi_TPM_DAA_JoinInit
647 (
648     TSS_HTPM                      hTPM,                          // in
649     TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
650     UINT32                        daaCounter,                    // in
651     UINT32                        issuerAuthPKsLength,           // in
652     TSS_HKEY*                     issuerAuthPKs,                 // in
653     UINT32                        issuerAuthPKSignaturesLength,  // in
654     UINT32                        issuerAuthPKSignaturesLength2, // in
655     BYTE**                        issuerAuthPKSignatures,        // in
656     UINT32*                       capitalUprimeLength,           // out
657     BYTE**                        capitalUprime,                 // out
658     TSS_DAA_IDENTITY_PROOF**      identityProof,                 // out
659     UINT32*                       joinSessionLength,             // out
660     BYTE**                        joinSession                    // out
661 );
662 
663 TSPICALL Tspi_TPM_DAA_JoinCreateDaaPubKey
664 (
665     TSS_HTPM                      hTPM,                          // in
666     TSS_HDAA_CREDENTIAL           hDAACredential,                // in
667     UINT32                        authenticationChallengeLength, // in
668     BYTE*                         authenticationChallenge,       // in
669     UINT32                        nonceIssuerLength,             // in
670     BYTE*                         nonceIssuer,                   // in
671     UINT32                        attributesPlatformLength,      // in
672     UINT32                        attributesPlatformLength2,     // in
673     BYTE**                        attributesPlatform,            // in
674     UINT32                        joinSessionLength,             // in
675     BYTE*                         joinSession,                   // in
676     TSS_DAA_CREDENTIAL_REQUEST**  credentialRequest              // out
677 );
678 
679 TSPICALL Tspi_TPM_DAA_JoinStoreCredential
680 (
681     TSS_HTPM                      hTPM,                          // in
682     TSS_HDAA_CREDENTIAL           hDAACredential,                // in
683     TSS_DAA_CRED_ISSUER*          credIssuer,                    // in
684     UINT32                        joinSessionLength,             // in
685     BYTE*                         joinSession                    // in
686 );
687 
688 TSPICALL Tspi_TPM_DAA_Sign
689 (
690     TSS_HTPM                      hTPM,                          // in
691     TSS_HDAA_CREDENTIAL           hDAACredential,                // in
692     TSS_HDAA_ARA_KEY              hARAKey,                       // in
693     TSS_DAA_SELECTED_ATTRIB*      revealAttributes,              // in
694     UINT32                        verifierNonceLength,           // in
695     BYTE*                         verifierNonce,                 // in
696     UINT32                        verifierBaseNameLength,        // in
697     BYTE*                         verifierBaseName,              // in
698     TSS_HOBJECT                   signData,                      // in
699     TSS_DAA_SIGNATURE**           daaSignature                   // out
700 );
701 
702 TSPICALL Tspi_TPM_GetAuditDigest
703 (
704     TSS_HTPM            hTPM,                          // in
705     TSS_HKEY            hKey,                          // in
706     TSS_BOOL            closeAudit,                    // in
707     UINT32*             pulAuditDigestSize,            // out
708     BYTE**              prgbAuditDigest,               // out
709     TPM_COUNTER_VALUE*  pCounterValue,                 // out
710     TSS_VALIDATION*     pValidationData,               // out
711     UINT32*             ordSize,                       // out
712     UINT32**            ordList                        // out
713 );
714 
715 
716 
717 // PcrComposite Class Definitions
718 TSPICALL Tspi_PcrComposite_SelectPcrIndex
719 (
720     TSS_HPCRS           hPcrComposite,                 // in
721     UINT32              ulPcrIndex                     // in
722 );
723 
724 TSPICALL Tspi_PcrComposite_SelectPcrIndexEx
725 (
726     TSS_HPCRS           hPcrComposite,                 // in
727     UINT32              ulPcrIndex,                    // in
728     UINT32              direction                      // in
729 );
730 
731 TSPICALL Tspi_PcrComposite_SetPcrValue
732 (
733     TSS_HPCRS           hPcrComposite,                 // in
734     UINT32              ulPcrIndex,                    // in
735     UINT32              ulPcrValueLength,              // in
736     BYTE*               rgbPcrValue                    // in
737 );
738 
739 TSPICALL Tspi_PcrComposite_GetPcrValue
740 (
741     TSS_HPCRS           hPcrComposite,                 // in
742     UINT32              ulPcrIndex,                    // in
743     UINT32*             pulPcrValueLength,             // out
744     BYTE**              prgbPcrValue                   // out
745 );
746 
747 TSPICALL Tspi_PcrComposite_SetPcrLocality
748 (
749     TSS_HPCRS           hPcrComposite,                 // in
750     UINT32              LocalityValue                  // in
751 );
752 
753 TSPICALL Tspi_PcrComposite_GetPcrLocality
754 (
755     TSS_HPCRS           hPcrComposite,                 // in
756     UINT32*             pLocalityValue                 // out
757 );
758 
759 TSPICALL Tspi_PcrComposite_GetCompositeHash
760 (
761     TSS_HPCRS           hPcrComposite,                 // in
762     UINT32*             pLen,                          // in
763     BYTE**              ppbHashData                    // out
764 );
765 
766 
767 
768 // Key Class Definition
769 TSPICALL Tspi_Key_LoadKey
770 (
771     TSS_HKEY            hKey,                          // in
772     TSS_HKEY            hUnwrappingKey                 // in
773 );
774 
775 TSPICALL Tspi_Key_UnloadKey
776 (
777     TSS_HKEY            hKey                           // in
778 );
779 
780 TSPICALL Tspi_Key_GetPubKey
781 (
782     TSS_HKEY            hKey,                          // in
783     UINT32*             pulPubKeyLength,               // out
784     BYTE**              prgbPubKey                     // out
785 );
786 
787 TSPICALL Tspi_Key_CertifyKey
788 (
789     TSS_HKEY            hKey,                          // in
790     TSS_HKEY            hCertifyingKey,                // in
791     TSS_VALIDATION*     pValidationData                // in, out
792 );
793 
794 TSPICALL Tspi_Key_CreateKey
795 (
796     TSS_HKEY            hKey,                          // in
797     TSS_HKEY            hWrappingKey,                  // in
798     TSS_HPCRS           hPcrComposite                  // in, may be NULL
799 );
800 
801 TSPICALL Tspi_Key_WrapKey
802 (
803     TSS_HKEY            hKey,                          // in
804     TSS_HKEY            hWrappingKey,                  // in
805     TSS_HPCRS           hPcrComposite                  // in, may be NULL
806 );
807 
808 TSPICALL Tspi_Key_CreateMigrationBlob
809 (
810     TSS_HKEY            hKeyToMigrate,                 // in
811     TSS_HKEY            hParentKey,                    // in
812     UINT32              ulMigTicketLength,             // in
813     BYTE*               rgbMigTicket,                  // in
814     UINT32*             pulRandomLength,               // out
815     BYTE**              prgbRandom,                    // out
816     UINT32*             pulMigrationBlobLength,        // out
817     BYTE**              prgbMigrationBlob              // out
818 );
819 
820 TSPICALL Tspi_Key_ConvertMigrationBlob
821 (
822     TSS_HKEY            hKeyToMigrate,                 // in
823     TSS_HKEY            hParentKey,                    // in
824     UINT32              ulRandomLength,                // in
825     BYTE*               rgbRandom,                     // in
826     UINT32              ulMigrationBlobLength,         // in
827     BYTE*               rgbMigrationBlob               // in
828 );
829 
830 TSPICALL Tspi_Key_MigrateKey
831 (
832     TSS_HKEY            hMaKey,                        // in
833     TSS_HKEY            hPublicKey,                    // in
834     TSS_HKEY            hMigData                       // in
835 );
836 
837 TSPICALL Tspi_Key_CMKCreateBlob
838 (
839     TSS_HKEY            hKeyToMigrate,                 // in
840     TSS_HKEY            hParentKey,                    // in
841     TSS_HMIGDATA        hMigrationData,                // in
842     UINT32*             pulRandomLength,               // out
843     BYTE**              prgbRandom                     // out
844 );
845 
846 TSPICALL Tspi_Key_CMKConvertMigration
847 (
848     TSS_HKEY            hKeyToMigrate,                 // in
849     TSS_HKEY            hParentKey,                    // in
850     TSS_HMIGDATA        hMigrationData,                // in
851     UINT32              ulRandomLength,                // in
852     BYTE*               rgbRandom                      // in
853 );
854 
855 
856 
857 // Hash Class Definition
858 TSPICALL Tspi_Hash_Sign
859 (
860     TSS_HHASH           hHash,                         // in
861     TSS_HKEY            hKey,                          // in
862     UINT32*             pulSignatureLength,            // out
863     BYTE**              prgbSignature                  // out
864 );
865 
866 TSPICALL Tspi_Hash_VerifySignature
867 (
868     TSS_HHASH           hHash,                         // in
869     TSS_HKEY            hKey,                          // in
870     UINT32              ulSignatureLength,             // in
871     BYTE*               rgbSignature                   // in
872 );
873 
874 TSPICALL Tspi_Hash_SetHashValue
875 (
876     TSS_HHASH           hHash,                         // in
877     UINT32              ulHashValueLength,             // in
878     BYTE*               rgbHashValue                   // in
879 );
880 
881 TSPICALL Tspi_Hash_GetHashValue
882 (
883     TSS_HHASH           hHash,                         // in
884     UINT32*             pulHashValueLength,            // out
885     BYTE**              prgbHashValue                  // out
886 );
887 
888 TSPICALL Tspi_Hash_UpdateHashValue
889 (
890     TSS_HHASH           hHash,                         // in
891     UINT32              ulDataLength,                  // in
892     BYTE*               rgbData                        // in
893 );
894 
895 TSPICALL Tspi_Hash_TickStampBlob
896 (
897     TSS_HHASH           hHash,                         // in
898     TSS_HKEY            hIdentKey,                     // in
899     TSS_VALIDATION*     pValidationData                // in
900 );
901 
902 
903 
904 // EncData Class Definition
905 TSPICALL Tspi_Data_Bind
906 (
907     TSS_HENCDATA        hEncData,                      // in
908     TSS_HKEY            hEncKey,                       // in
909     UINT32              ulDataLength,                  // in
910     BYTE*               rgbDataToBind                  // in
911 );
912 
913 TSPICALL Tspi_Data_Unbind
914 (
915     TSS_HENCDATA        hEncData,                      // in
916     TSS_HKEY            hKey,                          // in
917     UINT32*             pulUnboundDataLength,          // out
918     BYTE**              prgbUnboundData                // out
919 );
920 
921 TSPICALL Tspi_Data_Seal
922 (
923     TSS_HENCDATA        hEncData,                      // in
924     TSS_HKEY            hEncKey,                       // in
925     UINT32              ulDataLength,                  // in
926     BYTE*               rgbDataToSeal,                 // in
927     TSS_HPCRS           hPcrComposite                  // in
928 );
929 
930 TSPICALL Tspi_Data_Unseal
931 (
932     TSS_HENCDATA        hEncData,                      // in
933     TSS_HKEY            hKey,                          // in
934     UINT32*             pulUnsealedDataLength,         // out
935     BYTE**              prgbUnsealedData               // out
936 );
937 
938 
939 
940 // NV Class Definition
941 TSPICALL Tspi_NV_DefineSpace
942 (
943     TSS_HNVSTORE        hNVStore,                      // in
944     TSS_HPCRS           hReadPcrComposite,             // in, may be NULL
945     TSS_HPCRS           hWritePcrComposite             // in, may be NULL
946 );
947 
948 TSPICALL Tspi_NV_ReleaseSpace
949 (
950     TSS_HNVSTORE        hNVStore                       // in
951 );
952 
953 TSPICALL Tspi_NV_WriteValue
954 (
955     TSS_HNVSTORE        hNVStore,                      // in
956     UINT32              offset,                        // in
957     UINT32              ulDataLength,                  // in
958     BYTE*               rgbDataToWrite                 // in
959 );
960 
961 TSPICALL Tspi_NV_ReadValue
962 (
963     TSS_HNVSTORE        hNVStore,                      // in
964     UINT32              offset,                        // in
965     UINT32*             ulDataLength,                  // in, out
966     BYTE**              rgbDataRead                    // out
967 );
968 
969 
970 // DAA Utility functions (optional, do not require a TPM or TCS)
971 TSPICALL Tspi_DAA_IssuerKeyVerify
972 (
973     TSS_HDAA_CREDENTIAL           hDAACredential,                // in
974     TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
975     TSS_BOOL*                     isCorrect                      // out
976 );
977 
978 TSPICALL Tspi_DAA_Issuer_GenerateKey
979 (
980     TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
981     UINT32                        issuerBaseNameLength,          // in
982     BYTE*                         issuerBaseName                 // in
983 );
984 
985 TSPICALL Tspi_DAA_Issuer_InitCredential
986 (
987     TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
988     TSS_HKEY                      issuerAuthPK,                  // in
989     TSS_DAA_IDENTITY_PROOF*       identityProof,                 // in
990     UINT32                        capitalUprimeLength,           // in
991     BYTE*                         capitalUprime,                 // in
992     UINT32                        daaCounter,                    // in
993     UINT32*                       nonceIssuerLength,             // out
994     BYTE**                        nonceIssuer,                   // out
995     UINT32*                       authenticationChallengeLength, // out
996     BYTE**                        authenticationChallenge,       // out
997     UINT32*                       joinSessionLength,             // out
998     BYTE**                        joinSession                    // out
999 );
1000 
1001 TSPICALL Tspi_DAA_Issuer_IssueCredential
1002 (
1003     TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
1004     TSS_DAA_CREDENTIAL_REQUEST*   credentialRequest,             // in
1005     UINT32                        issuerJoinSessionLength,       // in
1006     BYTE*                         issuerJoinSession,             // in
1007     TSS_DAA_CRED_ISSUER**         credIssuer                     // out
1008 );
1009 
1010 TSPICALL Tspi_DAA_Verifier_Init
1011 (
1012     TSS_HDAA_CREDENTIAL           hDAACredential,                // in
1013     UINT32*                       nonceVerifierLength,           // out
1014     BYTE**                        nonceVerifier,                 // out
1015     UINT32*                       baseNameLength,                // out
1016     BYTE**                        baseName                       // out
1017 );
1018 
1019 TSPICALL Tspi_DAA_VerifySignature
1020 (
1021     TSS_HDAA_CREDENTIAL           hDAACredential,                // in
1022     TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
1023     TSS_HDAA_ARA_KEY              hARAKey,                       // in
1024     TSS_HHASH                     hARACondition,                 // in
1025     UINT32                        attributesLength,              // in
1026     UINT32                        attributesLength2,             // in
1027     BYTE**                        attributes,                    // in
1028     UINT32                        verifierNonceLength,           // in
1029     BYTE*                         verifierNonce,                 // in
1030     UINT32                        verifierBaseNameLength,        // in
1031     BYTE*                         verifierBaseName,              // in
1032     TSS_HOBJECT                   signData,                      // in
1033     TSS_DAA_SIGNATURE*            daaSignature,                  // in
1034     TSS_BOOL*                     isCorrect                      // out
1035 );
1036 
1037 TSPICALL Tspi_DAA_ARA_GenerateKey
1038 (
1039     TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
1040     TSS_HDAA_ARA_KEY              hARAKey                        // in
1041 );
1042 
1043 TSPICALL Tspi_DAA_ARA_RevokeAnonymity
1044 (
1045     TSS_HDAA_ARA_KEY              hARAKey,                       // in
1046     TSS_HHASH                     hARACondition,                 // in
1047     TSS_HDAA_ISSUER_KEY           hIssuerKey,                    // in
1048     TSS_DAA_PSEUDONYM_ENCRYPTED*  encryptedPseudonym,            // in
1049     TSS_DAA_PSEUDONYM_PLAIN**     pseudonym                      // out
1050 );
1051 
1052 
1053 
1054 // Callback typedefs
1055 typedef TSS_RESULT (*Tspicb_CallbackHMACAuth)
1056 (
1057     PVOID            lpAppData,          // in
1058     TSS_HOBJECT      hAuthorizedObject,  // in
1059     TSS_BOOL         ReturnOrVerify,     // in
1060     UINT32           ulPendingFunction,  // in
1061     TSS_BOOL         ContinueUse,        // in
1062     UINT32           ulSizeNonces,       // in
1063     BYTE*            rgbNonceEven,       // in
1064     BYTE*            rgbNonceOdd,        // in
1065     BYTE*            rgbNonceEvenOSAP,   // in
1066     BYTE*            rgbNonceOddOSAP,    // in
1067     UINT32           ulSizeDigestHmac,   // in
1068     BYTE*            rgbParamDigest,     // in
1069     BYTE*            rgbHmacData         // in, out
1070 );
1071 
1072 typedef TSS_RESULT (*Tspicb_CallbackXorEnc)
1073 (
1074    PVOID            lpAppData,            // in
1075    TSS_HOBJECT      hOSAPObject,          // in
1076    TSS_HOBJECT      hObject,              // in
1077    TSS_FLAG         PurposeSecret,        // in
1078    UINT32           ulSizeNonces,         // in
1079    BYTE*            rgbNonceEven,         // in
1080    BYTE*            rgbNonceOdd,          // in
1081    BYTE*            rgbNonceEvenOSAP,     // in
1082    BYTE*            rgbNonceOddOSAP,      // in
1083    UINT32           ulSizeEncAuth,        // in
1084    BYTE*            rgbEncAuthUsage,      // out
1085    BYTE*            rgbEncAuthMigration   // out
1086 );
1087 
1088 typedef TSS_RESULT (*Tspicb_CallbackTakeOwnership)
1089 (
1090    PVOID            lpAppData,         // in
1091    TSS_HOBJECT      hObject,           // in
1092    TSS_HKEY         hObjectPubKey,     // in
1093    UINT32           ulSizeEncAuth,     // in
1094    BYTE*            rgbEncAuth         // out
1095 );
1096 
1097 typedef TSS_RESULT (*Tspicb_CallbackSealxMask)
1098 (
1099     PVOID            lpAppData,        // in
1100     TSS_HKEY         hKey,             // in
1101     TSS_HENCDATA     hEncData,         // in
1102     TSS_ALGORITHM_ID algID,            // in
1103     UINT32           ulSizeNonces,     // in
1104     BYTE*            rgbNonceEven,     // in
1105     BYTE*            rgbNonceOdd,      // in
1106     BYTE*            rgbNonceEvenOSAP, // in
1107     BYTE*            rgbNonceOddOSAP,  // in
1108     UINT32           ulDataLength,     // in
1109     BYTE*            rgbDataToMask,    // in
1110     BYTE*            rgbMaskedData     // out
1111 );
1112 
1113 typedef TSS_RESULT (*Tspicb_CallbackChangeAuthAsym)
1114 (
1115    PVOID            lpAppData,        // in
1116    TSS_HOBJECT      hObject,          // in
1117    TSS_HKEY         hObjectPubKey,    // in
1118    UINT32           ulSizeEncAuth,    // in
1119    UINT32           ulSizeAuthLink,   // in
1120    BYTE*            rgbEncAuth,       // out
1121    BYTE*            rgbAuthLink       // out
1122 );
1123 
1124 typedef TSS_RESULT (*Tspicb_CollateIdentity)
1125 (
1126    PVOID            lpAppData,                      // in
1127    UINT32           ulTCPAPlainIdentityProofLength, // in
1128    BYTE*            rgbTCPAPlainIdentityProof,      // in
1129    TSS_ALGORITHM_ID algID,                          // in
1130    UINT32           ulSessionKeyLength,             // out
1131    BYTE*            rgbSessionKey,                  // out
1132    UINT32*          pulTCPAIdentityProofLength,     // out
1133    BYTE*            rgbTCPAIdentityProof            // out
1134 );
1135 
1136 
1137 typedef TSS_RESULT (*Tspicb_ActivateIdentity)
1138 (
1139    PVOID            lpAppData,                    // in
1140    UINT32           ulSessionKeyLength,           // in
1141    BYTE*            rgbSessionKey,                // in
1142    UINT32           ulSymCAAttestationBlobLength, // in
1143    BYTE*            rgbSymCAAttestationBlob,      // in
1144    UINT32*          pulCredentialLength,          // out
1145    BYTE*            rgbCredential                 // out
1146 );
1147 
1148 
1149 typedef TSS_RESULT (*Tspicb_DAA_Sign)
1150 (
1151     PVOID                        lpAppData,                 // in
1152     TSS_HDAA_ISSUER_KEY          daaPublicKey,              // in
1153     UINT32                       gammasLength,              // in
1154     BYTE**                       gammas,                    // in
1155     UINT32                       attributesLength,          // in
1156     BYTE**                       attributes,                // in
1157     UINT32                       randomAttributesLength,    // in
1158     BYTE**                       randomAttributes,          // in
1159     UINT32                       attributeCommitmentsLength,// in
1160     TSS_DAA_ATTRIB_COMMIT*       attributeCommitments,      // in
1161     TSS_DAA_ATTRIB_COMMIT*       attributeCommitmentsProof, // in
1162     TSS_DAA_PSEUDONYM_PLAIN*     pseudonym,                 // in
1163     TSS_DAA_PSEUDONYM_PLAIN*     pseudonymTilde,            // in
1164     TSS_DAA_PSEUDONYM_ENCRYPTED* pseudonymEncrypted,        // in
1165     TSS_DAA_PSEUDONYM_ENCRYPTED* pseudonymEncProof,         // in
1166     TSS_DAA_SIGN_CALLBACK**      additionalProof            // out
1167 );
1168 
1169 typedef TSS_RESULT (*Tspicb_DAA_VerifySignature)
1170 (
1171     PVOID                        lpAppData,                 // in
1172     UINT32                       challengeLength,           // in
1173     BYTE*                        challenge,                 // in
1174     TSS_DAA_SIGN_CALLBACK*       additionalProof,           // in
1175     TSS_HDAA_ISSUER_KEY          daaPublicKey,              // in
1176     UINT32                       gammasLength,              // in
1177     BYTE**                       gammas,                    // in
1178     UINT32                       sAttributesLength,         // in
1179     BYTE**                       sAttributes,               // in
1180     UINT32                       attributeCommitmentsLength,// in
1181     TSS_DAA_ATTRIB_COMMIT*       attributeCommitments,      // in
1182     TSS_DAA_ATTRIB_COMMIT*       attributeCommitmentsProof, // in
1183     UINT32                       zetaLength,                // in
1184     BYTE*                        zeta,                      // in
1185     UINT32                       sFLength,                  // in
1186     BYTE*                        sF,                        // in
1187     TSS_DAA_PSEUDONYM*           pseudonym,                 // in
1188     TSS_DAA_PSEUDONYM*           pseudonymProof,            // in
1189     TSS_BOOL*                    isCorrect                  // out
1190 );
1191 
1192 
1193 #if defined ( __cplusplus )
1194 }
1195 #endif /* __cplusplus */
1196 
1197 
1198 #endif /* _TSPI_H_ */
1199