1 /*++
2 
3 TSS structures for TSS
4 
5 */
6 
7 #ifndef __TSS_STRUCTS_H__
8 #define __TSS_STRUCTS_H__
9 
10 #include <tss/platform.h>
11 #include <tss/tss_typedef.h>
12 #include <tss/tpm.h>
13 
14 typedef struct tdTSS_VERSION
15 {
16     BYTE   bMajor;
17     BYTE   bMinor;
18     BYTE   bRevMajor;
19     BYTE   bRevMinor;
20 } TSS_VERSION;
21 
22 typedef struct tdTSS_PCR_EVENT
23 {
24     TSS_VERSION   versionInfo;
25     UINT32        ulPcrIndex;
26     TSS_EVENTTYPE eventType;
27     UINT32        ulPcrValueLength;
28 #ifdef __midl
29     [size_is(ulPcrValueLength)]
30 #endif
31     BYTE*         rgbPcrValue;
32     UINT32        ulEventLength;
33 #ifdef __midl
34     [size_is(ulEventLength)]
35 #endif
36     BYTE*         rgbEvent;
37 } TSS_PCR_EVENT;
38 
39 
40 typedef struct tdTSS_EVENT_CERT
41 {
42     TSS_VERSION       versionInfo;
43     UINT32    ulCertificateHashLength;
44 #ifdef __midl
45     [size_is(ulCertificateHashLength)]
46 #endif
47     BYTE*     rgbCertificateHash;
48     UINT32    ulEntityDigestLength;
49 #ifdef __midl
50     [size_is(ulEntityDigestLength)]
51 #endif
52     BYTE*     rgbentityDigest;
53     TSS_BOOL  fDigestChecked;
54     TSS_BOOL  fDigestVerified;
55     UINT32    ulIssuerLength;
56 #ifdef __midl
57     [size_is(ulIssuerLength)]
58 #endif
59     BYTE*     rgbIssuer;
60 } TSS_EVENT_CERT;
61 
62 typedef struct tdTSS_UUID
63 {
64     UINT32  ulTimeLow;
65     UINT16  usTimeMid;
66     UINT16  usTimeHigh;
67     BYTE   bClockSeqHigh;
68     BYTE   bClockSeqLow;
69     BYTE   rgbNode[6];
70 } TSS_UUID;
71 
72 typedef struct tdTSS_KM_KEYINFO
73 {
74     TSS_VERSION  versionInfo;
75     TSS_UUID     keyUUID;
76     TSS_UUID     parentKeyUUID;
77     BYTE         bAuthDataUsage;   // whether auth is needed to load child keys
78     TSS_BOOL     fIsLoaded;           // TRUE: actually loaded in TPM
79     UINT32       ulVendorDataLength;  // may be 0
80 #ifdef __midl
81     [size_is(ulVendorDataLength)]
82 #endif
83     BYTE        *rgbVendorData;       // may be NULL
84 } TSS_KM_KEYINFO;
85 
86 
87 typedef struct tdTSS_KM_KEYINFO2
88 {
89     TSS_VERSION  versionInfo;
90     TSS_UUID     keyUUID;
91     TSS_UUID     parentKeyUUID;
92     BYTE         bAuthDataUsage;   // whether auth is needed to load child keys
93     TSS_FLAG     persistentStorageType;
94     TSS_FLAG     persistentStorageTypeParent;
95     TSS_BOOL     fIsLoaded;           // TRUE: actually loaded in TPM
96     UINT32       ulVendorDataLength;  // may be 0
97 #ifdef __midl
98     [size_is(ulVendorDataLength)]
99 #endif
100     BYTE        *rgbVendorData;       // may be NULL
101 } TSS_KM_KEYINFO2;
102 
103 
104 typedef struct tdTSS_NONCE
105 {
106     BYTE  nonce[TPM_SHA1BASED_NONCE_LEN];
107 } TSS_NONCE;
108 
109 
110 typedef struct tdTSS_VALIDATION
111 {
112     TSS_VERSION  versionInfo;
113     UINT32       ulExternalDataLength;
114 #ifdef __midl
115     [size_is(ulExternalDataLength)]
116 #endif
117     BYTE*        rgbExternalData;
118     UINT32       ulDataLength;
119 #ifdef __midl
120     [size_is(ulDataLength)]
121 #endif
122     BYTE*     rgbData;
123     UINT32    ulValidationDataLength;
124 #ifdef __midl
125     [size_is(ulValidationDataLength)]
126 #endif
127     BYTE*     rgbValidationData;
128 } TSS_VALIDATION;
129 
130 
131 typedef struct tdTSS_CALLBACK
132 {
133     PVOID            callback;
134     PVOID            appData;
135     TSS_ALGORITHM_ID alg;
136 } TSS_CALLBACK;
137 
138 
139 typedef struct tdTSS_DAA_PK
140 {
141     TSS_VERSION versionInfo;
142     UINT32      modulusLength;
143 #ifdef __midl
144     [size_is(modulusLength)]
145 #endif
146     BYTE*       modulus;
147     UINT32      capitalSLength;
148 #ifdef __midl
149     [size_is(capitalSLength)]
150 #endif
151     BYTE*       capitalS;
152     UINT32      capitalZLength;
153 #ifdef __midl
154     [size_is(capitalZLength)]
155 #endif
156     BYTE*       capitalZ;
157     UINT32      capitalR0Length;
158 #ifdef __midl
159     [size_is(capitalR0Length)]
160 #endif
161     BYTE*       capitalR0;
162     UINT32      capitalR1Length;
163 #ifdef __midl
164     [size_is(capitalR1Length)]
165 #endif
166     BYTE*       capitalR1;
167     UINT32      gammaLength;
168 #ifdef __midl
169     [size_is(gammaLength)]
170 #endif
171     BYTE*       gamma;
172     UINT32      capitalGammaLength;
173 #ifdef __midl
174     [size_is(capitalGammaLength)]
175 #endif
176     BYTE*       capitalGamma;
177     UINT32      rhoLength;
178 #ifdef __midl
179     [size_is(rhoLength)]
180 #endif
181     BYTE*       rho;
182     UINT32      capitalYLength;         // Length of first dimenstion
183     UINT32      capitalYLength2;        // Length of second dimension
184 #ifdef __midl
185     [size_is(capitalYLength,capitalYLength2)]
186 #endif
187     BYTE**      capitalY;
188     UINT32      capitalYPlatformLength;
189     UINT32      issuerBaseNameLength;
190 #ifdef __midl
191     [size_is(issuerBaseName)]
192 #endif
193     BYTE*       issuerBaseName;
194     UINT32      numPlatformAttributes;
195     UINT32      numIssuerAttributes;
196 } TSS_DAA_PK;
197 
198 typedef struct tdTSS_DAA_PK_PROOF
199 {
200     TSS_VERSION versionInfo;
201     UINT32      challengeLength;
202 #ifdef __midl
203     [size_is(challengeLength)]
204 #endif
205     BYTE*       challenge;
206     UINT32      responseLength;         // Length of first dimension
207     UINT32      responseLength2;        // Length of second dimension
208 #ifdef __midl
209     [size_is(responseLength,responseLength2)]
210 #endif
211     BYTE**      response;
212 } TSS_DAA_PK_PROOF;
213 
214 typedef struct tdTSS_DAA_SK
215 {
216     TSS_VERSION versionInfo;
217     UINT32      productPQprimeLength;
218 #ifdef __midl
219     [size_is(productPQprimeLength)]
220 #endif
221     BYTE*       productPQprime;
222 } TSS_DAA_SK;
223 
224 
225 typedef struct tdTSS_DAA_KEY_PAIR
226 {
227     TSS_VERSION versionInfo;
228     TSS_DAA_SK  secretKey;
229     TSS_DAA_PK  publicKey;
230 } TSS_DAA_KEY_PAIR;
231 
232 typedef struct tdTSS_DAA_AR_PK
233 {
234     TSS_VERSION versionInfo;
235     UINT32      etaLength;
236 #ifdef __midl
237     [size_is(etaLength)]
238 #endif
239     BYTE*       eta;
240     UINT32      lambda1Length;
241 #ifdef __midl
242     [size_is(lambda1Length)]
243 #endif
244     BYTE*       lambda1;
245     UINT32      lambda2Length;
246 #ifdef __midl
247     [size_is(lambda2Length)]
248 #endif
249     BYTE*       lambda2;
250     UINT32      lambda3Length;
251 #ifdef __midl
252     [size_is(lambda3Length)]
253 #endif
254     BYTE*       lambda3;
255 } TSS_DAA_AR_PK;
256 
257 typedef struct tdTSS_DAA_AR_SK
258 {
259     TSS_VERSION versionInfo;
260     UINT32      x0Length;
261 #ifdef __midl
262     [size_is(x0Length)]
263 #endif
264     BYTE*       x0;
265     UINT32      x1Length;
266 #ifdef __midl
267     [size_is(x1Length)]
268 #endif
269     BYTE*       x1;
270     UINT32      x2Length;
271 #ifdef __midl
272     [size_is(x2Length)]
273 #endif
274     BYTE*       x2;
275     UINT32      x3Length;
276 #ifdef __midl
277     [size_is(x3Length)]
278 #endif
279     BYTE*       x3;
280     UINT32      x4Length;
281 #ifdef __midl
282     [size_is(x4Length)]
283 #endif
284     BYTE*       x4;
285     UINT32      x5Length;
286 #ifdef __midl
287     [size_is(x5Length)]
288 #endif
289     BYTE*       x5;
290 } TSS_DAA_AR_SK;
291 
292 typedef struct tdTSS_DAA_AR_KEY_PAIR
293 {
294     TSS_VERSION   versionInfo;
295     TSS_DAA_AR_SK secretKey;
296     TSS_DAA_AR_PK publicKey;
297 } TSS_DAA_AR_KEY_PAIR;
298 
299 typedef struct tdTSS_DAA_CRED_ISSUER
300 {
301     TSS_VERSION versionInfo;
302     UINT32      capitalALength;
303 #ifdef __midl
304     [size_is(capitalALength)]
305 #endif
306     BYTE*       capitalA;
307     UINT32      eLength;
308 #ifdef __midl
309     [size_is(eLength)]
310 #endif
311     BYTE*       e;
312     UINT32      vPrimePrimeLength;
313 #ifdef __midl
314     [size_is(vPrimePrimeLength)]
315 #endif
316     BYTE*       vPrimePrime;
317     UINT32      attributesIssuerLength;         // Length of first dimension
318     UINT32      attributesIssuerLength2;        // Length of second dimension
319 #ifdef __midl
320     [size_is(attributesIssuerLength,attributesIssuerLength2)]
321 #endif
322     BYTE**      attributesIssuer;
323     UINT32      cPrimeLength;
324 #ifdef __midl
325     [size_is(cPrimeLength)]
326 #endif
327     BYTE*       cPrime;
328     UINT32      sELength;
329 #ifdef __midl
330     [size_is(sELength)]
331 #endif
332     BYTE*       sE;
333 } TSS_DAA_CRED_ISSUER;
334 
335 typedef struct tdTSS_DAA_CREDENTIAL
336 {
337     TSS_VERSION versionInfo;
338     UINT32      capitalALength;
339 #ifdef __midl
340     [size_is(capitalALength)]
341 #endif
342     BYTE*       capitalA;
343     UINT32      exponentLength;
344 #ifdef __midl
345     [size_is(exponentLength)]
346 #endif
347     BYTE*       exponent;
348     UINT32      vBar0Length;
349 #ifdef __midl
350     [size_is(vBar0Length)]
351 #endif
352     BYTE*       vBar0;
353     UINT32      vBar1Length;
354 #ifdef __midl
355     [size_is(vBar1Length)]
356 #endif
357     BYTE*       vBar1;
358     UINT32      attributesLength;       // Length of first dimension
359     UINT32      attributesLength2;      // Length of second dimension
360 #ifdef __midl
361     [size_is(attributesLength,attributesLength2)]
362 #endif
363     BYTE**      attributes;
364     TSS_DAA_PK  issuerPK;
365     UINT32      tpmSpecificEncLength;
366 #ifdef __midl
367     [size_is(tpmSpecificEncLength)]
368 #endif
369     BYTE*       tpmSpecificEnc;
370     UINT32      daaCounter;
371 } TSS_DAA_CREDENTIAL;
372 
373 typedef struct tdTSS_DAA_ATTRIB_COMMIT
374 {
375     TSS_VERSION versionInfo;
376     UINT32      betaLength;
377 #ifdef __midl
378     [size_is(betaLength)]
379 #endif
380     BYTE*       beta;
381     UINT32      sMuLength;
382 #ifdef __midl
383     [size_is(sMuLength)]
384 #endif
385     BYTE*       sMu;
386 } TSS_DAA_ATTRIB_COMMIT;
387 
388 typedef struct tdTSS_DAA_CREDENTIAL_REQUEST
389 {
390     TSS_VERSION versionInfo;
391     UINT32      capitalULength;
392 #ifdef __midl
393     [size_is(capitalULength)]
394 #endif
395     BYTE*       capitalU;
396     UINT32      capitalNiLength;
397 #ifdef __midl
398     [size_is(capitalNiLength)]
399 #endif
400     BYTE*       capitalNi;
401     UINT32      authenticationProofLength;
402 #ifdef __midl
403     [size_is(authenticationProofLength)]
404 #endif
405     BYTE*       authenticationProof;
406     UINT32      challengeLength;
407 #ifdef __midl
408     [size_is(challengeLength)]
409 #endif
410     BYTE*       challenge;
411     UINT32      nonceTpmLength;
412 #ifdef __midl
413     [size_is(nonceTpmLength)]
414 #endif
415     BYTE*       nonceTpm;
416     UINT32      noncePlatformLength;
417 #ifdef __midl
418     [size_is(noncePlatformLength)]
419 #endif
420     BYTE*       noncePlatform;
421     UINT32      sF0Length;
422 #ifdef __midl
423     [size_is(sF0Length)]
424 #endif
425     BYTE*       sF0;
426     UINT32      sF1Length;
427 #ifdef __midl
428     [size_is(sF1Length)]
429 #endif
430     BYTE*       sF1;
431     UINT32      sVprimeLength;
432 #ifdef __midl
433     [size_is(sVprimeLength)]
434 #endif
435     BYTE*       sVprime;
436     UINT32      sVtildePrimeLength;
437 #ifdef __midl
438     [size_is(sVtildePrimeLength)]
439 #endif
440     BYTE*       sVtildePrime;
441     UINT32      sALength;       // Length of first dimension
442     UINT32      sALength2;      // Length of second dimension
443 #ifdef __midl
444     [size_is(sALength,sALength2)]
445 #endif
446     BYTE**      sA;
447     UINT32      attributeCommitmentsLength;
448     TSS_DAA_ATTRIB_COMMIT* attributeCommitments;
449 } TSS_DAA_CREDENTIAL_REQUEST;
450 
451 typedef struct tdTSS_DAA_SELECTED_ATTRIB
452 {
453     TSS_VERSION versionInfo;
454     UINT32      indicesListLength;
455 #ifdef __midl
456     [size_is(indicesListLength)]
457 #endif
458     TSS_BOOL*   indicesList;
459 } TSS_DAA_SELECTED_ATTRIB;
460 
461 typedef struct tdTSS_DAA_PSEUDONYM
462 {
463     TSS_VERSION versionInfo;
464     TSS_FLAG    payloadFlag;
465     UINT32      payloadLength;
466 #ifdef __midl
467     [size_is(payloadLength)]
468 #endif
469     BYTE*       payload;
470 } TSS_DAA_PSEUDONYM;
471 
472 typedef struct tdTSS_DAA_PSEUDONYM_PLAIN
473 {
474     TSS_VERSION versionInfo;
475     UINT32      capitalNvLength;
476 #ifdef __midl
477     [size_is(capitalNvLength)]
478 #endif
479     BYTE*       capitalNv;
480 } TSS_DAA_PSEUDONYM_PLAIN;
481 
482 typedef struct tdTSS_DAA_PSEUDONYM_ENCRYPTED
483 {
484     TSS_VERSION versionInfo;
485     UINT32      delta1Length;
486 #ifdef __midl
487     [size_is(delta1Length)]
488 #endif
489     BYTE*       delta1;
490     UINT32      delta2Length;
491 #ifdef __midl
492     [size_is(delta2Length)]
493 #endif
494     BYTE*       delta2;
495     UINT32      delta3Length;
496 #ifdef __midl
497     [size_is(delta3Length)]
498 #endif
499     BYTE*       delta3;
500     UINT32      delta4Length;
501 #ifdef __midl
502     [size_is(delta4Length)]
503 #endif
504     BYTE*       delta4;
505     UINT32      sTauLength;
506 #ifdef __midl
507     [size_is(sTauLength)]
508 #endif
509     BYTE*       sTau;
510 } TSS_DAA_PSEUDONYM_ENCRYPTED;
511 
512 typedef struct tdTSS_DAA_SIGN_CALLBACK
513 {
514     TSS_VERSION versionInfo;
515     TSS_HHASH   challenge;
516     TSS_FLAG    payloadFlag;
517     UINT32      payloadLength;
518 #ifdef __midl
519     [size_is(payloadLength)]
520 #endif
521     BYTE*       payload;
522 } TSS_DAA_SIGN_CALLBACK;
523 
524 typedef struct tdTSS_DAA_SIGNATURE
525 {
526     TSS_VERSION            versionInfo;
527     UINT32                 zetaLength;
528 #ifdef __midl
529     [size_is(zetaLength)]
530 #endif
531     BYTE*                  zeta;
532     UINT32                 capitalTLength;
533 #ifdef __midl
534     [size_is(capitalTLength)]
535 #endif
536     BYTE*                  capitalT;
537     UINT32                 challengeLength;
538 #ifdef __midl
539     [size_is(challengeLength)]
540 #endif
541     BYTE*                  challenge;
542     UINT32                 nonceTpmLength;
543 #ifdef __midl
544     [size_is(nonceTpmLength)]
545 #endif
546     BYTE*                  nonceTpm;
547     UINT32                 sVLength;
548 #ifdef __midl
549     [size_is(sVLength)]
550 #endif
551     BYTE*                  sV;
552     UINT32                 sF0Length;
553 #ifdef __midl
554     [size_is(sF0Length)]
555 #endif
556     BYTE*                  sF0;
557     UINT32                 sF1Length;
558 #ifdef __midl
559     [size_is(sF1Length)]
560 #endif
561     BYTE*                  sF1;
562     UINT32                 sELength;
563 #ifdef __midl
564     [size_is(sELength)]
565 #endif
566     BYTE*                  sE;
567     UINT32                 sALength;    // Length of first dimension
568     UINT32                 sALength2;   // Length of second dimension
569 #ifdef __midl
570     [size_is(sALength,sALength2)]
571 #endif
572     BYTE**                 sA;
573     UINT32                 attributeCommitmentsLength;
574 #ifdef __midl
575     [size_is(attributeCommitmentsLength)]
576 #endif
577     TSS_DAA_ATTRIB_COMMIT* attributeCommitments;
578     TSS_DAA_PSEUDONYM      signedPseudonym;
579     TSS_DAA_SIGN_CALLBACK  callbackResult;
580 } TSS_DAA_SIGNATURE;
581 
582 typedef struct tdTSS_DAA_IDENTITY_PROOF
583 {
584     TSS_VERSION versionInfo;
585     UINT32      endorsementLength;
586 #ifdef __midl
587     [size_is(endorsementLength)]
588 #endif
589     BYTE*       endorsementCredential;
590     UINT32      platformLength;
591 #ifdef __midl
592     [size_is(platformLength)]
593 #endif
594     BYTE*       platform;
595     UINT32      conformanceLength;
596 #ifdef __midl
597     [size_is(conformanceLength)]
598 #endif
599     BYTE*       conformance;
600 } TSS_DAA_IDENTITY_PROOF;
601 
602 
603 ////////////////////////////////////////////////////////////////////
604 
605 typedef UINT32 TSS_FAMILY_ID;
606 typedef BYTE   TSS_DELEGATION_LABEL;
607 // Values are TSS_DELEGATIONTYPE_KEY or TSS_DELEGATIONTYPE_OWNER
608 typedef UINT32 TSS_DELEGATION_TYPE;
609 
610 typedef struct tdTSS_PCR_INFO_SHORT
611 {
612     UINT32               sizeOfSelect;
613 #ifdef __midl
614     [size_is(sizeOfSelect)]
615 #endif
616     BYTE                *selection;
617     BYTE                 localityAtRelease;
618     UINT32               sizeOfDigestAtRelease;
619 #ifdef __midl
620     [size_is(sizeOfDigestAtRelease)]
621 #endif
622     BYTE                *digestAtRelease;
623 } TSS_PCR_INFO_SHORT;
624 
625 typedef struct tdTSS_FAMILY_TABLE_ENTRY
626 {
627     TSS_FAMILY_ID        familyID;
628     TSS_DELEGATION_LABEL label;
629     UINT32               verificationCount;
630     TSS_BOOL             enabled;
631     TSS_BOOL             locked;
632 } TSS_FAMILY_TABLE_ENTRY;
633 
634 typedef struct tdTSS_DELEGATION_TABLE_ENTRY
635 {
636     UINT32               tableIndex;
637     TSS_DELEGATION_LABEL label;
638     TSS_PCR_INFO_SHORT   pcrInfo;
639     UINT32               per1;
640     UINT32               per2;
641     TSS_FAMILY_ID        familyID;
642     UINT32               verificationCount;
643 } TSS_DELEGATION_TABLE_ENTRY;
644 
645 typedef struct tdTSS_PLATFORM_CLASS
646 {
647     UINT32 platformClassSimpleIdentifier;
648     UINT32 platformClassURISize;
649     BYTE*  pPlatformClassURI;
650 } TSS_PLATFORM_CLASS;
651 
652 #endif // __TSS_STRUCTS_H__
653 
654