aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjospaeth <spaethj@in.tum.de>2020-08-06 14:33:34 +0200
committerjospaeth <spaethj@in.tum.de>2020-08-06 14:33:34 +0200
commit7359d93752bfe39d1154ea0e67f556dab0020cff (patch)
tree207713d099a540a9b247320089f52fb82cc6f8e3
parentf7272dfc42de5b4cd0f9b27308e82e91d5f64ee3 (diff)
downloadgnunet-7359d93752bfe39d1154ea0e67f556dab0020cff.tar.gz
gnunet-7359d93752bfe39d1154ea0e67f556dab0020cff.zip
add unique operation ID for distinction in the cb
-rw-r--r--src/escrow/escrow.h15
-rw-r--r--src/escrow/escrow_api.c31
-rw-r--r--src/escrow/plugin_escrow_anastasis.c15
-rw-r--r--src/escrow/plugin_escrow_gns.c15
-rw-r--r--src/escrow/plugin_escrow_plaintext.c15
-rw-r--r--src/include/gnunet_escrow_lib.h10
-rw-r--r--src/include/gnunet_escrow_plugin.h12
7 files changed, 93 insertions, 20 deletions
diff --git a/src/escrow/escrow.h b/src/escrow/escrow.h
index 7c29104b0..2acb1391e 100644
--- a/src/escrow/escrow.h
+++ b/src/escrow/escrow.h
@@ -169,6 +169,11 @@ struct ESCROW_Plugin_AnchorContinuationWrapper
169 * The escrow anchor 169 * The escrow anchor
170 */ 170 */
171 struct GNUNET_ESCROW_Anchor *escrowAnchor; 171 struct GNUNET_ESCROW_Anchor *escrowAnchor;
172
173 /**
174 * The unique ID of the respective ESCROW_Operation
175 */
176 uint32_t op_id;
172}; 177};
173 178
174/** 179/**
@@ -188,6 +193,11 @@ struct ESCROW_Plugin_EgoContinuationWrapper
188 * The restored ego 193 * The restored ego
189 */ 194 */
190 const struct GNUNET_IDENTITY_Ego *ego; 195 const struct GNUNET_IDENTITY_Ego *ego;
196
197 /**
198 * The unique ID of the respective ESCROW_Operation
199 */
200 uint32_t op_id;
191}; 201};
192 202
193/** 203/**
@@ -207,6 +217,11 @@ struct ESCROW_Plugin_VerifyContinuationWrapper
207 * The result of the verification 217 * The result of the verification
208 */ 218 */
209 int verificationResult; 219 int verificationResult;
220
221 /**
222 * The unique ID of the respective ESCROW_Operation
223 */
224 uint32_t op_id;
210}; 225};
211 226
212 227
diff --git a/src/escrow/escrow_api.c b/src/escrow/escrow_api.c
index 510f6a898..7714152c0 100644
--- a/src/escrow/escrow_api.c
+++ b/src/escrow/escrow_api.c
@@ -115,6 +115,20 @@ init_plugin (struct GNUNET_ESCROW_Handle *h,
115 115
116 116
117/** 117/**
118 * Get a fresh operation id to distinguish between escrow operations
119 *
120 * @param h the escrow handle
121 *
122 * @return next operation id to use
123 */
124static uint32_t
125get_op_id (struct GNUNET_ESCROW_Handle *h)
126{
127 return h->last_op_id_used++;
128}
129
130
131/**
118 * Initialize the escrow component. 132 * Initialize the escrow component.
119 * 133 *
120 * @param cfg the configuration to use 134 * @param cfg the configuration to use
@@ -191,7 +205,7 @@ handle_start_escrow_result (void *cls)
191 struct GNUNET_ESCROW_Operation *op; 205 struct GNUNET_ESCROW_Operation *op;
192 206
193 for (op = w->h->op_head; NULL != op; op = op->next) 207 for (op = w->h->op_head; NULL != op; op = op->next)
194 if (1) // TODO: find condition (e.g. unique ID) 208 if (op->id == w->op_id)
195 break; 209 break;
196 210
197 if (NULL == op) 211 if (NULL == op)
@@ -229,13 +243,14 @@ GNUNET_ESCROW_put (struct GNUNET_ESCROW_Handle *h,
229 243
230 op = GNUNET_new (struct GNUNET_ESCROW_Operation); 244 op = GNUNET_new (struct GNUNET_ESCROW_Operation);
231 op->h = h; 245 op->h = h;
246 op->id = get_op_id (h);
232 op->method = method; 247 op->method = method;
233 op->cb_put = cb; 248 op->cb_put = cb;
234 op->cb_cls = cb_cls; 249 op->cb_cls = cb_cls;
235 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); 250 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
236 251
237 api = init_plugin (h, method); 252 api = init_plugin (h, method);
238 op->plugin_op_wrap = api->start_key_escrow (h, ego, &handle_start_escrow_result); 253 op->plugin_op_wrap = api->start_key_escrow (h, ego, &handle_start_escrow_result, op->id);
239 254
240 return op; 255 return op;
241} 256}
@@ -248,7 +263,7 @@ handle_restore_key_result (void *cls)
248 struct GNUNET_ESCROW_Operation *op; 263 struct GNUNET_ESCROW_Operation *op;
249 264
250 for (op = w->h->op_head; NULL != op; op = op->next) 265 for (op = w->h->op_head; NULL != op; op = op->next)
251 if (1) // TODO: find condition (e.g. unique ID) 266 if (op->id == w->op_id)
252 break; 267 break;
253 268
254 if (NULL == op) 269 if (NULL == op)
@@ -288,13 +303,14 @@ GNUNET_ESCROW_get (struct GNUNET_ESCROW_Handle *h,
288 303
289 op = GNUNET_new (struct GNUNET_ESCROW_Operation); 304 op = GNUNET_new (struct GNUNET_ESCROW_Operation);
290 op->h = h; 305 op->h = h;
306 op->id = get_op_id (h);
291 op->method = method; 307 op->method = method;
292 op->cb_get = cb; 308 op->cb_get = cb;
293 op->cb_cls = cb_cls; 309 op->cb_cls = cb_cls;
294 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); 310 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
295 311
296 api = init_plugin (h, method); 312 api = init_plugin (h, method);
297 op->plugin_op_wrap = api->restore_key (h, escrowAnchor, egoName, &handle_restore_key_result); 313 op->plugin_op_wrap = api->restore_key (h, escrowAnchor, egoName, &handle_restore_key_result, op->id);
298 314
299 return op; 315 return op;
300} 316}
@@ -307,7 +323,7 @@ handle_verify_escrow_result (void *cls)
307 struct GNUNET_ESCROW_Operation *op; 323 struct GNUNET_ESCROW_Operation *op;
308 324
309 for (op = w->h->op_head; NULL != op; op = op->next) 325 for (op = w->h->op_head; NULL != op; op = op->next)
310 if (1) // TODO: find condition (e.g. unique ID) 326 if (op->id == w->op_id)
311 break; 327 break;
312 328
313 if (NULL == op) 329 if (NULL == op)
@@ -318,8 +334,6 @@ handle_verify_escrow_result (void *cls)
318 GNUNET_CONTAINER_DLL_remove (w->h->op_head, w->h->op_tail, op); 334 GNUNET_CONTAINER_DLL_remove (w->h->op_head, w->h->op_tail, op);
319 if (NULL != op->cb_verify) 335 if (NULL != op->cb_verify)
320 op->cb_verify (op->cb_cls, w->verificationResult); 336 op->cb_verify (op->cb_cls, w->verificationResult);
321 GNUNET_free (op->plugin_op_wrap->plugin_op);
322 GNUNET_free (op->plugin_op_wrap);
323 GNUNET_free (op); 337 GNUNET_free (op);
324} 338}
325 339
@@ -349,13 +363,14 @@ GNUNET_ESCROW_verify (struct GNUNET_ESCROW_Handle *h,
349 363
350 op = GNUNET_new (struct GNUNET_ESCROW_Operation); 364 op = GNUNET_new (struct GNUNET_ESCROW_Operation);
351 op->h = h; 365 op->h = h;
366 op->id = get_op_id (h);
352 op->method = method; 367 op->method = method;
353 op->cb_verify = cb; 368 op->cb_verify = cb;
354 op->cb_cls = cb_cls; 369 op->cb_cls = cb_cls;
355 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); 370 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
356 371
357 api = init_plugin (h, method); 372 api = init_plugin (h, method);
358 op->plugin_op_wrap = api->verify_key_escrow (h, ego, escrowAnchor, &handle_verify_escrow_result); 373 op->plugin_op_wrap = api->verify_key_escrow (h, ego, escrowAnchor, &handle_verify_escrow_result, op->id);
359 374
360 return op; 375 return op;
361} 376}
diff --git a/src/escrow/plugin_escrow_anastasis.c b/src/escrow/plugin_escrow_anastasis.c
index a66410099..3d3abdf29 100644
--- a/src/escrow/plugin_escrow_anastasis.c
+++ b/src/escrow/plugin_escrow_anastasis.c
@@ -48,18 +48,21 @@ struct ESCROW_PluginHandle ph;
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 cb the function called upon completion 50 * @param cb the function called upon completion
51 * @param op_id unique ID of the respective ESCROW_Operation
51 * 52 *
52 * @return plugin operation wrapper 53 * @return plugin operation wrapper
53 */ 54 */
54struct ESCROW_PluginOperationWrapper * 55struct ESCROW_PluginOperationWrapper *
55start_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h, 56start_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
56 const struct GNUNET_IDENTITY_Ego *ego, 57 const struct GNUNET_IDENTITY_Ego *ego,
57 GNUNET_SCHEDULER_TaskCallback cb) 58 GNUNET_SCHEDULER_TaskCallback cb,
59 uint32_t op_id)
58{ 60{
59 struct ESCROW_Plugin_AnchorContinuationWrapper *w; 61 struct ESCROW_Plugin_AnchorContinuationWrapper *w;
60 62
61 w = GNUNET_new (struct ESCROW_Plugin_AnchorContinuationWrapper); 63 w = GNUNET_new (struct ESCROW_Plugin_AnchorContinuationWrapper);
62 w->h = h; 64 w->h = h;
65 w->op_id = op_id;
63 66
64 // TODO: implement 67 // TODO: implement
65 w->escrowAnchor = NULL; 68 w->escrowAnchor = NULL;
@@ -75,6 +78,7 @@ start_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
75 * @param ego the identity ego containing the private key 78 * @param ego the identity ego containing the private key
76 * @param escrowAnchor the escrow anchor needed to restore the key 79 * @param escrowAnchor the escrow anchor needed to restore the key
77 * @param cb the function called upon completion 80 * @param cb the function called upon completion
81 * @param op_id unique ID of the respective ESCROW_Operation
78 * 82 *
79 * @return plugin operation wrapper 83 * @return plugin operation wrapper
80 */ 84 */
@@ -82,12 +86,14 @@ struct ESCROW_PluginOperationWrapper *
82verify_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h, 86verify_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
83 const struct GNUNET_IDENTITY_Ego *ego, 87 const struct GNUNET_IDENTITY_Ego *ego,
84 struct GNUNET_ESCROW_Anchor *escrowAnchor, 88 struct GNUNET_ESCROW_Anchor *escrowAnchor,
85 GNUNET_SCHEDULER_TaskCallback cb) 89 GNUNET_SCHEDULER_TaskCallback cb,
90 uint32_t op_id)
86{ 91{
87 struct ESCROW_Plugin_VerifyContinuationWrapper *w; 92 struct ESCROW_Plugin_VerifyContinuationWrapper *w;
88 93
89 w = GNUNET_new (struct ESCROW_Plugin_VerifyContinuationWrapper); 94 w = GNUNET_new (struct ESCROW_Plugin_VerifyContinuationWrapper);
90 w->h = h; 95 w->h = h;
96 w->op_id = op_id;
91 97
92 // TODO: implement 98 // TODO: implement
93 w->verificationResult = GNUNET_ESCROW_INVALID; 99 w->verificationResult = GNUNET_ESCROW_INVALID;
@@ -103,6 +109,7 @@ verify_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
103 * @param escrowAnchor the escrow anchor needed to restore the key 109 * @param escrowAnchor the escrow anchor needed to restore the key
104 * @param egoName the name of the ego to restore 110 * @param egoName the name of the ego to restore
105 * @param cb the function called upon completion 111 * @param cb the function called upon completion
112 * @param op_id unique ID of the respective ESCROW_Operation
106 * 113 *
107 * @return plugin operation wrapper 114 * @return plugin operation wrapper
108 */ 115 */
@@ -110,12 +117,14 @@ struct ESCROW_PluginOperationWrapper *
110restore_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h, 117restore_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
111 struct GNUNET_ESCROW_Anchor *escrowAnchor, 118 struct GNUNET_ESCROW_Anchor *escrowAnchor,
112 char *egoName, 119 char *egoName,
113 GNUNET_SCHEDULER_TaskCallback cb) 120 GNUNET_SCHEDULER_TaskCallback cb,
121 uint32_t op_id)
114{ 122{
115 struct ESCROW_Plugin_EgoContinuationWrapper *w; 123 struct ESCROW_Plugin_EgoContinuationWrapper *w;
116 124
117 w = GNUNET_new (struct ESCROW_Plugin_EgoContinuationWrapper); 125 w = GNUNET_new (struct ESCROW_Plugin_EgoContinuationWrapper);
118 w->h = h; 126 w->h = h;
127 w->op_id = op_id;
119 128
120 // TODO: implement 129 // TODO: implement
121 w->ego = NULL; 130 w->ego = NULL;
diff --git a/src/escrow/plugin_escrow_gns.c b/src/escrow/plugin_escrow_gns.c
index 618591393..e55019ad9 100644
--- a/src/escrow/plugin_escrow_gns.c
+++ b/src/escrow/plugin_escrow_gns.c
@@ -63,13 +63,15 @@ struct ESCROW_PluginHandle ph;
63 * @param h the handle for the escrow component 63 * @param h the handle for the escrow component
64 * @param ego the identity ego containing the private key 64 * @param ego the identity ego containing the private key
65 * @param cb the function called upon completion 65 * @param cb the function called upon completion
66 * @param op_id unique ID of the respective ESCROW_Operation
66 * 67 *
67 * @return plugin operation wrapper 68 * @return plugin operation wrapper
68 */ 69 */
69struct ESCROW_PluginOperationWrapper * 70struct ESCROW_PluginOperationWrapper *
70start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, 71start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
71 const struct GNUNET_IDENTITY_Ego *ego, 72 const struct GNUNET_IDENTITY_Ego *ego,
72 GNUNET_SCHEDULER_TaskCallback cb) 73 GNUNET_SCHEDULER_TaskCallback cb,
74 uint32_t op_id)
73{ 75{
74 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; 76 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
75 sss_Keyshare keyshares; 77 sss_Keyshare keyshares;
@@ -92,6 +94,7 @@ start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
92 94
93 w = GNUNET_new (struct ESCROW_Plugin_AnchorContinuationWrapper); 95 w = GNUNET_new (struct ESCROW_Plugin_AnchorContinuationWrapper);
94 w->h = h; 96 w->h = h;
97 w->op_id = op_id;
95 98
96 if (NULL == ego) 99 if (NULL == ego)
97 { 100 {
@@ -150,6 +153,7 @@ start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
150 * @param ego the identity ego containing the private key 153 * @param ego the identity ego containing the private key
151 * @param escrowAnchor the escrow anchor needed to restore the key 154 * @param escrowAnchor the escrow anchor needed to restore the key
152 * @param cb the function called upon completion 155 * @param cb the function called upon completion
156 * @param op_id unique ID of the respective ESCROW_Operation
153 * 157 *
154 * @return plugin operation wrapper 158 * @return plugin operation wrapper
155 */ 159 */
@@ -157,7 +161,8 @@ struct ESCROW_PluginOperationWrapper *
157verify_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, 161verify_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
158 const struct GNUNET_IDENTITY_Ego *ego, 162 const struct GNUNET_IDENTITY_Ego *ego,
159 struct GNUNET_ESCROW_Anchor *escrowAnchor, 163 struct GNUNET_ESCROW_Anchor *escrowAnchor,
160 GNUNET_SCHEDULER_TaskCallback cb) 164 GNUNET_SCHEDULER_TaskCallback cb,
165 uint32_t op_id)
161{ 166{
162 struct ESCROW_PluginOperationWrapper *plugin_op_wrap; 167 struct ESCROW_PluginOperationWrapper *plugin_op_wrap;
163 struct ESCROW_GnsPluginOperation *p_op; 168 struct ESCROW_GnsPluginOperation *p_op;
@@ -175,6 +180,7 @@ verify_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
175 180
176 w = GNUNET_new (struct ESCROW_Plugin_VerifyContinuationWrapper); 181 w = GNUNET_new (struct ESCROW_Plugin_VerifyContinuationWrapper);
177 w->h = h; 182 w->h = h;
183 w->op_id = op_id;
178 184
179 // TODO: implement 185 // TODO: implement
180 w->verificationResult = GNUNET_ESCROW_INVALID; 186 w->verificationResult = GNUNET_ESCROW_INVALID;
@@ -190,6 +196,7 @@ verify_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
190 * @param escrowAnchor the escrow anchor needed to restore the key 196 * @param escrowAnchor the escrow anchor needed to restore the key
191 * @param egoName the name of the ego to restore 197 * @param egoName the name of the ego to restore
192 * @param cb the function called upon completion 198 * @param cb the function called upon completion
199 * @param op_id unique ID of the respective ESCROW_Operation
193 * 200 *
194 * @return plugin operation wrapper 201 * @return plugin operation wrapper
195 */ 202 */
@@ -197,7 +204,8 @@ struct ESCROW_PluginOperationWrapper *
197restore_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, 204restore_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
198 struct GNUNET_ESCROW_Anchor *escrowAnchor, 205 struct GNUNET_ESCROW_Anchor *escrowAnchor,
199 char *egoName, 206 char *egoName,
200 GNUNET_SCHEDULER_TaskCallback cb) 207 GNUNET_SCHEDULER_TaskCallback cb,
208 uint32_t op_id)
201{ 209{
202 struct ESCROW_PluginOperationWrapper *plugin_op_wrap; 210 struct ESCROW_PluginOperationWrapper *plugin_op_wrap;
203 struct ESCROW_GnsPluginOperation *p_op; 211 struct ESCROW_GnsPluginOperation *p_op;
@@ -215,6 +223,7 @@ restore_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
215 223
216 w = GNUNET_new (struct ESCROW_Plugin_EgoContinuationWrapper); 224 w = GNUNET_new (struct ESCROW_Plugin_EgoContinuationWrapper);
217 w->h = h; 225 w->h = h;
226 w->op_id = op_id;
218 227
219 // TODO: implement 228 // TODO: implement
220 w->ego = NULL; 229 w->ego = NULL;
diff --git a/src/escrow/plugin_escrow_plaintext.c b/src/escrow/plugin_escrow_plaintext.c
index 72579b829..83b2345c6 100644
--- a/src/escrow/plugin_escrow_plaintext.c
+++ b/src/escrow/plugin_escrow_plaintext.c
@@ -133,13 +133,15 @@ start_cont (void *cls)
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 cb the function called upon completion 135 * @param cb the function called upon completion
136 * @param op_id unique ID of the respective ESCROW_Operation
136 * 137 *
137 * @return plugin operation wrapper 138 * @return plugin operation wrapper
138 */ 139 */
139struct ESCROW_PluginOperationWrapper * 140struct ESCROW_PluginOperationWrapper *
140start_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, 141start_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
141 const struct GNUNET_IDENTITY_Ego *ego, 142 const struct GNUNET_IDENTITY_Ego *ego,
142 ESCROW_Plugin_Continuation cb) 143 ESCROW_Plugin_Continuation cb,
144 uint32_t op_id)
143{ 145{
144 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; 146 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
145 struct GNUNET_ESCROW_Anchor *anchor; 147 struct GNUNET_ESCROW_Anchor *anchor;
@@ -162,6 +164,7 @@ start_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
162 164
163 w = GNUNET_new (struct ESCROW_Plugin_AnchorContinuationWrapper); 165 w = GNUNET_new (struct ESCROW_Plugin_AnchorContinuationWrapper);
164 w->h = h; 166 w->h = h;
167 w->op_id = op_id;
165 p_op->anchor_wrap = w; 168 p_op->anchor_wrap = w;
166 169
167 if (NULL == ego) 170 if (NULL == ego)
@@ -206,6 +209,7 @@ verify_cont (void *cls)
206 * @param ego the identity ego containing the private key 209 * @param ego the identity ego containing the private key
207 * @param escrowAnchor the escrow anchor needed to restore the key 210 * @param escrowAnchor the escrow anchor needed to restore the key
208 * @param cb the function called upon completion 211 * @param cb the function called upon completion
212 * @param op_id unique ID of the respective ESCROW_Operation
209 * 213 *
210 * @return plugin operation wrapper 214 * @return plugin operation wrapper
211 */ 215 */
@@ -213,7 +217,8 @@ struct ESCROW_PluginOperationWrapper *
213verify_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, 217verify_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
214 const struct GNUNET_IDENTITY_Ego *ego, 218 const struct GNUNET_IDENTITY_Ego *ego,
215 struct GNUNET_ESCROW_Anchor *escrowAnchor, 219 struct GNUNET_ESCROW_Anchor *escrowAnchor,
216 ESCROW_Plugin_Continuation cb) 220 ESCROW_Plugin_Continuation cb,
221 uint32_t op_id)
217{ 222{
218 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; 223 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
219 char *pkString; 224 char *pkString;
@@ -235,6 +240,7 @@ verify_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
235 240
236 w = GNUNET_new (struct ESCROW_Plugin_VerifyContinuationWrapper); 241 w = GNUNET_new (struct ESCROW_Plugin_VerifyContinuationWrapper);
237 w->h = h; 242 w->h = h;
243 w->op_id = op_id;
238 p_op->verify_wrap = w; 244 p_op->verify_wrap = w;
239 245
240 if (NULL == ego) 246 if (NULL == ego)
@@ -344,6 +350,7 @@ handle_restore_error (void *cls)
344 * @param escrowAnchor the escrow anchor needed to restore the key 350 * @param escrowAnchor the escrow anchor needed to restore the key
345 * @param egoName the name of the ego to restore 351 * @param egoName the name of the ego to restore
346 * @param cb the function called upon completion 352 * @param cb the function called upon completion
353 * @param op_id unique ID of the respective ESCROW_Operation
347 * 354 *
348 * @return plugin operation wrapper 355 * @return plugin operation wrapper
349 */ 356 */
@@ -351,7 +358,8 @@ struct ESCROW_PluginOperationWrapper *
351restore_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, 358restore_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
352 struct GNUNET_ESCROW_Anchor *escrowAnchor, 359 struct GNUNET_ESCROW_Anchor *escrowAnchor,
353 char *egoName, 360 char *egoName,
354 ESCROW_Plugin_Continuation cb) 361 ESCROW_Plugin_Continuation cb,
362 uint32_t op_id)
355{ 363{
356 struct GNUNET_CRYPTO_EcdsaPrivateKey pk; 364 struct GNUNET_CRYPTO_EcdsaPrivateKey pk;
357 struct GNUNET_IDENTITY_Operation *id_op; 365 struct GNUNET_IDENTITY_Operation *id_op;
@@ -373,6 +381,7 @@ restore_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
373 381
374 w = GNUNET_new (struct ESCROW_Plugin_EgoContinuationWrapper); 382 w = GNUNET_new (struct ESCROW_Plugin_EgoContinuationWrapper);
375 w->h = h; 383 w->h = h;
384 w->op_id = op_id;
376 p_op->ego_wrap = w; 385 p_op->ego_wrap = w;
377 386
378 if (NULL == escrowAnchor) 387 if (NULL == escrowAnchor)
diff --git a/src/include/gnunet_escrow_lib.h b/src/include/gnunet_escrow_lib.h
index 4eeaff3fd..9a6849a52 100644
--- a/src/include/gnunet_escrow_lib.h
+++ b/src/include/gnunet_escrow_lib.h
@@ -157,6 +157,11 @@ struct GNUNET_ESCROW_Handle
157 * Tail of active operations. 157 * Tail of active operations.
158 */ 158 */
159 struct GNUNET_ESCROW_Operation *op_tail; 159 struct GNUNET_ESCROW_Operation *op_tail;
160
161 /**
162 * The last operation id used for an ESCROW operation.
163 */
164 uint32_t last_op_id_used;
160}; 165};
161 166
162 167
@@ -171,6 +176,11 @@ struct GNUNET_ESCROW_Operation
171 struct GNUNET_ESCROW_Handle *h; 176 struct GNUNET_ESCROW_Handle *h;
172 177
173 /** 178 /**
179 * ID of the operation.
180 */
181 uint32_t id;
182
183 /**
174 * We keep operations in a DLL. 184 * We keep operations in a DLL.
175 */ 185 */
176 struct GNUNET_ESCROW_Operation *next; 186 struct GNUNET_ESCROW_Operation *next;
diff --git a/src/include/gnunet_escrow_plugin.h b/src/include/gnunet_escrow_plugin.h
index 449921a8e..9b0f0356f 100644
--- a/src/include/gnunet_escrow_plugin.h
+++ b/src/include/gnunet_escrow_plugin.h
@@ -50,13 +50,15 @@ extern "C" {
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 cb the function called upon completion 52 * @param cb the function called upon completion
53 * @param op_id unique ID of the respective ESCROW_Operation
53 * 54 *
54 * @return a wrapper for the plugin operation 55 * @return a wrapper for the plugin operation
55 */ 56 */
56typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_StartKeyEscrowFunction) ( 57typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_StartKeyEscrowFunction) (
57 struct GNUNET_ESCROW_Handle *h, 58 struct GNUNET_ESCROW_Handle *h,
58 const struct GNUNET_IDENTITY_Ego *ego, 59 const struct GNUNET_IDENTITY_Ego *ego,
59 GNUNET_SCHEDULER_TaskCallback cb); 60 GNUNET_SCHEDULER_TaskCallback cb,
61 uint32_t op_id);
60 62
61/** 63/**
62 * Function called to verify the escrow of the key 64 * Function called to verify the escrow of the key
@@ -65,6 +67,7 @@ typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_StartKeyEscrowFunc
65 * @param ego the identity ego containing the private key 67 * @param ego the identity ego containing the private key
66 * @param escrowAnchor the escrow anchor needed to restore the key 68 * @param escrowAnchor the escrow anchor needed to restore the key
67 * @param cb the function called upon completion 69 * @param cb the function called upon completion
70 * @param op_id unique ID of the respective ESCROW_Operation
68 * 71 *
69 * @return a wrapper for the plugin operation 72 * @return a wrapper for the plugin operation
70 */ 73 */
@@ -72,7 +75,8 @@ typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_VerifyKeyEscrowFun
72 struct GNUNET_ESCROW_Handle *h, 75 struct GNUNET_ESCROW_Handle *h,
73 const struct GNUNET_IDENTITY_Ego *ego, 76 const struct GNUNET_IDENTITY_Ego *ego,
74 struct GNUNET_ESCROW_Anchor *escrowAnchor, 77 struct GNUNET_ESCROW_Anchor *escrowAnchor,
75 GNUNET_SCHEDULER_TaskCallback cb); 78 GNUNET_SCHEDULER_TaskCallback cb,
79 uint32_t op_id);
76 80
77/** 81/**
78 * Function called to restore a key from an escrow 82 * Function called to restore a key from an escrow
@@ -81,6 +85,7 @@ typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_VerifyKeyEscrowFun
81 * @param escrowAnchor the escrow anchor needed to restore the key 85 * @param escrowAnchor the escrow anchor needed to restore the key
82 * @param egoName the name of the ego to restore 86 * @param egoName the name of the ego to restore
83 * @param cb the function called upon completion 87 * @param cb the function called upon completion
88 * @param op_id unique ID of the respective ESCROW_Operation
84 * 89 *
85 * @return a wrapper for the plugin operation 90 * @return a wrapper for the plugin operation
86 */ 91 */
@@ -88,7 +93,8 @@ typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_RestoreKeyFunction
88 struct GNUNET_ESCROW_Handle *h, 93 struct GNUNET_ESCROW_Handle *h,
89 struct GNUNET_ESCROW_Anchor *escrowAnchor, 94 struct GNUNET_ESCROW_Anchor *escrowAnchor,
90 char *egoName, 95 char *egoName,
91 GNUNET_SCHEDULER_TaskCallback cb); 96 GNUNET_SCHEDULER_TaskCallback cb,
97 uint32_t op_id);
92 98
93 99
94/** 100/**