summaryrefslogtreecommitdiff
path: root/src/include/daa/verifier.h
blob: f177948b3022bc8012f01e7ffe9f59a880a5d63e (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

/*
 * Licensed Materials - Property of IBM
 *
 * trousers - An open source TCG Software Stack
 *
 * (C) Copyright International Business Machines Corp. 2006
 *
 */

#ifndef VERIFIER_H_
#define VERIFIER_H_

#include "bi.h"
#include "daa_structs.h"
#include "anonymity_revocation.h"
#include "daa_parameter.h"
#include "tsplog.h"

/*
 * Transaction of a DAA Verifier to verify a signature (VerifierTransaction.java)
 */
typedef struct {
	BYTE *baseName;
	int baseName_length;
	EVP_MD *digest;
	BYTE *nonce;
	int nonce_length;
	int is_anonymity_revocation_enabled; // boolean
	BYTE *anonymity_revocation_condition;
	int anonymity_revocation_condition_length;
	CS_PUBLIC_KEY *anonymity_revocator_pk;
	// private TssDaaSelectedAttrib[] selectedAttributes2Commit;
	TSS_DAA_SELECTED_ATTRIB **selected_attributes2commit;
	int selected_attributes2commitLength;
} DAA_VERIFIER_TRANSACTION;

/* the return (BYTE *) should be free after usage */
BYTE *compute_bytes( int seedLength, BYTE *seed, int length, const EVP_MD *digest);

bi_ptr compute_zeta( int nameLength, unsigned char *name, TSS_DAA_PK_internal *issuer_pk);

bi_ptr project_into_group_gamma( bi_ptr base, TSS_DAA_PK_internal *issuer_pk);
#if 0
TSPICALL Tspi_DAA_VerifyInit_internal
(
	TSS_HDAA hDAA,	// in
	UINT32* nonceVerifierLength,	// out
	BYTE** nonceVerifier,	// out
	UINT32 baseNameLength,	// out
	BYTE ** baseName		// out
);

TSPICALL Tspi_DAA_VerifySignature_internal
(	TSS_HDAA hDAA,	// in
	TSS_DAA_SIGNATURE signature, // in
	TSS_HKEY hPubKeyIssuer,	// in
	TSS_DAA_SIGN_DATA sign_data,	// in
	UINT32 attributes_length,	// in
	BYTE **attributes,	// in
	UINT32 nonce_verifierLength,	// out
	BYTE *nonce_verifier,	// out
	UINT32 base_nameLength,	// out
	BYTE *base_name,	// out
	TSS_BOOL *isCorrect	// out
);
#else
TSS_RESULT
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
);

#endif

BYTE *compute_sign_challenge_host(
	int *result_length,
	EVP_MD *digest,
	TSS_DAA_PK_internal *issuer_pk,
	int nonce_verifierLength,
	BYTE *nonce_verifier,
	int selected_attributes2commitLength,
	TSS_DAA_SELECTED_ATTRIB **selected_attributes2commit,
	int is_anonymity_revocation_enabled,
	bi_ptr zeta,
	bi_ptr capital_t,
	bi_ptr capital_tilde,
	int attribute_commitmentsLength,
	TSS_DAA_ATTRIB_COMMIT_internal **attribute_commitments,
	TSS_DAA_ATTRIB_COMMIT_internal **attribute_commitment_proofs,
	bi_ptr capital_nv,
	bi_ptr capital_tilde_v,
	CS_PUBLIC_KEY *anonymity_revocator_pk,
	CS_ENCRYPTION_RESULT *encryption_result_rand,
	CS_ENCRYPTION_RESULT *encryption_result_proof);

#endif /*VERIFIER_H_*/