diff options
author | jospaeth <spaethj@in.tum.de> | 2020-08-10 18:45:30 +0200 |
---|---|---|
committer | jospaeth <spaethj@in.tum.de> | 2020-08-10 18:45:30 +0200 |
commit | f2fb911d529db3787b15e39b8a41e081ea626e41 (patch) | |
tree | 606d866cc25a4b8b4bb6deead07bc6282df16b94 /src | |
parent | b2ebdaca4d0d3a4f1fac2f2f83cdedf4123a43b8 (diff) | |
download | gnunet-f2fb911d529db3787b15e39b8a41e081ea626e41.tar.gz gnunet-f2fb911d529db3787b15e39b8a41e081ea626e41.zip |
continue start_gns_escrow, add user secret string
Diffstat (limited to 'src')
-rw-r--r-- | src/escrow/escrow_api.c | 8 | ||||
-rw-r--r-- | src/escrow/gnunet-escrow.c | 20 | ||||
-rw-r--r-- | src/escrow/plugin_escrow_anastasis.c | 2 | ||||
-rw-r--r-- | src/escrow/plugin_escrow_gns.c | 168 | ||||
-rw-r--r-- | src/escrow/plugin_escrow_plaintext.c | 2 | ||||
-rw-r--r-- | src/include/gnunet_escrow_lib.h | 14 | ||||
-rw-r--r-- | src/include/gnunet_escrow_plugin.h | 2 |
7 files changed, 183 insertions, 33 deletions
diff --git a/src/escrow/escrow_api.c b/src/escrow/escrow_api.c index acf17c500..26a11ca18 100644 --- a/src/escrow/escrow_api.c +++ b/src/escrow/escrow_api.c | |||
@@ -231,6 +231,7 @@ handle_start_escrow_result (void *cls) | |||
231 | * | 231 | * |
232 | * @param h the handle for the escrow component | 232 | * @param h the handle for the escrow component |
233 | * @param ego the identity ego to put in escrow | 233 | * @param ego the identity ego to put in escrow |
234 | * @param userSecret the user secret (e.g. for derivation of escrow identities) | ||
234 | * @param method the escrow method to use | 235 | * @param method the escrow method to use |
235 | * @param cb function to call with the escrow anchor on completion | 236 | * @param cb function to call with the escrow anchor on completion |
236 | * @param cb_cls closure for @a cb | 237 | * @param cb_cls closure for @a cb |
@@ -240,6 +241,7 @@ handle_start_escrow_result (void *cls) | |||
240 | struct GNUNET_ESCROW_Operation * | 241 | struct GNUNET_ESCROW_Operation * |
241 | GNUNET_ESCROW_put (struct GNUNET_ESCROW_Handle *h, | 242 | GNUNET_ESCROW_put (struct GNUNET_ESCROW_Handle *h, |
242 | struct GNUNET_IDENTITY_Ego *ego, | 243 | struct GNUNET_IDENTITY_Ego *ego, |
244 | char *userSecret, | ||
243 | enum GNUNET_ESCROW_Key_Escrow_Method method, | 245 | enum GNUNET_ESCROW_Key_Escrow_Method method, |
244 | GNUNET_ESCROW_AnchorContinuation cb, | 246 | GNUNET_ESCROW_AnchorContinuation cb, |
245 | void *cb_cls) | 247 | void *cb_cls) |
@@ -256,7 +258,11 @@ GNUNET_ESCROW_put (struct GNUNET_ESCROW_Handle *h, | |||
256 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 258 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
257 | 259 | ||
258 | api = init_plugin (h, method); | 260 | api = init_plugin (h, method); |
259 | op->plugin_op_wrap = api->start_key_escrow (h, ego, &handle_start_escrow_result, op->id); | 261 | op->plugin_op_wrap = api->start_key_escrow (h, |
262 | ego, | ||
263 | userSecret, | ||
264 | &handle_start_escrow_result, | ||
265 | op->id); | ||
260 | 266 | ||
261 | return op; | 267 | return op; |
262 | } | 268 | } |
diff --git a/src/escrow/gnunet-escrow.c b/src/escrow/gnunet-escrow.c index f8dc835a8..2eda19788 100644 --- a/src/escrow/gnunet-escrow.c +++ b/src/escrow/gnunet-escrow.c | |||
@@ -66,7 +66,7 @@ static char *verify_ego; | |||
66 | static char *get_ego; | 66 | static char *get_ego; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * -s option | 69 | * -S option |
70 | */ | 70 | */ |
71 | static char *status_ego; | 71 | static char *status_ego; |
72 | 72 | ||
@@ -76,6 +76,11 @@ static char *status_ego; | |||
76 | struct GNUNET_IDENTITY_Ego *ego; | 76 | struct GNUNET_IDENTITY_Ego *ego; |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * User secret string | ||
80 | */ | ||
81 | static char *user_secret_string; | ||
82 | |||
83 | /** | ||
79 | * Anchor string | 84 | * Anchor string |
80 | */ | 85 | */ |
81 | static char *anchor_string; | 86 | static char *anchor_string; |
@@ -142,6 +147,11 @@ do_cleanup (void *cls) | |||
142 | GNUNET_free (method_name); | 147 | GNUNET_free (method_name); |
143 | method_name = NULL; | 148 | method_name = NULL; |
144 | } | 149 | } |
150 | if (NULL != user_secret_string) | ||
151 | { | ||
152 | GNUNET_free (user_secret_string); | ||
153 | user_secret_string = NULL; | ||
154 | } | ||
145 | if (NULL != anchor_string) | 155 | if (NULL != anchor_string) |
146 | { | 156 | { |
147 | GNUNET_free (anchor_string); | 157 | GNUNET_free (anchor_string); |
@@ -260,6 +270,7 @@ start_process () | |||
260 | } | 270 | } |
261 | escrow_op = GNUNET_ESCROW_put (escrow_handle, | 271 | escrow_op = GNUNET_ESCROW_put (escrow_handle, |
262 | ego, | 272 | ego, |
273 | user_secret_string, | ||
263 | method, | 274 | method, |
264 | &put_cb, | 275 | &put_cb, |
265 | NULL); | 276 | NULL); |
@@ -480,10 +491,15 @@ main (int argc, char *const argv[]) | |||
480 | "NAME", | 491 | "NAME", |
481 | gettext_noop ("Get the status of the escrow of ego NAME"), | 492 | gettext_noop ("Get the status of the escrow of ego NAME"), |
482 | &status_ego), | 493 | &status_ego), |
494 | GNUNET_GETOPT_option_string ('u', | ||
495 | "userSecret", | ||
496 | "USER_SECRET", | ||
497 | gettext_noop ("The user secret string"), | ||
498 | &user_secret_string), | ||
483 | GNUNET_GETOPT_option_string ('a', | 499 | GNUNET_GETOPT_option_string ('a', |
484 | "anchor", | 500 | "anchor", |
485 | "ANCHOR", | 501 | "ANCHOR", |
486 | gettext_noop ("The the escrow anchor"), | 502 | gettext_noop ("The escrow anchor"), |
487 | &anchor_string), | 503 | &anchor_string), |
488 | GNUNET_GETOPT_option_string ('m', | 504 | GNUNET_GETOPT_option_string ('m', |
489 | "method", | 505 | "method", |
diff --git a/src/escrow/plugin_escrow_anastasis.c b/src/escrow/plugin_escrow_anastasis.c index 92fc75ae6..495ce7089 100644 --- a/src/escrow/plugin_escrow_anastasis.c +++ b/src/escrow/plugin_escrow_anastasis.c | |||
@@ -47,6 +47,7 @@ struct ESCROW_PluginHandle ph; | |||
47 | * | 47 | * |
48 | * @param h the handle for the escrow component | 48 | * @param h the handle for the escrow component |
49 | * @param ego the identity ego containing the private key | 49 | * @param ego the identity ego containing the private key |
50 | * @param userSecret the user secret (e.g. for derivation of escrow identities) | ||
50 | * @param cb the function called upon completion | 51 | * @param cb the function called upon completion |
51 | * @param op_id unique ID of the respective ESCROW_Operation | 52 | * @param op_id unique ID of the respective ESCROW_Operation |
52 | * | 53 | * |
@@ -55,6 +56,7 @@ struct ESCROW_PluginHandle ph; | |||
55 | struct ESCROW_PluginOperationWrapper * | 56 | struct ESCROW_PluginOperationWrapper * |
56 | start_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h, | 57 | start_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h, |
57 | struct GNUNET_IDENTITY_Ego *ego, | 58 | struct GNUNET_IDENTITY_Ego *ego, |
59 | char *userSecret, | ||
58 | GNUNET_SCHEDULER_TaskCallback cb, | 60 | GNUNET_SCHEDULER_TaskCallback cb, |
59 | uint32_t op_id) | 61 | uint32_t op_id) |
60 | { | 62 | { |
diff --git a/src/escrow/plugin_escrow_gns.c b/src/escrow/plugin_escrow_gns.c index 8859275c6..2d3343389 100644 --- a/src/escrow/plugin_escrow_gns.c +++ b/src/escrow/plugin_escrow_gns.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "gnunet_escrow_plugin.h" | 30 | #include "gnunet_escrow_plugin.h" |
31 | #include "escrow_plugin_helper.h" | 31 | #include "escrow_plugin_helper.h" |
32 | #include "gnunet_namestore_service.h" | 32 | #include "gnunet_namestore_service.h" |
33 | #include "gnunet_gnsrecord_lib.h" | ||
33 | #include "../identity/identity.h" | 34 | #include "../identity/identity.h" |
34 | #include <sss.h> | 35 | #include <sss.h> |
35 | #include <inttypes.h> | 36 | #include <inttypes.h> |
@@ -75,6 +76,30 @@ struct PkEntry | |||
75 | * private key | 76 | * private key |
76 | */ | 77 | */ |
77 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; | 78 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; |
79 | |||
80 | /** | ||
81 | * index of the respective share | ||
82 | */ | ||
83 | uint8_t i; | ||
84 | }; | ||
85 | |||
86 | |||
87 | struct NamestoreQueueEntry | ||
88 | { | ||
89 | /** | ||
90 | * DLL | ||
91 | */ | ||
92 | struct NamestoreQueueEntry *prev; | ||
93 | |||
94 | /** | ||
95 | * DLL | ||
96 | */ | ||
97 | struct NamestoreQueueEntry *next; | ||
98 | |||
99 | /** | ||
100 | * Namestore queue entry | ||
101 | */ | ||
102 | struct GNUNET_NAMESTORE_QueueEntry *ns_qe; | ||
78 | }; | 103 | }; |
79 | 104 | ||
80 | 105 | ||
@@ -137,6 +162,11 @@ struct ESCROW_GnsPluginOperation | |||
137 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; | 162 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; |
138 | 163 | ||
139 | /** | 164 | /** |
165 | * User secret string | ||
166 | */ | ||
167 | char *userSecret; | ||
168 | |||
169 | /** | ||
140 | * DLL head for identity operations | 170 | * DLL head for identity operations |
141 | */ | 171 | */ |
142 | struct IdentityOperationEntry *id_ops_head; | 172 | struct IdentityOperationEntry *id_ops_head; |
@@ -155,6 +185,16 @@ struct ESCROW_GnsPluginOperation | |||
155 | * DLL tail for escrow private keys | 185 | * DLL tail for escrow private keys |
156 | */ | 186 | */ |
157 | struct PkEntry *escrow_pks_tail; | 187 | struct PkEntry *escrow_pks_tail; |
188 | |||
189 | /** | ||
190 | * DLL head for namestore queue entries | ||
191 | */ | ||
192 | struct NamestoreQueueEntry *ns_qes_head; | ||
193 | |||
194 | /** | ||
195 | * DLL tail for namestore queue entries | ||
196 | */ | ||
197 | struct NamestoreQueueEntry *ns_qes_tail; | ||
158 | }; | 198 | }; |
159 | 199 | ||
160 | /** | 200 | /** |
@@ -178,6 +218,7 @@ cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) | |||
178 | struct ESCROW_GnsPluginOperation *p_op; | 218 | struct ESCROW_GnsPluginOperation *p_op; |
179 | struct IdentityOperationEntry *curr_id_op; | 219 | struct IdentityOperationEntry *curr_id_op; |
180 | struct PkEntry *curr_pk; | 220 | struct PkEntry *curr_pk; |
221 | struct NamestoreQueueEntry *curr_ns_qe; | ||
181 | 222 | ||
182 | p_op = (struct ESCROW_GnsPluginOperation*)plugin_op_wrap->plugin_op; | 223 | p_op = (struct ESCROW_GnsPluginOperation*)plugin_op_wrap->plugin_op; |
183 | 224 | ||
@@ -190,6 +231,8 @@ cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) | |||
190 | GNUNET_free (p_op->ego_wrap); | 231 | GNUNET_free (p_op->ego_wrap); |
191 | if (NULL != p_op->verify_wrap) | 232 | if (NULL != p_op->verify_wrap) |
192 | GNUNET_free (p_op->verify_wrap); | 233 | GNUNET_free (p_op->verify_wrap); |
234 | if (NULL != p_op->userSecret) | ||
235 | GNUNET_free (p_op->userSecret); | ||
193 | /* clean up identity operation list */ | 236 | /* clean up identity operation list */ |
194 | for (curr_id_op = p_op->id_ops_head; NULL != curr_id_op; curr_id_op = curr_id_op->next) | 237 | for (curr_id_op = p_op->id_ops_head; NULL != curr_id_op; curr_id_op = curr_id_op->next) |
195 | { | 238 | { |
@@ -208,6 +251,16 @@ cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) | |||
208 | curr_pk); | 251 | curr_pk); |
209 | GNUNET_free (curr_pk); | 252 | GNUNET_free (curr_pk); |
210 | } | 253 | } |
254 | /* clean up namestore operation list */ | ||
255 | for (curr_ns_qe = p_op->ns_qes_head; NULL != curr_ns_qe; curr_ns_qe = curr_ns_qe->next) | ||
256 | { | ||
257 | GNUNET_CONTAINER_DLL_remove (p_op->ns_qes_head, | ||
258 | p_op->ns_qes_tail, | ||
259 | curr_ns_qe); | ||
260 | // also frees the curr_ns_qe->ns_qe | ||
261 | GNUNET_NAMESTORE_cancel (curr_ns_qe->ns_qe); | ||
262 | GNUNET_free (curr_ns_qe); | ||
263 | } | ||
211 | /* disconnect from namestore service */ | 264 | /* disconnect from namestore service */ |
212 | GNUNET_NAMESTORE_disconnect (p_op->ns_h); | 265 | GNUNET_NAMESTORE_disconnect (p_op->ns_h); |
213 | GNUNET_free (p_op); | 266 | GNUNET_free (p_op); |
@@ -243,29 +296,92 @@ split_private_key (struct ESCROW_GnsPluginOperation *p_op) | |||
243 | } | 296 | } |
244 | 297 | ||
245 | 298 | ||
246 | void | 299 | static void |
247 | distribute_keyshares (struct ESCROW_GnsPluginOperation *p_op, | 300 | keyshare_distribution_finished (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) |
301 | { | ||
302 | struct ESCROW_GnsPluginOperation *p_op; | ||
303 | struct GNUNET_ESCROW_Anchor *anchor; | ||
304 | int anchorDataSize; | ||
305 | |||
306 | p_op = (struct ESCROW_GnsPluginOperation *)plugin_op_wrap->plugin_op; | ||
307 | |||
308 | // TODO: implement | ||
309 | anchorDataSize = 0; // TODO! | ||
310 | anchor = GNUNET_malloc (sizeof (struct GNUNET_ESCROW_Anchor) + anchorDataSize); | ||
311 | |||
312 | p_op->anchor_wrap->escrowAnchor = anchor; | ||
313 | |||
314 | /* call the continuation */ | ||
315 | start_cont (plugin_op_wrap); | ||
316 | } | ||
317 | |||
318 | |||
319 | static void | ||
320 | keyshare_distributed (void *cls, | ||
321 | int32_t success, | ||
322 | const char *emsg) | ||
323 | { | ||
324 | struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls; | ||
325 | struct ESCROW_GnsPluginOperation *p_op; | ||
326 | |||
327 | p_op = (struct ESCROW_GnsPluginOperation *)plugin_op_wrap->plugin_op; | ||
328 | |||
329 | if (GNUNET_SYSERR == success) | ||
330 | { | ||
331 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
332 | "Failed to store keyshare %s\n", | ||
333 | emsg); | ||
334 | p_op->anchor_wrap->escrowAnchor = NULL; | ||
335 | p_op->cont (p_op->anchor_wrap); | ||
336 | // this also cancels all running namestore operations | ||
337 | cleanup_plugin_operation (plugin_op_wrap); | ||
338 | } | ||
339 | |||
340 | // TODO: remove qe from list, check if all namestore operations are finished | ||
341 | keyshare_distribution_finished (plugin_op_wrap); | ||
342 | } | ||
343 | |||
344 | |||
345 | static int | ||
346 | distribute_keyshares (struct ESCROW_PluginOperationWrapper *plugin_op_wrap, | ||
248 | sss_Keyshare *keyshares) | 347 | sss_Keyshare *keyshares) |
249 | { | 348 | { |
349 | struct ESCROW_GnsPluginOperation *p_op; | ||
250 | struct GNUNET_NAMESTORE_Handle *ns_h; | 350 | struct GNUNET_NAMESTORE_Handle *ns_h; |
351 | struct NamestoreQueueEntry *curr_ns_qe; | ||
251 | struct PkEntry *curr_pk; | 352 | struct PkEntry *curr_pk; |
252 | char *curr_label; | 353 | char *curr_label; |
354 | struct GNUNET_GNSRECORD_Data curr_rd[1]; | ||
355 | |||
356 | p_op = (struct ESCROW_GnsPluginOperation *)plugin_op_wrap->plugin_op; | ||
253 | 357 | ||
254 | ns_h = GNUNET_NAMESTORE_connect (p_op->h->cfg); | 358 | ns_h = GNUNET_NAMESTORE_connect (p_op->h->cfg); |
255 | p_op->ns_h = ns_h; | 359 | p_op->ns_h = ns_h; |
256 | 360 | ||
257 | for (curr_pk = p_op->escrow_pks_head; NULL != curr_pk; curr_pk = curr_pk->next) | 361 | for (curr_pk = p_op->escrow_pks_head; NULL != curr_pk; curr_pk = curr_pk->next) |
258 | { | 362 | { |
259 | // TODO: implement | 363 | curr_label = NULL; // TODO: which label |
260 | curr_label = NULL; | 364 | curr_ns_qe = GNUNET_new (struct NamestoreQueueEntry); |
261 | GNUNET_NAMESTORE_records_store (ns_h, | 365 | |
262 | curr_pk->pk, | 366 | curr_rd[0].data_size = sizeof (sss_Keyshare); |
263 | curr_label, | 367 | curr_rd[0].data = keyshares[curr_pk->i]; |
264 | 0, | 368 | curr_rd[0].record_type = GNUNET_GNSRECORD_TYPE_ATTRIBUTE; // TODO: type |
265 | NULL, | 369 | curr_rd[0].flags = GNUNET_GNSRECORD_RF_NONE; // TODO: flags |
266 | NULL, | 370 | curr_rd[0].expiration_time = 0; // TODO: expiration time |
267 | NULL); | 371 | |
372 | curr_ns_qe->ns_qe = GNUNET_NAMESTORE_records_store (ns_h, | ||
373 | curr_pk->pk, | ||
374 | curr_label, | ||
375 | 1, | ||
376 | curr_rd, | ||
377 | &keyshare_distributed, | ||
378 | plugin_op_wrap); | ||
379 | GNUNET_CONTAINER_DLL_insert_tail (p_op->ns_qes_head, | ||
380 | p_op->ns_qes_tail, | ||
381 | curr_ns_qe); | ||
268 | } | 382 | } |
383 | |||
384 | return GNUNET_OK; | ||
269 | } | 385 | } |
270 | 386 | ||
271 | 387 | ||
@@ -274,8 +390,6 @@ escrow_ids_finished (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) | |||
274 | { | 390 | { |
275 | struct ESCROW_GnsPluginOperation *p_op; | 391 | struct ESCROW_GnsPluginOperation *p_op; |
276 | sss_Keyshare *keyshares; | 392 | sss_Keyshare *keyshares; |
277 | struct GNUNET_ESCROW_Anchor *anchor; | ||
278 | int anchorDataSize; | ||
279 | 393 | ||
280 | p_op = (struct ESCROW_GnsPluginOperation *)plugin_op_wrap->plugin_op; | 394 | p_op = (struct ESCROW_GnsPluginOperation *)plugin_op_wrap->plugin_op; |
281 | 395 | ||
@@ -284,22 +398,20 @@ escrow_ids_finished (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) | |||
284 | if (NULL == keyshares) | 398 | if (NULL == keyshares) |
285 | { | 399 | { |
286 | p_op->anchor_wrap->escrowAnchor = NULL; | 400 | p_op->anchor_wrap->escrowAnchor = NULL; |
287 | p_op->sched_task = GNUNET_SCHEDULER_add_now (&start_cont, p_op); | 401 | start_cont (plugin_op_wrap); |
288 | return; | 402 | return; |
289 | } | 403 | } |
290 | 404 | ||
291 | /* distribute the shares to the identities */ | 405 | /* distribute the shares to the identities */ |
292 | distribute_keyshares (p_op, keyshares); | 406 | if (GNUNET_OK != distribute_keyshares (plugin_op_wrap, keyshares)) |
293 | 407 | { | |
294 | // TODO: implement | 408 | p_op->anchor_wrap->escrowAnchor = NULL; |
295 | anchorDataSize = 0; // TODO! | 409 | start_cont (plugin_op_wrap); |
296 | anchor = GNUNET_malloc (sizeof (struct GNUNET_ESCROW_Anchor) + anchorDataSize); | 410 | return; |
411 | } | ||
297 | 412 | ||
298 | p_op->anchor_wrap->escrowAnchor = anchor; | 413 | /* operation continues in keyshare_distribution_finished |
299 | 414 | after all keyshares have been distributed */ | |
300 | /* call the continuation */ | ||
301 | p_op->cont (p_op->anchor_wrap); | ||
302 | cleanup_plugin_operation (plugin_op_wrap); | ||
303 | } | 415 | } |
304 | 416 | ||
305 | 417 | ||
@@ -448,7 +560,7 @@ create_escrow_identities (struct ESCROW_PluginOperationWrapper *plugin_op_wrap, | |||
448 | 560 | ||
449 | for (uint8_t i = 0; i < p_op->shares; i++) | 561 | for (uint8_t i = 0; i < p_op->shares; i++) |
450 | { | 562 | { |
451 | curr_pk = derive_private_key (name, NULL, i); // TODO: password | 563 | curr_pk = derive_private_key (name, p_op->userSecret, i); |
452 | curr_name = get_escrow_id_name (name, i); | 564 | curr_name = get_escrow_id_name (name, i); |
453 | 565 | ||
454 | // check if the escrow identity already exists | 566 | // check if the escrow identity already exists |
@@ -466,6 +578,7 @@ create_escrow_identities (struct ESCROW_PluginOperationWrapper *plugin_op_wrap, | |||
466 | // the escrow id already exists, so insert the pk into our list | 578 | // the escrow id already exists, so insert the pk into our list |
467 | curr_pk_entry = GNUNET_new (struct PkEntry); | 579 | curr_pk_entry = GNUNET_new (struct PkEntry); |
468 | curr_pk_entry->pk = curr_pk; | 580 | curr_pk_entry->pk = curr_pk; |
581 | curr_pk_entry->i = i; | ||
469 | GNUNET_CONTAINER_DLL_insert (p_op->escrow_pks_head, | 582 | GNUNET_CONTAINER_DLL_insert (p_op->escrow_pks_head, |
470 | p_op->escrow_pks_tail, | 583 | p_op->escrow_pks_tail, |
471 | curr_pk_entry); | 584 | curr_pk_entry); |
@@ -493,6 +606,7 @@ create_escrow_identities (struct ESCROW_PluginOperationWrapper *plugin_op_wrap, | |||
493 | * | 606 | * |
494 | * @param h the handle for the escrow component | 607 | * @param h the handle for the escrow component |
495 | * @param ego the identity ego containing the private key | 608 | * @param ego the identity ego containing the private key |
609 | * @param userSecret the user secret (e.g. for derivation of escrow identities) | ||
496 | * @param cb the function called upon completion | 610 | * @param cb the function called upon completion |
497 | * @param op_id unique ID of the respective ESCROW_Operation | 611 | * @param op_id unique ID of the respective ESCROW_Operation |
498 | * | 612 | * |
@@ -501,6 +615,7 @@ create_escrow_identities (struct ESCROW_PluginOperationWrapper *plugin_op_wrap, | |||
501 | struct ESCROW_PluginOperationWrapper * | 615 | struct ESCROW_PluginOperationWrapper * |
502 | start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, | 616 | start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, |
503 | struct GNUNET_IDENTITY_Ego *ego, | 617 | struct GNUNET_IDENTITY_Ego *ego, |
618 | char *userSecret, | ||
504 | GNUNET_SCHEDULER_TaskCallback cb, | 619 | GNUNET_SCHEDULER_TaskCallback cb, |
505 | uint32_t op_id) | 620 | uint32_t op_id) |
506 | { | 621 | { |
@@ -525,13 +640,14 @@ start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
525 | w->op_id = op_id; | 640 | w->op_id = op_id; |
526 | p_op->anchor_wrap = w; | 641 | p_op->anchor_wrap = w; |
527 | 642 | ||
528 | if (NULL == ego) | 643 | if (NULL == ego || NULL == userSecret) |
529 | { | 644 | { |
530 | w->escrowAnchor = NULL; | 645 | w->escrowAnchor = NULL; |
531 | p_op->sched_task = GNUNET_SCHEDULER_add_now (&start_cont, plugin_op_wrap); | 646 | p_op->sched_task = GNUNET_SCHEDULER_add_now (&start_cont, plugin_op_wrap); |
532 | return plugin_op_wrap; | 647 | return plugin_op_wrap; |
533 | } | 648 | } |
534 | p_op->pk = GNUNET_IDENTITY_ego_get_private_key (ego); | 649 | p_op->pk = GNUNET_IDENTITY_ego_get_private_key (ego); |
650 | p_op->userSecret = userSecret; | ||
535 | 651 | ||
536 | // get config | 652 | // get config |
537 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (h->cfg, | 653 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (h->cfg, |
diff --git a/src/escrow/plugin_escrow_plaintext.c b/src/escrow/plugin_escrow_plaintext.c index 9406361d7..390ba901e 100644 --- a/src/escrow/plugin_escrow_plaintext.c +++ b/src/escrow/plugin_escrow_plaintext.c | |||
@@ -132,6 +132,7 @@ start_cont (void *cls) | |||
132 | * | 132 | * |
133 | * @param h the handle for the escrow component | 133 | * @param h the handle for the escrow component |
134 | * @param ego the identity ego containing the private key | 134 | * @param ego the identity ego containing the private key |
135 | * @param userSecret the user secret (e.g. for derivation of escrow identities) | ||
135 | * @param cb the function called upon completion | 136 | * @param cb the function called upon completion |
136 | * @param op_id unique ID of the respective ESCROW_Operation | 137 | * @param op_id unique ID of the respective ESCROW_Operation |
137 | * | 138 | * |
@@ -140,6 +141,7 @@ start_cont (void *cls) | |||
140 | struct ESCROW_PluginOperationWrapper * | 141 | struct ESCROW_PluginOperationWrapper * |
141 | start_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, | 142 | start_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, |
142 | struct GNUNET_IDENTITY_Ego *ego, | 143 | struct GNUNET_IDENTITY_Ego *ego, |
144 | char *userSecret, | ||
143 | ESCROW_Plugin_Continuation cb, | 145 | ESCROW_Plugin_Continuation cb, |
144 | uint32_t op_id) | 146 | uint32_t op_id) |
145 | { | 147 | { |
diff --git a/src/include/gnunet_escrow_lib.h b/src/include/gnunet_escrow_lib.h index 07321c9e2..dcd5a15be 100644 --- a/src/include/gnunet_escrow_lib.h +++ b/src/include/gnunet_escrow_lib.h | |||
@@ -44,7 +44,8 @@ extern "C" { | |||
44 | /** | 44 | /** |
45 | * Enum for the different key escrow methods | 45 | * Enum for the different key escrow methods |
46 | */ | 46 | */ |
47 | enum GNUNET_ESCROW_Key_Escrow_Method { | 47 | enum GNUNET_ESCROW_Key_Escrow_Method |
48 | { | ||
48 | GNUNET_ESCROW_KEY_NONE, // error value | 49 | GNUNET_ESCROW_KEY_NONE, // error value |
49 | GNUNET_ESCROW_KEY_PLAINTEXT, | 50 | GNUNET_ESCROW_KEY_PLAINTEXT, |
50 | GNUNET_ESCROW_KEY_GNS, | 51 | GNUNET_ESCROW_KEY_GNS, |
@@ -55,7 +56,8 @@ enum GNUNET_ESCROW_Key_Escrow_Method { | |||
55 | /** | 56 | /** |
56 | * Enum for the different verification results | 57 | * Enum for the different verification results |
57 | */ | 58 | */ |
58 | enum GNUNET_ESCROW_Verification_Result { | 59 | enum GNUNET_ESCROW_Verification_Result |
60 | { | ||
59 | GNUNET_ESCROW_VALID, | 61 | GNUNET_ESCROW_VALID, |
60 | GNUNET_ESCROW_INVALID | 62 | GNUNET_ESCROW_INVALID |
61 | }; | 63 | }; |
@@ -64,7 +66,8 @@ enum GNUNET_ESCROW_Verification_Result { | |||
64 | /** | 66 | /** |
65 | * Struct for the escrow anchor | 67 | * Struct for the escrow anchor |
66 | */ | 68 | */ |
67 | struct GNUNET_ESCROW_Anchor { | 69 | struct GNUNET_ESCROW_Anchor |
70 | { | ||
68 | /** | 71 | /** |
69 | * The escrow method. | 72 | * The escrow method. |
70 | */ | 73 | */ |
@@ -80,7 +83,8 @@ struct GNUNET_ESCROW_Anchor { | |||
80 | /** | 83 | /** |
81 | * Struct for the escrow status | 84 | * Struct for the escrow status |
82 | */ | 85 | */ |
83 | struct GNUNET_ESCROW_Status { | 86 | struct GNUNET_ESCROW_Status |
87 | { | ||
84 | /** | 88 | /** |
85 | * The time of the last successful escrow. | 89 | * The time of the last successful escrow. |
86 | */ | 90 | */ |
@@ -270,6 +274,7 @@ GNUNET_ESCROW_fini ( | |||
270 | * | 274 | * |
271 | * @param h the handle for the escrow component | 275 | * @param h the handle for the escrow component |
272 | * @param ego the identity ego to put in escrow | 276 | * @param ego the identity ego to put in escrow |
277 | * @param userSecret the user secret (e.g. for derivation of escrow identities) | ||
273 | * @param method the escrow method to use | 278 | * @param method the escrow method to use |
274 | * @param cb function to call with the escrow anchor on completion | 279 | * @param cb function to call with the escrow anchor on completion |
275 | * @param cb_cls closure for @a cb | 280 | * @param cb_cls closure for @a cb |
@@ -280,6 +285,7 @@ struct GNUNET_ESCROW_Operation * | |||
280 | GNUNET_ESCROW_put ( | 285 | GNUNET_ESCROW_put ( |
281 | struct GNUNET_ESCROW_Handle *h, | 286 | struct GNUNET_ESCROW_Handle *h, |
282 | struct GNUNET_IDENTITY_Ego *ego, | 287 | struct GNUNET_IDENTITY_Ego *ego, |
288 | char *userSecret, | ||
283 | enum GNUNET_ESCROW_Key_Escrow_Method method, | 289 | enum GNUNET_ESCROW_Key_Escrow_Method method, |
284 | GNUNET_ESCROW_AnchorContinuation cb, | 290 | GNUNET_ESCROW_AnchorContinuation cb, |
285 | void *cb_cls); | 291 | void *cb_cls); |
diff --git a/src/include/gnunet_escrow_plugin.h b/src/include/gnunet_escrow_plugin.h index 85cc48b89..2d941b651 100644 --- a/src/include/gnunet_escrow_plugin.h +++ b/src/include/gnunet_escrow_plugin.h | |||
@@ -49,6 +49,7 @@ extern "C" { | |||
49 | * | 49 | * |
50 | * @param h the handle for the escrow component | 50 | * @param h the handle for the escrow component |
51 | * @param ego the identity ego containing the private key | 51 | * @param ego the identity ego containing the private key |
52 | * @param userSecret the user secret (e.g. for derivation of escrow identities) | ||
52 | * @param cb the function called upon completion | 53 | * @param cb the function called upon completion |
53 | * @param op_id unique ID of the respective ESCROW_Operation | 54 | * @param op_id unique ID of the respective ESCROW_Operation |
54 | * | 55 | * |
@@ -57,6 +58,7 @@ extern "C" { | |||
57 | typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_StartKeyEscrowFunction) ( | 58 | typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_StartKeyEscrowFunction) ( |
58 | struct GNUNET_ESCROW_Handle *h, | 59 | struct GNUNET_ESCROW_Handle *h, |
59 | struct GNUNET_IDENTITY_Ego *ego, | 60 | struct GNUNET_IDENTITY_Ego *ego, |
61 | char *userSecret, | ||
60 | GNUNET_SCHEDULER_TaskCallback cb, | 62 | GNUNET_SCHEDULER_TaskCallback cb, |
61 | uint32_t op_id); | 63 | uint32_t op_id); |
62 | 64 | ||