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
|
/*
* Licensed Materials - Property of IBM
*
* trousers - An open source TCG Software Stack
*
* (C) Copyright International Business Machines Corp. 2004
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include "trousers/tss.h"
#include "trousers/trousers.h"
#include "trousers_types.h"
//#include "trousers_types.h"
#include "spi_utils.h"
//#include "capabilities.h"
#include "tsplog.h"
//#include "tcs_tsp.h"
//#include "tspps.h"
//#include "hosttable.h"
//#include "tcsd_wrap.h"
//#include "tcsd.h"
#include "obj.h"
#include "daa/issuer.h"
#include "daa/platform.h"
#include "daa/verifier.h"
#include "daa/anonymity_revocation.h"
#include "daa/key_correct.h"
#include "daa/issuer.h"
// static TSS_HCONTEXT _hContext;
static void *tss_alloc( size_t size, TSS_HOBJECT hContext) {
void *ret = calloc_tspi( hContext, size);
LogDebug("[intern_alloc (%d)] -> %d", (int)size, (int)ret);
return ret;
}
/*
static void *normal_malloc( size_t size, TSS_HOBJECT object) {
void *ret = malloc( size);
return ret;
}
*/
/**
This is the first out of 3 functions to execute in order to receive a DAA Credential.
It verifies the keys of the DAA Issuer and computes the TPM DAA public key.
Parameters
- hDAA: Handle of the DAA object
- hTPM: Handle of the TPM object
- daaCounter: DAA counter
- issuerPk: Handle of the DAA Issuer public key
- issuerAuthPKsLength: Length of the array of issuerAuthPKs
- issuerAuthPKs:Handle of an array of RSA public keys (key chain) of the DAA Issuer used
to authenticate the DAA Issuer public key. The size of the modulus
must be TPM_DAA_SIZE_issuerModulus (256)
- issuerAuthPKSignaturesLength:Length of the array of issuerAuthPKSignatures. It is equal
to issuerAuthPKsLength . The length of an element of the array is
TPM_DAA_SIZE_issuerModulus (256)
- issuerAuthPKSignatures: An array of byte arrays representing signatures on the modulus
of the above key chain (issuerAuthPKs) in more details, the array has the
following content (S(K[1],K[0]),S(K[2],N[1]),..S(K[ k ],K[n-1]),
S(TPM_DAA_ISSUER,K[ k ])), where S(msg,privateKey) denotes
the signature function with msg being signed by the privateKey.
- capitalUprimeLength: Length of capitalUprime which is ln/8. ln is defined as the size of the RSA modulus (2048).
- capitalUprime: U?
- identityProof: This structure contains the endorsement, platform and conformance credential.
- joinSession: This structure contains DAA Join session information.
*/
#if 0
TSPICALL
Tspi_TPM_DAA_JoinInit(TSS_HDAA hDAA, // in
TSS_HTPM hTPM, // in
UINT32 daaCounter, // in
TSS_HDAA_DATA issuerPk, // in
UINT32 issuerAuthPKsLength, // in
TSS_HKEY* issuerAuthPKs, // in
UINT32 issuerAuthPKSignaturesLength, // in
BYTE** issuerAuthPKSignatures, // in
UINT32* capitalUprimeLength, // out
BYTE** capitalUprime, // out
TSS_DAA_IDENTITY_PROOF** identityProof, // out
TSS_DAA_JOIN_SESSION** joinSession) // out
{
TSS_RESULT result;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
LogDebug("-> TSPI_TPM_DAA_joinInit hDAA=%x hTPM=%x daaCounter=%x issuerPk=%x",
(int)hDAA, (int)hTPM, daaCounter, (int)issuerPk);
result = Tspi_TPM_DAA_JoinInit_internal(
hDAA,
hTPM,
daaCounter,
(TSS_DAA_PK *)issuerPk,
issuerAuthPKsLength,
(RSA **)issuerAuthPKs,
issuerAuthPKSignaturesLength,
issuerAuthPKSignatures,
capitalUprimeLength,
capitalUprime,
identityProof,
joinSession);
bi_flush_memory();
LogDebug("TSPI_TPM_DAA_joinInit ALLOC DELTA:%d",mallinfo().uordblks-before);
LogDebug("<- TSPI_TPM_DAA_joinInit result=%d", result);
return result;
}
#else
TSS_RESULT
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 */
{
TSS_RESULT result;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
if (!capitalUprimeLength || !capitalUprime || !identityProof || !joinSessionLength ||
!joinSession)
return TSPERR(TSS_E_BAD_PARAMETER);
result = Tspi_TPM_DAA_JoinInit_internal(hTPM, hIssuerKey, daaCounter, issuerAuthPKsLength,
issuerAuthPKs, issuerAuthPKSignaturesLength,
issuerAuthPKSignaturesLength2,
issuerAuthPKSignatures, capitalUprimeLength,
capitalUprime, identityProof, joinSessionLength,
joinSession);
bi_flush_memory();
LogDebug("TSPI_TPM_DAA_joinInit ALLOC DELTA:%d",mallinfo().uordblks-before);
LogDebug("<- TSPI_TPM_DAA_joinInit result=%d", result);
return result;
}
#endif
/**
This function is part of the DAA Issuer component. It defines the generation of a DAA Issuer
public and secret key. Further it defines the generation of a non-interactive proof (using
the Fiat-Shamir heuristic) that the public keys were chosen correctly. The latter will guarantee
the security requirements of the platform (respectively, its user), i.e., that the privacy and
anonymity of signatures will hold.
The generation of the authentication keys of the DAA Issuer, which are used to authenticate
(main) DAA Issuer keys, is not defined by this function.
This is an optional function and does not require a TPM or a TCS.
Parameters
- hDAA: Handle of the DAA object
- issuerBaseNameLength: Length of issuerBaseName
- issuerBaseName: Unique name of the DAA Issuer
- numberPlatformAttributes: Number of attributes that the Platform can choose and which
will not be visible to the Issuer.
- numberIssuerAttributes:Number of attributes that the Issuer can choose and which will
be visible to both the Platform and the Issuer.
- keyPair: Handle of the main DAA Issuer key pair (private and public portion)
- publicKeyProof:Handle of the proof of the main DAA Issuer public key
*/
#if 0
TSPICALL
Tspi_DAA_IssueSetup(TSS_HDAA hDAA, // in
UINT32 issuerBaseNameLength, // in
BYTE* issuerBaseName, // in
UINT32 numberPlatformAttributes, // in
UINT32 numberIssuerAttributes, // in
TSS_HDAA_DATA* keyPair, // out (TSS_KEY_PAIR)
TSS_HDAA_DATA* publicKeyProof) // out (TSS_DAA_PK_PROOF)
{
TSS_RESULT result;
KEY_PAIR_WITH_PROOF_internal *key_proof;
TSS_DAA_KEY_PAIR *tss_daa_key_pair;
TSS_HCONTEXT hContext;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
LogDebug( "TSPI_DAA_IssueSetup hDAA=%d ",hDAA);
// TODO: lock access to _hContext
if ((result = obj_daa_get_tsp_context(hDAA, &hContext)))
return result;
result = generate_key_pair(numberIssuerAttributes,
numberPlatformAttributes,
issuerBaseNameLength,
issuerBaseName,
&key_proof);
if (result != TSS_SUCCESS)
return result;
LogDebug("TSPI_DAA_IssueSetup convert internal structure to public allocated using tspi_alloc");
LogDebug("key_proof->proof->length_challenge=%d key_proof->proof->length_response=%d",
key_proof->proof->length_challenge, key_proof->proof->length_response);
// prepare out parameters
*publicKeyProof = i_2_e_TSS_DAA_PK_PROOF( key_proof->proof, &tss_alloc, hContext);
tss_daa_key_pair = (TSS_DAA_KEY_PAIR *)tss_alloc( sizeof(TSS_DAA_KEY_PAIR), hContext);
if (tss_daa_key_pair == NULL) {
LogError("malloc of %d bytes failed", sizeof(TSS_DAA_KEY_PAIR));
result = TSPERR(TSS_E_OUTOFMEMORY);
goto close;
}
tss_daa_key_pair->private_key = i_2_e_TSS_DAA_PRIVATE_KEY( key_proof->private_key,
&tss_alloc,
hContext);
tss_daa_key_pair->public_key = i_2_e_TSS_DAA_PK( key_proof->pk,
&tss_alloc,
hContext);
*keyPair = (TSS_HKEY)tss_daa_key_pair;
close:
bi_flush_memory();
LogDebug("TSPI_DAA_IssueSetup ALLOC DELTA:%d", mallinfo().uordblks-before);
LogDebug( "TSPI_DAA_IssueSetup end return=%d ",result);
return result;
}
#else
TSS_RESULT
Tspi_DAA_Issuer_GenerateKey(TSS_HDAA_ISSUER_KEY hIssuerKey, // in
UINT32 issuerBaseNameLength, // in
BYTE* issuerBaseName) // in
{
TSS_RESULT result;
KEY_PAIR_WITH_PROOF_internal *key_proof;
TSS_DAA_KEY_PAIR *tss_daa_key_pair;
TSS_HCONTEXT tspContext;
UINT32 numberPlatformAttributes, numberIssuerAttributes;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
if ((result = obj_daaissuerkey_get_tsp_context(hIssuerKey, &tspContext)))
return result;
if ((result = obj_daaissuerkey_get_attribs(hIssuerKey, &numberIssuerAttributes,
&numberPlatformAttributes)))
return result;
if ((result = generate_key_pair(numberIssuerAttributes, numberPlatformAttributes,
issuerBaseNameLength, issuerBaseName, &key_proof)))
return result;
LogDebugFn("convert internal structure to public allocated using tspi_alloc");
LogDebug("key_proof->proof->length_challenge=%d key_proof->proof->length_response=%d",
key_proof->proof->length_challenge, key_proof->proof->length_response);
// prepare out parameters
*publicKeyProof = i_2_e_TSS_DAA_PK_PROOF( key_proof->proof, &tss_alloc, tspContext);
tss_daa_key_pair = (TSS_DAA_KEY_PAIR *)tss_alloc( sizeof(TSS_DAA_KEY_PAIR), tspContext);
if (tss_daa_key_pair == NULL) {
LogError("malloc of %d bytes failed", sizeof(TSS_DAA_KEY_PAIR));
result = TSPERR(TSS_E_OUTOFMEMORY);
goto close;
}
tss_daa_key_pair->private_key = i_2_e_TSS_DAA_PRIVATE_KEY( key_proof->private_key,
&tss_alloc,
tspContext);
tss_daa_key_pair->public_key = i_2_e_TSS_DAA_PK( key_proof->pk,
&tss_alloc,
tspContext);
*keyPair = (TSS_HKEY)tss_daa_key_pair;
close:
bi_flush_memory();
LogDebug("TSPI_DAA_IssueSetup ALLOC DELTA:%d", mallinfo().uordblks-before);
LogDebug( "TSPI_DAA_IssueSetup end return=%d ",result);
return result;
}
#endif
/**
This function is part of the DAA Issuer component. It's the first function out of 2 in order to
issue a DAA Credential for a TCG Platform. It assumes that the endorsement key and its
associated credentials are from a genuine and valid TPM. (Verification of the credentials is
a process defined by the TCG Infrastructure WG.)
This is an optional function and does not require a TPM or a TCS.
*/
TSPICALL
Tspi_DAA_IssueInit(TSS_HDAA hDAA, // in
TSS_HKEY issuerAuthPK, // in
TSS_HDAA_DATA issuerKeyPair, // in (TSS_DAA_KEY_PAIR)
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
TSS_DAA_JOIN_ISSUER_SESSION** joinSession) // out
{
TSS_RESULT result;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
LogDebug("Tspi_DAA_IssueInit_internal hDAA=%d daaCounter=%d", (int)hDAA, (int)daaCounter);
result = Tspi_DAA_IssueInit_internal(
hDAA, // in
issuerAuthPK, // in
issuerKeyPair, // in
identityProof, // in
capitalUprimeLength, // in
capitalUprime, // in
daaCounter, // in
nonceIssuerLength, // out
nonceIssuer, // out
authenticationChallengeLength, // out
authenticationChallenge, // out
joinSession // out
);
bi_flush_memory();
LogDebug("Tspi_DAA_IssueInit_internal ALLOC DELTA:%d", mallinfo().uordblks-before);
return result;
}
/**
This function verifies the DAA public key of a DAA Issuer with respect to its associated proof.
This is a resource consuming task. It can be done by trusted third party (certification).
This is an optional function and does not require a TPM or a TCS.
Parameters:
- hDAA: Handle of the DAA object
- issuerPk: DAA Issuer public key
- issuerPkProof: Proofs the correctness of the DAA Issuer public key
- isCorrect: Proofs the correctness of the DAA Issuer public key
*/
TSPICALL
Tspi_DAA_IssuerKeyVerification(TSS_HDAA hDAA, // in
TSS_HDAA_DATA issuerPk, // in (TSS_DAA_PK)
TSS_HDAA_DATA issuerPkProof, // in (TSS_DAA_PK_PROOF)
TSS_BOOL* isCorrect) // out
{
TSS_RESULT result;
int is_correct;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
LogDebug("TSPI_DAA_IssuerKeyVerification hDAA=%ld issuerPk=%ld issuerPkProof=%ld",
(long)hDAA, (long)issuerPk, (long)issuerPkProof);
TSS_DAA_PK_internal *pk_internal = e_2_i_TSS_DAA_PK( (TSS_DAA_PK *)issuerPk);
TSS_DAA_PK_PROOF_internal *proof_internal = e_2_i_TSS_DAA_PK_PROOF( issuerPkProof);
LogDebug( "challenge=[%s]", dump_byte_array( proof_internal->length_challenge,
proof_internal->challenge));
result = is_pk_correct( pk_internal, proof_internal, &is_correct );
if( is_correct) *isCorrect = TRUE;
else *isCorrect = FALSE;
bi_flush_memory();
#ifdef TSS_DEBUG
LogDebug("TSPI_DAA_IssuerKeyVerification ALLOC DELTA:%d", mallinfo().uordblks-before);
#endif
return result;
}
/**
This function is part of the DAA Issuer component. It?s the last function out of 2 in order to
issue DAA Credential for a TCG Platform. It detects rogue TPM according to published rogue
TPM DAA keys.
This is an optional function and does not require a TPM or a TCS.
*/
TSPICALL
Tspi_DAA_IssueCredential(TSS_HDAA hDAA, // in
UINT32 attributesIssuerLength, // in
BYTE** attributesIssuer, // in
TSS_DAA_CREDENTIAL_REQUEST* credentialRequest, // in
TSS_DAA_JOIN_ISSUER_SESSION* joinSession, // in
TSS_DAA_CRED_ISSUER** credIssuer) // out
{
TSS_RESULT result;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
LogDebug("Tspi_DAA_IssueCredential hDAA=%d attributesIssuerLength=%d",
(int)hDAA,
(int)attributesIssuerLength);
result = Tspi_DAA_IssueCredential_internal(
hDAA,
attributesIssuerLength,
attributesIssuer,
credentialRequest,
joinSession,
credIssuer
);
bi_flush_memory();
#ifdef TSS_DEBUG
LogDebug("Tspi_DAA_IssueCredential ALLOC DELTA:%d", mallinfo().uordblks-before);
#endif
return result;
}
/**
This function is part of the DAA Verifier component. It is the first function out of 2 in order
to verify a DAA credential of a TCG platform. It creates a challenge for the TCG platform.last
function out of 2 in order to issue a This is an optional function and does not require a
TPM or a TCS.
*/
TSPICALL
Tspi_DAA_VerifyInit(TSS_HDAA hDAA, // in
UINT32* nonceVerifierLength, // out
BYTE** nonceVerifier, // out
UINT32* baseNameLength, // out
BYTE** baseName) // out
{
TSS_RESULT result;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
// TODO which interface to use ? with or without baseName ?
LogDebug("Tspi_DAA_VerifyInit hDAA=%d", (int)hDAA);
result = Tspi_DAA_VerifyInit_internal( hDAA,
nonceVerifierLength,
nonceVerifier,
baseNameLength,
baseName);
bi_flush_memory();
#ifdef TSS_DEBUG
LogDebug("Tspi_DAA_VerifyInit ALLOC DELTA:%d", mallinfo().uordblks-before);
#endif
return result;
}
/**
This function is part of the DAA Verifier component. It is the last function out of 2 in
order to verify a DAA Credential of a TCG Platform. It verifies the DAA credential and
detects public rogue TPMs. This is an optional function and does not require a TPM
or a TCS.
*/
TSPICALL
Tspi_DAA_VerifySignature(TSS_HDAA hDAA, // in
TSS_DAA_SIGNATURE* daaSignature, // in
TSS_HDAA_DATA hPubKeyIssuer, // in (TSS_DAA_PK)
TSS_DAA_SIGN_DATA* signData, // in
UINT32 attributesLength, // in
BYTE** attributes, // in
UINT32 nonceVerifierLength,// in
BYTE* nonceVerifier, // in
UINT32 baseNameLength, // in
BYTE* baseName, // in
TSS_BOOL* isCorrect) // out
{
TSS_RESULT result;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
LogDebug("Tspi_DAA_VerifySignature hDAA=%d", (int)hDAA);
result = Tspi_DAA_VerifySignature_internal( hDAA,
daaSignature,
hPubKeyIssuer,
signData,
attributesLength,
attributes,
nonceVerifierLength,
nonceVerifier,
baseNameLength,
baseName,
isCorrect);
bi_flush_memory();
#ifdef TSS_DEBUG
LogDebug("Tspi_DAA_VerifySignature ALLOC DELTA:%d", mallinfo().uordblks-before);
#endif
return result;
}
/**
This function is part of the DAA Issuer component. It is the last function out of 2 in
order to issue a DAA Credential for a TCG Platform. It detects rogue TPM according
to published rogue TPM DAA keys.
This is an optional function and does not require a TPM or a TCS.
Parameters
- hDAA: Handle of the DAA object
- daaPublicKey: daaPublickKey
- keyPair: Public and private key of the DAA Anonymity Revocation Authority to encrypt
the pseudonym of a DAA Signature
*/
TSPICALL
Tspi_DAA_RevokeSetup(TSS_HDAA hDAA, // in
TSS_HDAA_DATA daaPublicKey, // in
TSS_HDAA_DATA* arPublicKey, // out (TSS_DAA_AR_PK)
TSS_HDAA_DATA* arPrivateKey) // out (TSS_DAA_AR_SK)
{
TSS_RESULT result;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
result = Tspi_DAA_RevokeSetup_internal(
hDAA, // in
//TODO: remove cast when the above interface is changed
daaPublicKey, // in
keyPair // out
);
bi_flush_memory();
#ifdef TSS_DEBUG
LogDebug("Tspi_DAA_RevokeSetup ALLOC DELTA:%d", mallinfo().uordblks-before);
#endif
return TSS_SUCCESS;
}
/**
This function is part of the DAA Anonymity Revocation Authority component. It defines the
Cramer-Shoup decryption algorithm to revoke the anonymity of a DAA Signature. The pseudonym,
with respect to either the DAA Verifier?s base name, the DAA Issuer?s base name or (just for
completeness) a random base name, can be revealed.
The pseudonym with respect to a DAA Signature and the used base name is V N . An encryption of
V N is the tuple (d1,d 2 ,d 3,d 4 ) and is decrypted using the secret key ( 0 5 x ,?, x ), the
decryption condition and the DAA public key.
This is an optional function and does not require a TPM or a TCS.
Parameters:
- hDAA: Handle of the DAA object
- encryptedPseudonym: encryptedPseudonym
- decryptCondition: Condition for the decryption of the pseudonym.
- arPrivateKey: arPrivateKey
- daaPublicKey: daaPublicKey
- pseudonym: pseudonym
*/
TSPICALL
Tspi_DAA_ARDecrypt(TSS_HDAA hDAA, // in
TSS_DAA_PSEUDONYM_ENCRYPTED* encryptedPseudonym, // in
TSS_HHASH decryptCondition, // in
TSS_HDAA_DATA arPrivateKey, // in (TSS_DAA_AR_SK)
TSS_HDAA_DATA daaPublicKey, // in (TSS_DAA_PK)
TSS_DAA_PSEUDONYM_PLAIN** pseudonym) // out
{
TSS_RESULT result;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
result = Tspi_DAA_ARDecrypt_internal(
hDAA, // in
encryptedPseudonym, // in
decryptCondition, // in
//TODO: remove cast when the above interface is changed
(void *)arPrivateKey, // in
(void *)daaPublicKey, // in
pseudonym // out
);
bi_flush_memory();
#ifdef TSS_DEBUG
LogDebug("Tspi_DAA_ARDecrypt ALLOC DELTA:%d", mallinfo().uordblks-before);
#endif
return result;
}
/**
This is the second out of 3 functions to execute in order to receive a DAA Credential. It
computes the credential request for the DAA Issuer, which also includes the Platform
DAA public key and the attributes that were chosen by the Platform, and which are not
visible to the DAA Issuer. The Platform can commit to the attribute values it has chosen.
*/
TSPICALL
Tspi_TPM_DAA_JoinCreateDaaPubKey(TSS_HDAA hDAA, // in
TSS_HTPM hTPM, // in
UINT32 authenticationChallengeLength,// in
BYTE* authenticationChallenge, // in
UINT32 nonceIssuerLength, // in
BYTE* nonceIssuer, // in
UINT32 attributesPlatformLength, // in
BYTE** attributesPlatform, // in
TSS_DAA_JOIN_SESSION* joinSession, // in, out
TSS_DAA_CREDENTIAL_REQUEST** credentialRequest) // out
{
TSS_RESULT result;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
LogDebug("Tspi_TPM_DAA_JoinCreateDaaPubKey hDAA=%d joinSession=%d",
(int)hDAA, (int)joinSession);
result = Tspi_TPM_DAA_JoinCreateDaaPubKey_internal(
hDAA, // in
hTPM, // in
authenticationChallengeLength, // in
authenticationChallenge, // in
nonceIssuerLength, // in
nonceIssuer, // in
attributesPlatformLength, // in
attributesPlatform, // in
joinSession, // in, out
credentialRequest // out
);
bi_flush_memory();
#ifdef TSS_DEBUG
LogDebug("Tspi_TPM_DAA_JoinCreateDaaPubKey ALLOC DELTA:%d", mallinfo().uordblks-before);
#endif
return result;
}
/**
This is the last out of 3 functions to execute in order to receive a DAA Credential.
It verifies the issued credential from the DAA Issuer and computes the final DAA Credential.
*/
TSPICALL
Tspi_TPM_DAA_JoinStoreCredential(TSS_HDAA hDAA, // in
TSS_HTPM hTPM, // in
TSS_DAA_CRED_ISSUER* credIssuer, // in
TSS_DAA_JOIN_SESSION* joinSession, // in
TSS_HDAA_DATA* phDaaCredential) // out (TSS_DAA_CREDENTIAL)
{
TSS_RESULT result;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
LogDebug("Tspi_TPM_DAA_JoinStoreCredential hDAA=%d credIssuer=%d joinSession=%d",
(int)hDAA, (int)&credIssuer, (int)&joinSession);
result = Tspi_TPM_DAA_JoinStoreCredential_internal(hDAA,
hTPM,
credIssuer,
joinSession,
phDaaCredential);
bi_flush_memory();
#ifdef TSS_DEBUG
LogDebug("Tspi_TPM_DAA_JoinStoreCredential ALLOC DELTA:%d", mallinfo().uordblks-before);
#endif
return result;
}
/**
This function creates a DAA Signature that proofs ownership of the DAA Credential and
includes a signature on either a public AIK or a message.
If anonymity revocation is enabled, the value Nv is not provided in the clear anymore but
encrypted under the public key of anonymity revocation authority, a trusted third party (TTP).
Thus the DAA Verifier cannot check for revocation or link a transaction/signature to prior ones.
Depending on how z is chosen, the protocol either allows to implementing anonymity revocation
(i.e., using the DAA Issuer long-term base name bsn I as the DAA Verifier base name bsnV ), or
having the TTP doing the linking of different signatures for the same DAA Verifier (i.e.,
using the DAA Verifier base name ).
*/
TSPICALL
Tspi_TPM_DAA_Sign(TSS_HDAA hDAA, // in
TSS_HTPM hTPM, // in
TSS_HDAA_DATA hDaaCredential, // in (TSS_DAA_CREDENTIAL)
TSS_DAA_SELECTED_ATTRIB* revealAttributes, // in
UINT32 verifierBaseNameLength, // in
BYTE* verifierBaseName, // in
UINT32 verifierNonceLength, // in
BYTE* verifierNonce, // in
TSS_DAA_SIGN_DATA* signData, // in
TSS_DAA_SIGNATURE** daaSignature) // out
{
TSS_RESULT result;
#ifdef TSS_DEBUG
int before = mallinfo().uordblks;
#endif
LogDebug("-> TSPI_TPM_DAA_Sign hDAA=%ld hTPM=%ld ", (long)hDAA, (long)hTPM);
result = Tspi_TPM_DAA_Sign_internal(hDAA,
hTPM,
hDaaCredential,
revealAttributes,
verifierBaseNameLength,
verifierBaseName,
verifierNonceLength,
verifierNonce,
signData,
daaSignature);
bi_flush_memory();
#ifdef TSS_DEBUG
LogDebug("TSPI_TPM_DAA_joinInit ALLOC DELTA:%d", mallinfo().uordblks-before);
#endif
LogDebug("<- TSPI_TPM_DAA_joinInit result=%d", result);
return result;
}
|