diff options
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | src/include/gnunet_zklaim_lib.h | 131 | ||||
-rw-r--r-- | src/zklaim/Makefile.am | 22 | ||||
-rw-r--r-- | src/zklaim/zklaim.c | 309 |
4 files changed, 249 insertions, 214 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in index c4f23ebda..a0fbfc6a1 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in | |||
@@ -523,7 +523,6 @@ src/vpn/gnunet-helper-vpn-windows.c | |||
523 | src/vpn/gnunet-service-vpn.c | 523 | src/vpn/gnunet-service-vpn.c |
524 | src/vpn/gnunet-vpn.c | 524 | src/vpn/gnunet-vpn.c |
525 | src/vpn/vpn_api.c | 525 | src/vpn/vpn_api.c |
526 | src/zklaim/main.c | ||
527 | src/zklaim/zklaim.c | 526 | src/zklaim/zklaim.c |
528 | src/zonemaster/gnunet-service-zonemaster.c | 527 | src/zonemaster/gnunet-service-zonemaster.c |
529 | src/zonemaster/gnunet-service-zonemaster-monitor.c | 528 | src/zonemaster/gnunet-service-zonemaster-monitor.c |
diff --git a/src/include/gnunet_zklaim_lib.h b/src/include/gnunet_zklaim_lib.h deleted file mode 100644 index a1fd1f017..000000000 --- a/src/include/gnunet_zklaim_lib.h +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2001-2018 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file include/gnunet_zklaim_lib.h | ||
23 | * @brief ZKlaim functions for GNUnet | ||
24 | * | ||
25 | * @author Martin Schanzenbach | ||
26 | * | ||
27 | * @defgroup zklaim ZKlaim library: Zero-Knowledge Credentials | ||
28 | * | ||
29 | */ | ||
30 | #ifndef GNUNET_ZKLAIM_LIB_H | ||
31 | #define GNUNET_ZKLAIM_LIB_H | ||
32 | |||
33 | #ifdef __cplusplus | ||
34 | extern "C" | ||
35 | { | ||
36 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
37 | } | ||
38 | #endif | ||
39 | #endif | ||
40 | |||
41 | #include "gnunet_common.h" | ||
42 | |||
43 | /** | ||
44 | * @brief type for ZKlaim context | ||
45 | */ | ||
46 | struct GNUNET_ZKLAIM_Context; | ||
47 | |||
48 | /** | ||
49 | * @brief type for ZKlaim payload | ||
50 | */ | ||
51 | struct GNUNET_ZKLAIM_Payload; | ||
52 | |||
53 | |||
54 | /** | ||
55 | * @ingroup zklaim | ||
56 | * Create a new ZKlaim context. Caller must free return value. | ||
57 | * TODO: parameters: keys etc. | ||
58 | * | ||
59 | * @return fresh context; free using #GNUNET_free | ||
60 | */ | ||
61 | struct GNUNET_ZKLAIM_Context * | ||
62 | GNUNET_ZKLAIM_context_create (void); | ||
63 | |||
64 | /** | ||
65 | * @ingroup zklaim | ||
66 | * Create a payload. | ||
67 | * TODO: parameters, attributes etc. | ||
68 | * | ||
69 | * @return fresh payload; free using #GNUNET_free | ||
70 | */ | ||
71 | void | ||
72 | GNUNET_ZKLAIM_payload_create (void); | ||
73 | |||
74 | /** | ||
75 | * @ingroup zklaim | ||
76 | * Create a payload. | ||
77 | * TODO: parameters, attributes etc. | ||
78 | * | ||
79 | * @return GNUNET_OK is successful | ||
80 | */ | ||
81 | int | ||
82 | GNUNET_ZKLAIM_context_add_payload (struct GNUNET_ZKLAIM_Context *ctx, | ||
83 | struct GNUNET_ZKLAIM_Payload* pl); | ||
84 | |||
85 | |||
86 | /** | ||
87 | * @ingroup zklaim | ||
88 | * Create a payload. | ||
89 | * TODO: parameters, attributes etc. | ||
90 | * | ||
91 | * @return size needed for serialized context, -1 on error | ||
92 | */ | ||
93 | ssize_t | ||
94 | GNUNET_ZKLAIM_context_serialize_get_size (struct GNUNET_ZKLAIM_Context *ctx); | ||
95 | |||
96 | |||
97 | /** | ||
98 | * @ingroup zklaim | ||
99 | * Create a payload. | ||
100 | * TODO: parameters, attributes etc. | ||
101 | * | ||
102 | */ | ||
103 | void | ||
104 | GNUNET_ZKLAIM_context_serialize (struct GNUNET_ZKLAIM_Context *ctx, | ||
105 | char* buf); | ||
106 | |||
107 | |||
108 | /** | ||
109 | * @ingroup zklaim | ||
110 | * Create a payload. | ||
111 | * TODO: parameters, attributes etc. | ||
112 | * | ||
113 | * @return fresh payload; free using #GNUNET_free | ||
114 | */ | ||
115 | char * | ||
116 | GNUNET_ZKLAIM_context_to_string (struct GNUNET_ZKLAIM_Context *ctx); | ||
117 | |||
118 | |||
119 | |||
120 | |||
121 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
122 | { | ||
123 | #endif | ||
124 | #ifdef __cplusplus | ||
125 | } | ||
126 | #endif | ||
127 | |||
128 | |||
129 | /* ifndef GNUNET_ZKLAIM_LIB_H */ | ||
130 | #endif | ||
131 | /* end of gnunet_zklaim_lib.h */ | ||
diff --git a/src/zklaim/Makefile.am b/src/zklaim/Makefile.am index c7ca595b8..a3432794a 100644 --- a/src/zklaim/Makefile.am +++ b/src/zklaim/Makefile.am | |||
@@ -13,8 +13,8 @@ if USE_COVERAGE | |||
13 | endif | 13 | endif |
14 | 14 | ||
15 | 15 | ||
16 | libgnunetzklaim_la_SOURCES = zklaim.c | 16 | gnunet_zklaim_SOURCES = zklaim.c |
17 | libgnunetzklaim_la_LIBADD = \ | 17 | gnunet_zklaim_LDADD = \ |
18 | $(GCLIBADD)\ | 18 | $(GCLIBADD)\ |
19 | $(LIBGCRYPT_LIBS) \ | 19 | $(LIBGCRYPT_LIBS) \ |
20 | -lzklaim \ | 20 | -lzklaim \ |
@@ -25,23 +25,13 @@ libgnunetzklaim_la_LIBADD = \ | |||
25 | -lprocps \ | 25 | -lprocps \ |
26 | -lstdc++ \ | 26 | -lstdc++ \ |
27 | -lm | 27 | -lm |
28 | libgnunetzklaim_la_LDFLAGS = \ | 28 | gnunet_zklaim_LDFLAGS = \ |
29 | $(GN_LIB_LDFLAGS) \ | 29 | $(GN_LIB_LDFLAGS) |
30 | -version-info 1:0:0 | ||
31 | 30 | ||
32 | lib_LTLIBRARIES = libgnunetzklaim.la | 31 | #lib_LTLIBRARIES = libgnunetzklaim.la |
32 | bin_PROGRAMS = gnunet-zklaim | ||
33 | 33 | ||
34 | if ENABLE_TEST_RUN | 34 | if ENABLE_TEST_RUN |
35 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | 35 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; |
36 | TESTS = $(check_PROGRAMS) | 36 | TESTS = $(check_PROGRAMS) |
37 | endif | 37 | endif |
38 | |||
39 | #check_PROGRAMS = test_cpabe | ||
40 | |||
41 | #test_cpabe_SOURCES = \ | ||
42 | # test_cpabe.c | ||
43 | #test_cpabe_LDADD = \ | ||
44 | # libgnunetabe.la \ | ||
45 | # $(top_builddir)/src/util/libgnunetutil.la | ||
46 | #check_PROGRAMS += \ | ||
47 | # test_cpabe | ||
diff --git a/src/zklaim/zklaim.c b/src/zklaim/zklaim.c index a53c193d1..82eb38d2d 100644 --- a/src/zklaim/zklaim.c +++ b/src/zklaim/zklaim.c | |||
@@ -1,79 +1,256 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. Copyright (C) 2001-2018 Christian Grothoff | 2 | * This file is part of zklaim. |
3 | (and other contributing authors) | 3 | * zklaim is free software: you can redistribute it and/or modify |
4 | 4 | * it under the terms of the GNU General Public License as published by | |
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | * the Free Software Foundation, either version 3 of the License, or |
6 | under the terms of the GNU Affero General Public License as published | 6 | * (at your option) any later version. |
7 | by the Free Software Foundation, either version 3 of the License, | 7 | * |
8 | or (at your option) any later version. | 8 | * zklaim is distributed in the hope that it will be useful, |
9 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * GNU General Public License for more details. |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | * |
13 | Affero General Public License for more details. | 13 | * You should have received a copy of the GNU General Public License |
14 | 14 | * along with zklaim. If not, see https://www.gnu.org/licenses/. | |
15 | You should have received a copy of the GNU Affero General Public License | 15 | */ |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | 16 | ||
18 | */ | ||
19 | 17 | ||
20 | /** | 18 | /** |
21 | * @file abe/abe.c | 19 | * Test File for zklaim c implementation |
22 | * @brief functions for Attribute-Based Encryption | ||
23 | * @author Martin Schanzenbach | ||
24 | */ | 20 | */ |
25 | 21 | ||
26 | |||
27 | #include "platform.h" | ||
28 | #include <zklaim/zklaim.h> | 22 | #include <zklaim/zklaim.h> |
29 | #include "gnunet_crypto_lib.h" | 23 | #include <zklaim/zklaim_ecc.h> |
30 | 24 | #include <zklaim/zklaim_hash.h> | |
31 | struct GNUNET_ZKLAIM_Context | 25 | #include <stdlib.h> |
32 | { | 26 | #include <stdio.h> |
33 | zklaim_ctx* ctx; | 27 | #include <string.h> |
34 | gcry_sexp_t priv; | 28 | #include <gcrypt.h> |
35 | gcry_sexp_t pub; | 29 | |
36 | }; | 30 | // to boost up valgrind |
37 | 31 | int worker() { | |
38 | struct GNUNET_ZKLAIM_Payload | 32 | gcry_sexp_t priv, pub; |
39 | { | 33 | zklaim_gen_pk(&priv); |
40 | zklaim_payload pl; | 34 | zklaim_get_pub(priv, &pub); |
41 | }; | 35 | unsigned char *pubbuf; |
42 | 36 | size_t publen; | |
43 | struct GNUNET_ZKLAIM_Context* | 37 | zklaim_pub2buf(pub, &pubbuf, &publen); |
44 | GNUNET_ZKLAIM_new () | 38 | |
45 | { | 39 | printf("===========================================================================\n"); |
46 | struct GNUNET_ZKLAIM_Context *ctx; | 40 | printf("===========================================================================\n"); |
47 | unsigned char *pubbuf; | 41 | printf("============================== ISSUER =====================================\n"); |
48 | size_t publen; | 42 | printf("===========================================================================\n"); |
49 | 43 | printf("===========================================================================\n"); | |
50 | ctx = GNUNET_new (struct GNUNET_ZKLAIM_Context); | 44 | //zklaim_ctx* ctx = zklaim_context_init(); |
51 | ctx->ctx = zklaim_context_new(); | 45 | //zklaim_proving_key* pk = zklaim_proving_key_get(ctx); |
52 | zklaim_pub2buf(ctx->pub, &pubbuf, &publen); | 46 | /* |
53 | zklaim_gen_pk(&ctx->priv); | 47 | * - 1 - |
54 | zklaim_get_pub(ctx->priv, &ctx->pub); | 48 | * initialize data structures |
55 | if (sizeof(ctx->ctx->pub_key) != publen) { | 49 | */ |
50 | printf("[ISSUER] initializing context\n"); | ||
51 | zklaim_ctx *ctx = zklaim_context_new(); | ||
52 | |||
53 | if (sizeof(ctx->pub_key) != publen) { | ||
56 | printf("size mismatch!"); | 54 | printf("size mismatch!"); |
57 | return NULL; | 55 | return 1; |
58 | } | 56 | } |
59 | 57 | ||
60 | memcpy(ctx->ctx->pub_key, pubbuf, sizeof(ctx->ctx->pub_key)); | 58 | // TODO: there should be a zklaim method for this |
61 | free(pubbuf); | 59 | memcpy(ctx->pub_key, pubbuf, sizeof(ctx->pub_key)); |
62 | return ctx; | 60 | free(pubbuf); |
63 | } | 61 | |
62 | //print_sexp(pub); | ||
63 | |||
64 | /* | ||
65 | * - 2 - | ||
66 | * setup the first payload | ||
67 | */ | ||
68 | printf("[ISSUER] Setting up payloads..\n"); | ||
69 | zklaim_payload pl, pl2; | ||
70 | memset(&pl, 0, sizeof(zklaim_payload)); | ||
71 | pl.data0_ref = 18; | ||
72 | pl.data0_op = (enum zklaim_op) (zklaim_greater | zklaim_eq); | ||
73 | pl.data1_ref = 1; | ||
74 | pl.data1_op = zklaim_eq; | ||
75 | pl.data2_ref = 2; | ||
76 | pl.data2_op = zklaim_eq; | ||
77 | pl.data3_ref = 3; | ||
78 | pl.data3_op = zklaim_eq; | ||
79 | pl.data4_ref = 600; | ||
80 | pl.data4_op = zklaim_less; | ||
81 | pl.priv = 0; | ||
82 | |||
83 | memset(&pl2, 0, sizeof(zklaim_payload)); | ||
84 | pl2.data0_ref = 0; | ||
85 | pl2.data0_op = zklaim_noop; | ||
86 | pl2.data1_ref = 0; | ||
87 | pl2.data1_op = zklaim_noop; | ||
88 | pl2.data2_ref = 0; | ||
89 | pl2.data2_op = zklaim_noop; | ||
90 | pl2.data3_ref = 0; | ||
91 | pl2.data3_op = zklaim_noop; | ||
92 | pl2.data4_ref = 9223372036854775807; | ||
93 | pl2.data4_op = zklaim_less_or_eq; | ||
94 | pl2.priv = 0; | ||
95 | |||
96 | // fill in the values | ||
97 | zklaim_set_attr(&pl, 23, 0); | ||
98 | zklaim_set_attr(&pl, 1, 1); | ||
99 | zklaim_set_attr(&pl, 2, 2); | ||
100 | zklaim_set_attr(&pl, 3, 3); | ||
101 | zklaim_set_attr(&pl, 599, 4); | ||
102 | |||
103 | zklaim_set_attr(&pl2, 0, 0); | ||
104 | zklaim_set_attr(&pl2, 0, 1); | ||
105 | zklaim_set_attr(&pl2, 0, 2); | ||
106 | zklaim_set_attr(&pl2, 0, 3); | ||
107 | zklaim_set_attr(&pl2, 9223372036854775807, 4); | ||
108 | |||
109 | /* | ||
110 | * - 3 - | ||
111 | * add payload to context | ||
112 | */ | ||
113 | printf("[ISSUER] adding payloads to context\n"); | ||
114 | zklaim_add_pl(ctx, pl); | ||
115 | /* zklaim_add_pl(ctx, pl); */ | ||
116 | //zklaim_add_pl(ctx, pl2); | ||
117 | zklaim_hash_ctx(ctx); | ||
118 | |||
119 | printf("[ISSUER] performing trusted setup in order to generate keys\n"); | ||
120 | printf("-> trusted setup result: %s\n", (zklaim_trusted_setup(ctx) ? "failed" : "passed")); | ||
121 | |||
122 | //unsigned char* buf; | ||
123 | //size_t vksize = zklaim_verification_key_serialize(ctx, &buf); | ||
124 | //printf("serialized vk size: %zuB\n", vksize); | ||
125 | |||
126 | // write key to disk | ||
127 | //FILE* f = fopen("/tmp/vk1", "w"); | ||
128 | //fwrite(buf, vksize, 1, f); | ||
129 | //fclose(f); | ||
130 | |||
131 | //zklaim_verification_key_deserialize(ctx2, buf, vksize); | ||
132 | |||
133 | //free(buf); | ||
134 | |||
135 | //size_t pksize = zklaim_proving_key_serialize(ctx, &buf); | ||
136 | //printf("serialized pk size: %.2fMB\n", ((float) pksize)/1000/1000); | ||
137 | |||
138 | //zklaim_proving_key_deserialize(ctx, buf, pksize); | ||
139 | |||
140 | //zklaim_print(ctx); | ||
141 | |||
142 | //zklaim_ctx_sign(ctx, priv); | ||
143 | |||
144 | |||
145 | printf("-> signing context: %s\n", zklaim_ctx_sign(ctx, priv) ? "failed" : "passed"); | ||
146 | |||
147 | unsigned char* ctx_issuer; | ||
148 | |||
149 | printf("\n[ISSUER] serializing context\n"); | ||
150 | size_t len = zklaim_ctx_serialize(ctx, &ctx_issuer); | ||
151 | |||
152 | /* | ||
153 | * - 4 - | ||
154 | * generate proof | ||
155 | */ | ||
156 | |||
157 | //printf("\n-> signing context: %s\n", zklaim_ctx_sign(ctx, priv) ? "failed" : "passed"); | ||
158 | |||
159 | //unsigned char* proof; | ||
160 | //size_t proof_size = zklaim_proof_serialize(ctx, &proof); | ||
161 | //printf("serialized proof size: %zuB\n", proof_size); | ||
162 | |||
163 | //zklaim_proof* zkproof_imported; | ||
164 | |||
165 | //zklaim_proof_deserialize(ctx, proof, proof_size); | ||
166 | |||
167 | printf("===========================================================================\n"); | ||
168 | printf("===========================================================================\n"); | ||
169 | printf("============================== PROVER =====================================\n"); | ||
170 | printf("===========================================================================\n"); | ||
171 | printf("===========================================================================\n"); | ||
172 | |||
173 | |||
174 | zklaim_ctx* ctx_prover = zklaim_context_new(); | ||
175 | printf("\n[PROVER] deserializing context\n"); | ||
176 | printf("-> deserialisation status: %s\n\n", zklaim_ctx_deserialize(ctx_prover, ctx_issuer, len) ? "failed" : "passed"); | ||
177 | |||
178 | zklaim_print(ctx_prover); | ||
179 | |||
180 | ctx_prover->pk = ctx->pk; | ||
181 | |||
182 | int res = zklaim_ctx_verify(ctx_prover); | ||
183 | printf("[PROVER] verification result: %d %s\n", res, (res ? "failed" : "passed")); | ||
184 | printf(" ^--- failure with code 3 (ZKLAIM_INVALID_PROOF) is ok for the prover, as signature passes, but (non-existing) proof fails\n\n"); | ||
185 | |||
186 | printf("[PROVER] resetting operations and reference values to create taylored proof\n"); | ||
187 | printf("[PROVER] generating proof\n"); | ||
188 | |||
189 | ctx_prover->pk = (unsigned char*) calloc(1, ctx->pk_size); | ||
190 | ctx_prover->pk_size = ctx->pk_size; | ||
191 | memcpy(ctx_prover->pk, ctx->pk, ctx_prover->pk_size); | ||
192 | |||
193 | // set custom prover reference values here: | ||
194 | ctx_prover->pl_ctx_head->pl.data0_ref = 20; | ||
195 | /* ctx_prover->pl_ctx_head->next->pl.data0_ref = 30; */ | ||
196 | /* ctx_prover->pl_ctx_head->next->pl.data0_op = zklaim_less_or_eq; */ | ||
197 | //ctx_prover->pl_ctx_head->pl.data0_op = zklaim_less; | ||
198 | ctx_prover->pl_ctx_head->pl.data4_ref = 0; | ||
199 | ctx_prover->pl_ctx_head->pl.data4_op = zklaim_noop; | ||
200 | |||
201 | ctx_prover->pl_ctx_head->pl.data1_ref = 0; | ||
202 | ctx_prover->pl_ctx_head->pl.data1_op = zklaim_noop; | ||
203 | |||
204 | ctx_prover->pl_ctx_head->pl.data2_ref = 0; | ||
205 | ctx_prover->pl_ctx_head->pl.data2_op = zklaim_noop; | ||
206 | |||
207 | ctx_prover->pl_ctx_head->pl.data3_ref = 0; | ||
208 | ctx_prover->pl_ctx_head->pl.data3_op = zklaim_noop; | ||
209 | |||
210 | zklaim_print(ctx_prover); | ||
211 | |||
212 | printf("-> proof generation status: %s\n\n", (zklaim_proof_generate(ctx_prover) ? "failed" : "passed")); | ||
213 | |||
214 | |||
215 | printf("[PROVER] blinding attributes\n"); | ||
216 | zklaim_clear_pres(ctx_prover); | ||
217 | |||
218 | |||
219 | printf("[PROVER] serializing context\n\n"); | ||
220 | |||
221 | unsigned char *ctx_prover_buf; | ||
222 | len = zklaim_ctx_serialize(ctx_prover, &ctx_prover_buf); | ||
223 | |||
224 | /* | ||
225 | * - 5 - | ||
226 | * verify proof | ||
227 | */ | ||
228 | printf("===========================================================================\n"); | ||
229 | printf("===========================================================================\n"); | ||
230 | printf("============================= VERIFIER ====================================\n"); | ||
231 | printf("===========================================================================\n"); | ||
232 | printf("===========================================================================\n"); | ||
233 | |||
234 | zklaim_ctx* ctx_verifier = zklaim_context_new(); | ||
235 | printf("\n[VERIFIER] deserializing context\n"); | ||
236 | printf("-> deserialisation status: %s\n\n", zklaim_ctx_deserialize(ctx_verifier, ctx_prover_buf, len) ? "failed" : "passed"); | ||
237 | printf("[VERIFIER] verifying proof and context\n"); | ||
238 | res = zklaim_ctx_verify(ctx_verifier); | ||
239 | printf("verification result: %d %s\n\n", res, (res ? "failed" : "passed")); | ||
240 | |||
241 | zklaim_print(ctx_verifier); | ||
242 | |||
243 | free(ctx_prover_buf); | ||
244 | free(ctx_issuer); | ||
245 | zklaim_ctx_free(ctx); | ||
246 | gcry_sexp_release(priv); | ||
247 | gcry_sexp_release(pub); | ||
248 | zklaim_ctx_free(ctx_prover); | ||
249 | zklaim_ctx_free(ctx_verifier); | ||
64 | 250 | ||
65 | int | 251 | return ZKLAIM_OK; |
66 | GNUNET_ZKLAIM_add_payload (struct GNUNET_ZKLAIM_Context *ctx, | ||
67 | struct GNUNET_ZKLAIM_Payload *pl) | ||
68 | { | ||
69 | zklaim_add_pl (ctx->ctx, pl->pl); | ||
70 | return GNUNET_OK; | ||
71 | } | 252 | } |
72 | 253 | ||
73 | int | 254 | int main() { |
74 | GNUNET_ZKLAIM_finalize (struct GNUNET_ZKLAIM_Context *ctx) | 255 | return worker(); |
75 | { | ||
76 | zklaim_hash_ctx (ctx->ctx); | ||
77 | zklaim_ctx_sign (ctx->ctx, ctx->priv); | ||
78 | return 1; | ||
79 | } | 256 | } |