diff options
author | jospaeth <spaethj@in.tum.de> | 2020-08-03 17:50:14 +0200 |
---|---|---|
committer | jospaeth <spaethj@in.tum.de> | 2020-08-03 17:50:14 +0200 |
commit | aaf439f8ca0dfb6ae503e3e4f7545c98f4e43d5a (patch) | |
tree | b91c876d02bad573072c422896ba935dcb4ba666 /src | |
parent | 2822c5af3ef8f29ac2b5727ee3c13c6338852e58 (diff) | |
download | gnunet-aaf439f8ca0dfb6ae503e3e4f7545c98f4e43d5a.tar.gz gnunet-aaf439f8ca0dfb6ae503e3e4f7545c98f4e43d5a.zip |
minor fixes, test structure
Diffstat (limited to 'src')
-rw-r--r-- | src/escrow/escrow_api.c | 21 | ||||
-rw-r--r-- | src/escrow/gnunet-escrow.c | 15 | ||||
-rw-r--r-- | src/escrow/plugin_escrow_anastasis.c | 12 | ||||
-rw-r--r-- | src/escrow/plugin_escrow_gns.c | 111 | ||||
-rw-r--r-- | src/escrow/plugin_escrow_plaintext.c | 14 | ||||
-rw-r--r-- | src/escrow/test_escrow.sh | 25 | ||||
-rw-r--r-- | src/include/gnunet_escrow_lib.h | 17 | ||||
-rw-r--r-- | src/include/gnunet_escrow_plugin.h | 6 |
8 files changed, 146 insertions, 75 deletions
diff --git a/src/escrow/escrow_api.c b/src/escrow/escrow_api.c index 5be53e713..5b57f9244 100644 --- a/src/escrow/escrow_api.c +++ b/src/escrow/escrow_api.c | |||
@@ -178,7 +178,7 @@ GNUNET_ESCROW_fini (struct GNUNET_ESCROW_Handle *h) | |||
178 | void | 178 | void |
179 | handle_start_escrow_result (void *cls) | 179 | handle_start_escrow_result (void *cls) |
180 | { | 180 | { |
181 | struct GNUNET_ESCROW_Plugin_AnchorContinuationWrapper *w = cls; | 181 | struct ESCROW_Plugin_AnchorContinuationWrapper *w = cls; |
182 | struct GNUNET_ESCROW_Operation *op; | 182 | struct GNUNET_ESCROW_Operation *op; |
183 | 183 | ||
184 | for (op = w->h->op_head; NULL != op; op = op->next) | 184 | for (op = w->h->op_head; NULL != op; op = op->next) |
@@ -206,7 +206,6 @@ handle_start_escrow_result (void *cls) | |||
206 | * @param ego the identity ego to put in escrow | 206 | * @param ego the identity ego to put in escrow |
207 | * @param method the escrow method to use | 207 | * @param method the escrow method to use |
208 | * @param cb function to call with the escrow anchor on completion | 208 | * @param cb function to call with the escrow anchor on completion |
209 | * @param cb_cls closure for @a cb | ||
210 | * | 209 | * |
211 | * @return handle to abort the operation | 210 | * @return handle to abort the operation |
212 | */ | 211 | */ |
@@ -214,8 +213,7 @@ struct GNUNET_ESCROW_Operation * | |||
214 | GNUNET_ESCROW_put (struct GNUNET_ESCROW_Handle *h, | 213 | GNUNET_ESCROW_put (struct GNUNET_ESCROW_Handle *h, |
215 | const struct GNUNET_IDENTITY_Ego *ego, | 214 | const struct GNUNET_IDENTITY_Ego *ego, |
216 | enum GNUNET_ESCROW_Key_Escrow_Method method, | 215 | enum GNUNET_ESCROW_Key_Escrow_Method method, |
217 | GNUNET_ESCROW_AnchorContinuation cb, | 216 | GNUNET_ESCROW_AnchorContinuation cb) |
218 | void *cb_cls) | ||
219 | { | 217 | { |
220 | struct GNUNET_ESCROW_Operation *op; | 218 | struct GNUNET_ESCROW_Operation *op; |
221 | const struct GNUNET_ESCROW_KeyPluginFunctions *api; | 219 | const struct GNUNET_ESCROW_KeyPluginFunctions *api; |
@@ -224,7 +222,6 @@ GNUNET_ESCROW_put (struct GNUNET_ESCROW_Handle *h, | |||
224 | op->h = h; | 222 | op->h = h; |
225 | op->method = method; | 223 | op->method = method; |
226 | op->cb_put = cb; | 224 | op->cb_put = cb; |
227 | op->cb_cls = cb_cls; | ||
228 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 225 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
229 | 226 | ||
230 | api = init_plugin (h, method); | 227 | api = init_plugin (h, method); |
@@ -237,7 +234,7 @@ GNUNET_ESCROW_put (struct GNUNET_ESCROW_Handle *h, | |||
237 | static void | 234 | static void |
238 | handle_restore_key_result (void *cls) | 235 | handle_restore_key_result (void *cls) |
239 | { | 236 | { |
240 | struct GNUNET_ESCROW_Plugin_EgoContinuationWrapper *w = cls; | 237 | struct ESCROW_Plugin_EgoContinuationWrapper *w = cls; |
241 | struct GNUNET_ESCROW_Operation *op; | 238 | struct GNUNET_ESCROW_Operation *op; |
242 | 239 | ||
243 | for (op = w->h->op_head; NULL != op; op = op->next) | 240 | for (op = w->h->op_head; NULL != op; op = op->next) |
@@ -266,7 +263,6 @@ handle_restore_key_result (void *cls) | |||
266 | * @param egoName the name of the ego to get back | 263 | * @param egoName the name of the ego to get back |
267 | * @param method the escrow method to use | 264 | * @param method the escrow method to use |
268 | * @param cb function to call with the restored ego on completion | 265 | * @param cb function to call with the restored ego on completion |
269 | * @param cb_cls closure for @a cb | ||
270 | * | 266 | * |
271 | * @return handle to abort the operation | 267 | * @return handle to abort the operation |
272 | */ | 268 | */ |
@@ -275,8 +271,7 @@ GNUNET_ESCROW_get (struct GNUNET_ESCROW_Handle *h, | |||
275 | struct GNUNET_ESCROW_Anchor *escrowAnchor, | 271 | struct GNUNET_ESCROW_Anchor *escrowAnchor, |
276 | char *egoName, | 272 | char *egoName, |
277 | enum GNUNET_ESCROW_Key_Escrow_Method method, | 273 | enum GNUNET_ESCROW_Key_Escrow_Method method, |
278 | GNUNET_ESCROW_EgoContinuation cb, | 274 | GNUNET_ESCROW_EgoContinuation cb) |
279 | void *cb_cls) | ||
280 | { | 275 | { |
281 | struct GNUNET_ESCROW_Operation *op; | 276 | struct GNUNET_ESCROW_Operation *op; |
282 | const struct GNUNET_ESCROW_KeyPluginFunctions *api; | 277 | const struct GNUNET_ESCROW_KeyPluginFunctions *api; |
@@ -285,7 +280,6 @@ GNUNET_ESCROW_get (struct GNUNET_ESCROW_Handle *h, | |||
285 | op->h = h; | 280 | op->h = h; |
286 | op->method = method; | 281 | op->method = method; |
287 | op->cb_get = cb; | 282 | op->cb_get = cb; |
288 | op->cb_cls = cb_cls; | ||
289 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 283 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
290 | 284 | ||
291 | api = init_plugin (h, method); | 285 | api = init_plugin (h, method); |
@@ -298,7 +292,7 @@ GNUNET_ESCROW_get (struct GNUNET_ESCROW_Handle *h, | |||
298 | void | 292 | void |
299 | handle_verify_escrow_result (void *cls) | 293 | handle_verify_escrow_result (void *cls) |
300 | { | 294 | { |
301 | struct GNUNET_ESCROW_Plugin_VerifyContinuationWrapper *w = cls; | 295 | struct ESCROW_Plugin_VerifyContinuationWrapper *w = cls; |
302 | struct GNUNET_ESCROW_Operation *op; | 296 | struct GNUNET_ESCROW_Operation *op; |
303 | 297 | ||
304 | for (op = w->h->op_head; NULL != op; op = op->next) | 298 | for (op = w->h->op_head; NULL != op; op = op->next) |
@@ -329,7 +323,6 @@ handle_verify_escrow_result (void *cls) | |||
329 | * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method | 323 | * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method |
330 | * @param method the escrow method to use | 324 | * @param method the escrow method to use |
331 | * @param cb function to call with the verification result on completion | 325 | * @param cb function to call with the verification result on completion |
332 | * @param cb_cls closure for @a cb | ||
333 | * | 326 | * |
334 | * @return handle to abort the operation | 327 | * @return handle to abort the operation |
335 | */ | 328 | */ |
@@ -338,8 +331,7 @@ GNUNET_ESCROW_verify (struct GNUNET_ESCROW_Handle *h, | |||
338 | const struct GNUNET_IDENTITY_Ego *ego, | 331 | const struct GNUNET_IDENTITY_Ego *ego, |
339 | struct GNUNET_ESCROW_Anchor *escrowAnchor, | 332 | struct GNUNET_ESCROW_Anchor *escrowAnchor, |
340 | enum GNUNET_ESCROW_Key_Escrow_Method method, | 333 | enum GNUNET_ESCROW_Key_Escrow_Method method, |
341 | GNUNET_ESCROW_VerifyContinuation cb, | 334 | GNUNET_ESCROW_VerifyContinuation cb) |
342 | void *cb_cls) | ||
343 | { | 335 | { |
344 | struct GNUNET_ESCROW_Operation *op; | 336 | struct GNUNET_ESCROW_Operation *op; |
345 | const struct GNUNET_ESCROW_KeyPluginFunctions *api; | 337 | const struct GNUNET_ESCROW_KeyPluginFunctions *api; |
@@ -348,7 +340,6 @@ GNUNET_ESCROW_verify (struct GNUNET_ESCROW_Handle *h, | |||
348 | op->h = h; | 340 | op->h = h; |
349 | op->method = method; | 341 | op->method = method; |
350 | op->cb_verify = cb; | 342 | op->cb_verify = cb; |
351 | op->cb_cls = cb_cls; | ||
352 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 343 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
353 | 344 | ||
354 | api = init_plugin (h, method); | 345 | api = init_plugin (h, method); |
diff --git a/src/escrow/gnunet-escrow.c b/src/escrow/gnunet-escrow.c index ce693d47f..268815ce5 100644 --- a/src/escrow/gnunet-escrow.c +++ b/src/escrow/gnunet-escrow.c | |||
@@ -198,10 +198,10 @@ get_cb (const struct GNUNET_IDENTITY_Ego *ego) | |||
198 | if (NULL == ego) | 198 | if (NULL == ego) |
199 | { | 199 | { |
200 | ret = 1; | 200 | ret = 1; |
201 | fprintf (stderr, _ ("escrow failed!")); | 201 | fprintf (stderr, _ ("escrow failed!\n")); |
202 | return; | ||
203 | } | 202 | } |
204 | fprintf (stdout, "Ego %s could successfully be restored!\n", ego->name); | 203 | else |
204 | fprintf (stdout, "Ego %s could successfully be restored!\n", ego->name); | ||
205 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); | 205 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); |
206 | } | 206 | } |
207 | 207 | ||
@@ -221,8 +221,7 @@ start_process () | |||
221 | escrow_op = GNUNET_ESCROW_put (escrow_handle, | 221 | escrow_op = GNUNET_ESCROW_put (escrow_handle, |
222 | ego, | 222 | ego, |
223 | method, | 223 | method, |
224 | &put_cb, | 224 | &put_cb); |
225 | NULL); | ||
226 | return; | 225 | return; |
227 | } | 226 | } |
228 | /* verify */ | 227 | /* verify */ |
@@ -238,8 +237,7 @@ start_process () | |||
238 | ego, | 237 | ego, |
239 | anchor, | 238 | anchor, |
240 | method, | 239 | method, |
241 | &verify_cb, | 240 | &verify_cb); |
242 | NULL); | ||
243 | return; | 241 | return; |
244 | } | 242 | } |
245 | /* get */ | 243 | /* get */ |
@@ -255,8 +253,7 @@ start_process () | |||
255 | anchor, | 253 | anchor, |
256 | get_ego, | 254 | get_ego, |
257 | method, | 255 | method, |
258 | &get_cb, | 256 | &get_cb); |
259 | NULL); | ||
260 | return; | 257 | return; |
261 | } | 258 | } |
262 | } | 259 | } |
diff --git a/src/escrow/plugin_escrow_anastasis.c b/src/escrow/plugin_escrow_anastasis.c index 44fc434ef..165fdda23 100644 --- a/src/escrow/plugin_escrow_anastasis.c +++ b/src/escrow/plugin_escrow_anastasis.c | |||
@@ -56,9 +56,9 @@ start_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
56 | const struct GNUNET_IDENTITY_Ego *ego, | 56 | const struct GNUNET_IDENTITY_Ego *ego, |
57 | GNUNET_SCHEDULER_TaskCallback cb) | 57 | GNUNET_SCHEDULER_TaskCallback cb) |
58 | { | 58 | { |
59 | struct GNUNET_ESCROW_Plugin_AnchorContinuationWrapper *w; | 59 | struct ESCROW_Plugin_AnchorContinuationWrapper *w; |
60 | 60 | ||
61 | w = GNUNET_new (struct GNUNET_ESCROW_Plugin_AnchorContinuationWrapper); | 61 | w = GNUNET_new (struct ESCROW_Plugin_AnchorContinuationWrapper); |
62 | w->h = h; | 62 | w->h = h; |
63 | 63 | ||
64 | // TODO: implement | 64 | // TODO: implement |
@@ -84,9 +84,9 @@ verify_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
84 | struct GNUNET_ESCROW_Anchor *escrowAnchor, | 84 | struct GNUNET_ESCROW_Anchor *escrowAnchor, |
85 | GNUNET_SCHEDULER_TaskCallback cb) | 85 | GNUNET_SCHEDULER_TaskCallback cb) |
86 | { | 86 | { |
87 | struct GNUNET_ESCROW_Plugin_VerifyContinuationWrapper *w; | 87 | struct ESCROW_Plugin_VerifyContinuationWrapper *w; |
88 | 88 | ||
89 | w = GNUNET_new (struct GNUNET_ESCROW_Plugin_VerifyContinuationWrapper); | 89 | w = GNUNET_new (struct ESCROW_Plugin_VerifyContinuationWrapper); |
90 | w->h = h; | 90 | w->h = h; |
91 | 91 | ||
92 | // TODO: implement | 92 | // TODO: implement |
@@ -112,9 +112,9 @@ restore_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
112 | char *egoName, | 112 | char *egoName, |
113 | GNUNET_SCHEDULER_TaskCallback cb) | 113 | GNUNET_SCHEDULER_TaskCallback cb) |
114 | { | 114 | { |
115 | struct GNUNET_ESCROW_Plugin_EgoContinuationWrapper *w; | 115 | struct ESCROW_Plugin_EgoContinuationWrapper *w; |
116 | 116 | ||
117 | w = GNUNET_new (struct GNUNET_ESCROW_Plugin_EgoContinuationWrapper); | 117 | w = GNUNET_new (struct ESCROW_Plugin_EgoContinuationWrapper); |
118 | w->h = h; | 118 | w->h = h; |
119 | 119 | ||
120 | // TODO: implement | 120 | // TODO: implement |
diff --git a/src/escrow/plugin_escrow_gns.c b/src/escrow/plugin_escrow_gns.c index 6e9ea5181..45c16366b 100644 --- a/src/escrow/plugin_escrow_gns.c +++ b/src/escrow/plugin_escrow_gns.c | |||
@@ -32,9 +32,19 @@ | |||
32 | #include <sss.h> | 32 | #include <sss.h> |
33 | #include <inttypes.h> | 33 | #include <inttypes.h> |
34 | 34 | ||
35 | #define GNUNET_ESCROW_GNS_NumberOfShares 6 | ||
36 | #define GNUNET_ESCROW_GNS_ShareThreshold 3 | ||
37 | 35 | ||
36 | struct ESCROW_GnsPluginOperation | ||
37 | { | ||
38 | /** | ||
39 | * Handle for the escrow component | ||
40 | */ | ||
41 | struct GNUNET_ESCROW_Handle *h; | ||
42 | |||
43 | /** | ||
44 | * Scheduler task the SCHEDULE operation returns (needed for cancellation) | ||
45 | */ | ||
46 | struct GNUNET_SCHEDULER_Task *sched_task; | ||
47 | }; | ||
38 | 48 | ||
39 | /** | 49 | /** |
40 | * Identity handle | 50 | * Identity handle |
@@ -65,24 +75,57 @@ start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
65 | sss_Keyshare keyshares; | 75 | sss_Keyshare keyshares; |
66 | struct GNUNET_ESCROW_Anchor *anchor; | 76 | struct GNUNET_ESCROW_Anchor *anchor; |
67 | int anchorDataSize; | 77 | int anchorDataSize; |
68 | struct GNUNET_ESCROW_Plugin_AnchorContinuationWrapper *w; | 78 | struct ESCROW_PluginOperationWrapper *plugin_op_wrap; |
69 | 79 | struct ESCROW_GnsPluginOperation *p_op; | |
70 | w = GNUNET_new (struct GNUNET_ESCROW_Plugin_AnchorContinuationWrapper); | 80 | struct ESCROW_Plugin_AnchorContinuationWrapper *w; |
81 | unsigned long long shares, share_threshold; | ||
82 | |||
83 | // create a new GNS plugin operation (in a wrapper) and insert it into the DLL | ||
84 | plugin_op_wrap = GNUNET_new (struct ESCROW_PluginOperationWrapper); | ||
85 | plugin_op_wrap->plugin_op = GNUNET_new (struct ESCROW_GnsPluginOperation); | ||
86 | GNUNET_CONTAINER_DLL_insert_tail (ph.plugin_op_head, | ||
87 | ph.plugin_op_tail, | ||
88 | plugin_op_wrap); | ||
89 | |||
90 | p_op = (struct ESCROW_GnsPluginOperation *)plugin_op_wrap->plugin_op; | ||
91 | p_op->h = h; | ||
92 | |||
93 | w = GNUNET_new (struct ESCROW_Plugin_AnchorContinuationWrapper); | ||
71 | w->h = h; | 94 | w->h = h; |
72 | 95 | ||
73 | if (NULL == ego) | 96 | if (NULL == ego) |
74 | { | 97 | { |
75 | w->escrowAnchor = NULL; | 98 | w->escrowAnchor = NULL; |
76 | GNUNET_SCHEDULER_add_now (cb, w); | 99 | p_op->sched_task = GNUNET_SCHEDULER_add_now (cb, w); |
77 | return NULL; // TODO! | 100 | return plugin_op_wrap; |
78 | } | 101 | } |
79 | pk = GNUNET_IDENTITY_ego_get_private_key (ego); | 102 | pk = GNUNET_IDENTITY_ego_get_private_key (ego); |
80 | 103 | ||
81 | // split the private key (SSS) | 104 | // split the private key (SSS) |
82 | sss_create_keyshares(&keyshares, | 105 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (h->cfg, |
83 | pk->d, | 106 | "escrow", |
84 | GNUNET_ESCROW_GNS_NumberOfShares, | 107 | "gns_shares", |
85 | GNUNET_ESCROW_GNS_ShareThreshold); | 108 | &shares)) |
109 | { | ||
110 | fprintf (stderr, "Number of shares not specified in config!"); | ||
111 | w->escrowAnchor = NULL; | ||
112 | p_op->sched_task = GNUNET_SCHEDULER_add_now (cb, w); | ||
113 | return plugin_op_wrap; | ||
114 | } | ||
115 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (h->cfg, | ||
116 | "escrow", | ||
117 | "gns_share_threshold", | ||
118 | &share_threshold)) | ||
119 | { | ||
120 | fprintf (stderr, "Share threshold not specified in config"); | ||
121 | w->escrowAnchor = NULL; | ||
122 | p_op->sched_task = GNUNET_SCHEDULER_add_now (cb, w); | ||
123 | return plugin_op_wrap; | ||
124 | } | ||
125 | sss_create_keyshares (&keyshares, | ||
126 | pk->d, | ||
127 | (uint8_t)shares, | ||
128 | (uint8_t)share_threshold); | ||
86 | 129 | ||
87 | // create the escrow identities | 130 | // create the escrow identities |
88 | 131 | ||
@@ -92,9 +135,11 @@ start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
92 | // TODO: implement | 135 | // TODO: implement |
93 | anchorDataSize = 0; // TODO! | 136 | anchorDataSize = 0; // TODO! |
94 | anchor = GNUNET_malloc (sizeof (struct GNUNET_ESCROW_Anchor) + anchorDataSize); | 137 | anchor = GNUNET_malloc (sizeof (struct GNUNET_ESCROW_Anchor) + anchorDataSize); |
138 | |||
95 | w->escrowAnchor = anchor; | 139 | w->escrowAnchor = anchor; |
96 | GNUNET_SCHEDULER_add_now (cb, w); | 140 | |
97 | return NULL; // TODO! | 141 | p_op->sched_task = GNUNET_SCHEDULER_add_now (cb, w); |
142 | return plugin_op_wrap; | ||
98 | } | 143 | } |
99 | 144 | ||
100 | 145 | ||
@@ -114,15 +159,27 @@ verify_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
114 | struct GNUNET_ESCROW_Anchor *escrowAnchor, | 159 | struct GNUNET_ESCROW_Anchor *escrowAnchor, |
115 | GNUNET_SCHEDULER_TaskCallback cb) | 160 | GNUNET_SCHEDULER_TaskCallback cb) |
116 | { | 161 | { |
117 | struct GNUNET_ESCROW_Plugin_VerifyContinuationWrapper *w; | 162 | struct ESCROW_PluginOperationWrapper *plugin_op_wrap; |
163 | struct ESCROW_GnsPluginOperation *p_op; | ||
164 | struct ESCROW_Plugin_VerifyContinuationWrapper *w; | ||
165 | |||
166 | // create a new GNS plugin operation (in a wrapper) and insert it into the DLL | ||
167 | plugin_op_wrap = GNUNET_new (struct ESCROW_PluginOperationWrapper); | ||
168 | plugin_op_wrap->plugin_op = GNUNET_new (struct ESCROW_GnsPluginOperation); | ||
169 | GNUNET_CONTAINER_DLL_insert_tail (ph.plugin_op_head, | ||
170 | ph.plugin_op_tail, | ||
171 | plugin_op_wrap); | ||
172 | |||
173 | p_op = (struct ESCROW_GnsPluginOperation *)plugin_op_wrap->plugin_op; | ||
174 | p_op->h = h; | ||
118 | 175 | ||
119 | w = GNUNET_new (struct GNUNET_ESCROW_Plugin_VerifyContinuationWrapper); | 176 | w = GNUNET_new (struct ESCROW_Plugin_VerifyContinuationWrapper); |
120 | w->h = h; | 177 | w->h = h; |
121 | 178 | ||
122 | // TODO: implement | 179 | // TODO: implement |
123 | w->verificationResult = GNUNET_ESCROW_INVALID; | 180 | w->verificationResult = GNUNET_ESCROW_INVALID; |
124 | GNUNET_SCHEDULER_add_now (cb, w); | 181 | p_op->sched_task = GNUNET_SCHEDULER_add_now (cb, w); |
125 | return NULL; | 182 | return plugin_op_wrap; |
126 | } | 183 | } |
127 | 184 | ||
128 | 185 | ||
@@ -142,15 +199,27 @@ restore_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
142 | char *egoName, | 199 | char *egoName, |
143 | GNUNET_SCHEDULER_TaskCallback cb) | 200 | GNUNET_SCHEDULER_TaskCallback cb) |
144 | { | 201 | { |
145 | struct GNUNET_ESCROW_Plugin_EgoContinuationWrapper *w; | 202 | struct ESCROW_PluginOperationWrapper *plugin_op_wrap; |
203 | struct ESCROW_GnsPluginOperation *p_op; | ||
204 | struct ESCROW_Plugin_EgoContinuationWrapper *w; | ||
205 | |||
206 | // create a new GNS plugin operation (in a wrapper) and insert it into the DLL | ||
207 | plugin_op_wrap = GNUNET_new (struct ESCROW_PluginOperationWrapper); | ||
208 | plugin_op_wrap->plugin_op = GNUNET_new (struct ESCROW_GnsPluginOperation); | ||
209 | GNUNET_CONTAINER_DLL_insert_tail (ph.plugin_op_head, | ||
210 | ph.plugin_op_tail, | ||
211 | plugin_op_wrap); | ||
146 | 212 | ||
147 | w = GNUNET_new (struct GNUNET_ESCROW_Plugin_EgoContinuationWrapper); | 213 | p_op = (struct ESCROW_GnsPluginOperation *)plugin_op_wrap->plugin_op; |
214 | p_op->h = h; | ||
215 | |||
216 | w = GNUNET_new (struct ESCROW_Plugin_EgoContinuationWrapper); | ||
148 | w->h = h; | 217 | w->h = h; |
149 | 218 | ||
150 | // TODO: implement | 219 | // TODO: implement |
151 | w->ego = NULL; | 220 | w->ego = NULL; |
152 | GNUNET_SCHEDULER_add_now (cb, w); | 221 | p_op->sched_task = GNUNET_SCHEDULER_add_now (cb, w); |
153 | return NULL; | 222 | return plugin_op_wrap; |
154 | } | 223 | } |
155 | 224 | ||
156 | 225 | ||
diff --git a/src/escrow/plugin_escrow_plaintext.c b/src/escrow/plugin_escrow_plaintext.c index 5267b0916..b6de718e4 100644 --- a/src/escrow/plugin_escrow_plaintext.c +++ b/src/escrow/plugin_escrow_plaintext.c | |||
@@ -65,7 +65,7 @@ struct ESCROW_PlaintextPluginOperation | |||
65 | /** | 65 | /** |
66 | * Ego continuation wrapper | 66 | * Ego continuation wrapper |
67 | */ | 67 | */ |
68 | struct GNUNET_ESCROW_Plugin_EgoContinuationWrapper *ego_cont_wrap; | 68 | struct ESCROW_Plugin_EgoContinuationWrapper *ego_cont_wrap; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | /** | 71 | /** |
@@ -99,7 +99,7 @@ start_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
99 | uint32_t anchorDataSize; | 99 | uint32_t anchorDataSize; |
100 | struct ESCROW_PluginOperationWrapper *plugin_op_wrap; | 100 | struct ESCROW_PluginOperationWrapper *plugin_op_wrap; |
101 | struct ESCROW_PlaintextPluginOperation *p_op; | 101 | struct ESCROW_PlaintextPluginOperation *p_op; |
102 | struct GNUNET_ESCROW_Plugin_AnchorContinuationWrapper *w; | 102 | struct ESCROW_Plugin_AnchorContinuationWrapper *w; |
103 | 103 | ||
104 | // create a new plaintext plugin operation (in a wrapper) and insert it into the DLL | 104 | // create a new plaintext plugin operation (in a wrapper) and insert it into the DLL |
105 | plugin_op_wrap = GNUNET_new (struct ESCROW_PluginOperationWrapper); | 105 | plugin_op_wrap = GNUNET_new (struct ESCROW_PluginOperationWrapper); |
@@ -111,7 +111,7 @@ start_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
111 | p_op = (struct ESCROW_PlaintextPluginOperation *)plugin_op_wrap->plugin_op; | 111 | p_op = (struct ESCROW_PlaintextPluginOperation *)plugin_op_wrap->plugin_op; |
112 | p_op->h = h; | 112 | p_op->h = h; |
113 | 113 | ||
114 | w = GNUNET_new (struct GNUNET_ESCROW_Plugin_AnchorContinuationWrapper); | 114 | w = GNUNET_new (struct ESCROW_Plugin_AnchorContinuationWrapper); |
115 | w->h = h; | 115 | w->h = h; |
116 | 116 | ||
117 | if (NULL == ego) | 117 | if (NULL == ego) |
@@ -157,7 +157,7 @@ verify_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
157 | int verificationResult; | 157 | int verificationResult; |
158 | struct ESCROW_PluginOperationWrapper *plugin_op_wrap; | 158 | struct ESCROW_PluginOperationWrapper *plugin_op_wrap; |
159 | struct ESCROW_PlaintextPluginOperation *p_op; | 159 | struct ESCROW_PlaintextPluginOperation *p_op; |
160 | struct GNUNET_ESCROW_Plugin_VerifyContinuationWrapper *w; | 160 | struct ESCROW_Plugin_VerifyContinuationWrapper *w; |
161 | 161 | ||
162 | // create a new plaintext plugin operation (in a wrapper) and insert it into the DLL | 162 | // create a new plaintext plugin operation (in a wrapper) and insert it into the DLL |
163 | plugin_op_wrap = GNUNET_new (struct ESCROW_PluginOperationWrapper); | 163 | plugin_op_wrap = GNUNET_new (struct ESCROW_PluginOperationWrapper); |
@@ -169,7 +169,7 @@ verify_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
169 | p_op = (struct ESCROW_PlaintextPluginOperation *)plugin_op_wrap->plugin_op; | 169 | p_op = (struct ESCROW_PlaintextPluginOperation *)plugin_op_wrap->plugin_op; |
170 | p_op->h = h; | 170 | p_op->h = h; |
171 | 171 | ||
172 | w = GNUNET_new (struct GNUNET_ESCROW_Plugin_VerifyContinuationWrapper); | 172 | w = GNUNET_new (struct ESCROW_Plugin_VerifyContinuationWrapper); |
173 | w->h = h; | 173 | w->h = h; |
174 | 174 | ||
175 | if (NULL == ego) | 175 | if (NULL == ego) |
@@ -282,7 +282,7 @@ restore_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
282 | struct GNUNET_IDENTITY_Operation *id_op; | 282 | struct GNUNET_IDENTITY_Operation *id_op; |
283 | struct ESCROW_PluginOperationWrapper *plugin_op_wrap; | 283 | struct ESCROW_PluginOperationWrapper *plugin_op_wrap; |
284 | struct ESCROW_PlaintextPluginOperation *p_op; | 284 | struct ESCROW_PlaintextPluginOperation *p_op; |
285 | struct GNUNET_ESCROW_Plugin_EgoContinuationWrapper *w; | 285 | struct ESCROW_Plugin_EgoContinuationWrapper *w; |
286 | 286 | ||
287 | // create a new plaintext plugin operation (in a wrapper) and insert it into the DLL | 287 | // create a new plaintext plugin operation (in a wrapper) and insert it into the DLL |
288 | plugin_op_wrap = GNUNET_new (struct ESCROW_PluginOperationWrapper); | 288 | plugin_op_wrap = GNUNET_new (struct ESCROW_PluginOperationWrapper); |
@@ -296,7 +296,7 @@ restore_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, | |||
296 | // set cont here (has to be scheduled from the IDENTITY service when it finished) | 296 | // set cont here (has to be scheduled from the IDENTITY service when it finished) |
297 | p_op->cont = cb; | 297 | p_op->cont = cb; |
298 | 298 | ||
299 | w = GNUNET_new (struct GNUNET_ESCROW_Plugin_EgoContinuationWrapper); | 299 | w = GNUNET_new (struct ESCROW_Plugin_EgoContinuationWrapper); |
300 | w->h = h; | 300 | w->h = h; |
301 | 301 | ||
302 | p_op->ego_cont_wrap = w; | 302 | p_op->ego_cont_wrap = w; |
diff --git a/src/escrow/test_escrow.sh b/src/escrow/test_escrow.sh index e69de29bb..92a1f1492 100644 --- a/src/escrow/test_escrow.sh +++ b/src/escrow/test_escrow.sh | |||
@@ -0,0 +1,25 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | LOCATION=$(which gnunet-config) | ||
4 | if [ -z $LOCATION ] | ||
5 | then | ||
6 | LOCATION="gnunet-config" | ||
7 | fi | ||
8 | $LOCATION --version 1> /dev/null | ||
9 | if test $? != 0 | ||
10 | then | ||
11 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | ||
12 | exit 77 | ||
13 | fi | ||
14 | |||
15 | rm -rf `gnunet-config -c test_escrow.conf -s PATHS -o GNUNET_HOME -f` | ||
16 | |||
17 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" | ||
18 | |||
19 | gnunet-arm -s -c test_escrow.conf | ||
20 | gnunet-identity -C testego -c test_escrow.conf | ||
21 | ANCHOR=$(gnunet-escrow -m plaintext -P testego -c test_escrow.conf | tail -1) | ||
22 | gnunet-escrow -m plaintext -V testego -a $ANCHOR -c test_escrow.conf | ||
23 | gnunet-identity -D testego -c test_escrow.conf | ||
24 | gnunet-escrow -m plaintext -G testego -a $ANCHOR -c test_escrow.conf | ||
25 | gnunet-arm -e -c test_escrow.conf | ||
diff --git a/src/include/gnunet_escrow_lib.h b/src/include/gnunet_escrow_lib.h index 10b7df886..564c457b9 100644 --- a/src/include/gnunet_escrow_lib.h +++ b/src/include/gnunet_escrow_lib.h | |||
@@ -200,11 +200,6 @@ struct GNUNET_ESCROW_Operation | |||
200 | * Continuation for a VERIFY operation. | 200 | * Continuation for a VERIFY operation. |
201 | */ | 201 | */ |
202 | GNUNET_ESCROW_VerifyContinuation cb_verify; | 202 | GNUNET_ESCROW_VerifyContinuation cb_verify; |
203 | |||
204 | /** | ||
205 | * Closure for a callback. | ||
206 | */ | ||
207 | void *cb_cls; | ||
208 | }; | 203 | }; |
209 | 204 | ||
210 | 205 | ||
@@ -237,7 +232,6 @@ GNUNET_ESCROW_fini ( | |||
237 | * @param ego the identity ego to put in escrow | 232 | * @param ego the identity ego to put in escrow |
238 | * @param method the escrow method to use | 233 | * @param method the escrow method to use |
239 | * @param cb function to call with the escrow anchor on completion | 234 | * @param cb function to call with the escrow anchor on completion |
240 | * @param cb_cls closure for @a cb | ||
241 | * | 235 | * |
242 | * @return handle to abort the operation | 236 | * @return handle to abort the operation |
243 | */ | 237 | */ |
@@ -246,8 +240,7 @@ GNUNET_ESCROW_put ( | |||
246 | struct GNUNET_ESCROW_Handle *h, | 240 | struct GNUNET_ESCROW_Handle *h, |
247 | const struct GNUNET_IDENTITY_Ego *ego, | 241 | const struct GNUNET_IDENTITY_Ego *ego, |
248 | enum GNUNET_ESCROW_Key_Escrow_Method method, | 242 | enum GNUNET_ESCROW_Key_Escrow_Method method, |
249 | GNUNET_ESCROW_AnchorContinuation cb, | 243 | GNUNET_ESCROW_AnchorContinuation cb); |
250 | void *cb_cls); | ||
251 | 244 | ||
252 | 245 | ||
253 | /** | 246 | /** |
@@ -258,7 +251,6 @@ GNUNET_ESCROW_put ( | |||
258 | * @param egoName the name of the ego to get back | 251 | * @param egoName the name of the ego to get back |
259 | * @param method the escrow method to use | 252 | * @param method the escrow method to use |
260 | * @param cb function to call with the restored ego on completion | 253 | * @param cb function to call with the restored ego on completion |
261 | * @param cb_cls closure for @a cb | ||
262 | * | 254 | * |
263 | * @return handle to abort the operation | 255 | * @return handle to abort the operation |
264 | */ | 256 | */ |
@@ -268,8 +260,7 @@ GNUNET_ESCROW_get ( | |||
268 | struct GNUNET_ESCROW_Anchor *escrowAnchor, | 260 | struct GNUNET_ESCROW_Anchor *escrowAnchor, |
269 | char *egoName, | 261 | char *egoName, |
270 | enum GNUNET_ESCROW_Key_Escrow_Method method, | 262 | enum GNUNET_ESCROW_Key_Escrow_Method method, |
271 | GNUNET_ESCROW_EgoContinuation cb, | 263 | GNUNET_ESCROW_EgoContinuation cb); |
272 | void *cb_cls); | ||
273 | 264 | ||
274 | 265 | ||
275 | /** | 266 | /** |
@@ -280,7 +271,6 @@ GNUNET_ESCROW_get ( | |||
280 | * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method | 271 | * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method |
281 | * @param method the escrow method to use | 272 | * @param method the escrow method to use |
282 | * @param cb function to call with the verification result on completion | 273 | * @param cb function to call with the verification result on completion |
283 | * @param cb_cls closure for @a cb | ||
284 | * | 274 | * |
285 | * @return handle to abort the operation | 275 | * @return handle to abort the operation |
286 | */ | 276 | */ |
@@ -290,8 +280,7 @@ GNUNET_ESCROW_verify ( | |||
290 | const struct GNUNET_IDENTITY_Ego *ego, | 280 | const struct GNUNET_IDENTITY_Ego *ego, |
291 | struct GNUNET_ESCROW_Anchor *escrowAnchor, | 281 | struct GNUNET_ESCROW_Anchor *escrowAnchor, |
292 | enum GNUNET_ESCROW_Key_Escrow_Method method, | 282 | enum GNUNET_ESCROW_Key_Escrow_Method method, |
293 | GNUNET_ESCROW_VerifyContinuation cb, | 283 | GNUNET_ESCROW_VerifyContinuation cb); |
294 | void *cb_cls); | ||
295 | 284 | ||
296 | 285 | ||
297 | /** | 286 | /** |
diff --git a/src/include/gnunet_escrow_plugin.h b/src/include/gnunet_escrow_plugin.h index 5eba667b4..1e03d96a2 100644 --- a/src/include/gnunet_escrow_plugin.h +++ b/src/include/gnunet_escrow_plugin.h | |||
@@ -50,7 +50,7 @@ extern "C" { | |||
50 | * As this type of function is called from the scheduler, which only takes | 50 | * As this type of function is called from the scheduler, which only takes |
51 | * one argument as closure, this struct is used to pass more arguments. | 51 | * one argument as closure, this struct is used to pass more arguments. |
52 | */ | 52 | */ |
53 | struct GNUNET_ESCROW_Plugin_AnchorContinuationWrapper | 53 | struct ESCROW_Plugin_AnchorContinuationWrapper |
54 | { | 54 | { |
55 | struct GNUNET_ESCROW_Handle *h; | 55 | struct GNUNET_ESCROW_Handle *h; |
56 | struct GNUNET_ESCROW_Anchor *escrowAnchor; | 56 | struct GNUNET_ESCROW_Anchor *escrowAnchor; |
@@ -62,7 +62,7 @@ struct GNUNET_ESCROW_Plugin_AnchorContinuationWrapper | |||
62 | * As this type of function is called from the scheduler, which only takes | 62 | * As this type of function is called from the scheduler, which only takes |
63 | * one argument as closure, this struct is used to pass more arguments. | 63 | * one argument as closure, this struct is used to pass more arguments. |
64 | */ | 64 | */ |
65 | struct GNUNET_ESCROW_Plugin_EgoContinuationWrapper | 65 | struct ESCROW_Plugin_EgoContinuationWrapper |
66 | { | 66 | { |
67 | struct GNUNET_ESCROW_Handle *h; | 67 | struct GNUNET_ESCROW_Handle *h; |
68 | const struct GNUNET_IDENTITY_Ego *ego; | 68 | const struct GNUNET_IDENTITY_Ego *ego; |
@@ -74,7 +74,7 @@ struct GNUNET_ESCROW_Plugin_EgoContinuationWrapper | |||
74 | * As this type of function is called from the scheduler, which only takes | 74 | * As this type of function is called from the scheduler, which only takes |
75 | * one argument as closure, this struct is used to pass more arguments. | 75 | * one argument as closure, this struct is used to pass more arguments. |
76 | */ | 76 | */ |
77 | struct GNUNET_ESCROW_Plugin_VerifyContinuationWrapper | 77 | struct ESCROW_Plugin_VerifyContinuationWrapper |
78 | { | 78 | { |
79 | struct GNUNET_ESCROW_Handle *h; | 79 | struct GNUNET_ESCROW_Handle *h; |
80 | int verificationResult; | 80 | int verificationResult; |