aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjospaeth <spaethj@in.tum.de>2020-08-08 21:29:12 +0200
committerjospaeth <spaethj@in.tum.de>2020-08-08 21:29:12 +0200
commita2280bff1c996cfe70326602c0204f8637c2c20b (patch)
tree084bfa8c580b1470ffb0b43dfb6c3b895bd21fe8 /src
parent7dc7d65cd35ac00c7495d81da4456b73c1928b11 (diff)
downloadgnunet-a2280bff1c996cfe70326602c0204f8637c2c20b.tar.gz
gnunet-a2280bff1c996cfe70326602c0204f8637c2c20b.zip
store escrow status to config
Diffstat (limited to 'src')
-rw-r--r--src/escrow/escrow_api.c16
-rw-r--r--src/escrow/escrow_plugin_helper.c182
-rw-r--r--src/escrow/escrow_plugin_helper.h33
-rw-r--r--src/escrow/gnunet-escrow.c15
-rw-r--r--src/escrow/plugin_escrow_anastasis.c16
-rw-r--r--src/escrow/plugin_escrow_gns.c16
-rw-r--r--src/escrow/plugin_escrow_plaintext.c19
-rw-r--r--src/include/gnunet_escrow_lib.h14
-rw-r--r--src/include/gnunet_escrow_plugin.h6
9 files changed, 250 insertions, 67 deletions
diff --git a/src/escrow/escrow_api.c b/src/escrow/escrow_api.c
index 49f5c3dea..acf17c500 100644
--- a/src/escrow/escrow_api.c
+++ b/src/escrow/escrow_api.c
@@ -108,6 +108,9 @@ init_plugin (struct GNUNET_ESCROW_Handle *h,
108 anastasis_api = GNUNET_PLUGIN_load ("libgnunet_plugin_escrow_anastasis", 108 anastasis_api = GNUNET_PLUGIN_load ("libgnunet_plugin_escrow_anastasis",
109 (void *)h->cfg); 109 (void *)h->cfg);
110 return anastasis_api; 110 return anastasis_api;
111 case GNUNET_ESCROW_KEY_NONE: // error case
112 fprintf (stderr, "incorrect escrow method!");
113 return NULL;
111 } 114 }
112 // should never be reached 115 // should never be reached
113 return NULL; 116 return NULL;
@@ -141,7 +144,7 @@ GNUNET_ESCROW_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
141 struct GNUNET_ESCROW_Handle *h; 144 struct GNUNET_ESCROW_Handle *h;
142 145
143 h = GNUNET_new (struct GNUNET_ESCROW_Handle); 146 h = GNUNET_new (struct GNUNET_ESCROW_Handle);
144 h->cfg = cfg; 147 h->cfg = GNUNET_CONFIGURATION_dup (cfg);
145 h->op_head = NULL; 148 h->op_head = NULL;
146 h->op_tail = NULL; 149 h->op_tail = NULL;
147 return h; 150 return h;
@@ -193,6 +196,9 @@ GNUNET_ESCROW_fini (struct GNUNET_ESCROW_Handle *h)
193 GNUNET_ESCROW_cancel (op); 196 GNUNET_ESCROW_cancel (op);
194 } 197 }
195 198
199 /* free the configuration */
200 GNUNET_free (h->cfg);
201
196 /* free the escrow handle */ 202 /* free the escrow handle */
197 GNUNET_free (h); 203 GNUNET_free (h);
198} 204}
@@ -233,7 +239,7 @@ handle_start_escrow_result (void *cls)
233 */ 239 */
234struct GNUNET_ESCROW_Operation * 240struct GNUNET_ESCROW_Operation *
235GNUNET_ESCROW_put (struct GNUNET_ESCROW_Handle *h, 241GNUNET_ESCROW_put (struct GNUNET_ESCROW_Handle *h,
236 const struct GNUNET_IDENTITY_Ego *ego, 242 struct GNUNET_IDENTITY_Ego *ego,
237 enum GNUNET_ESCROW_Key_Escrow_Method method, 243 enum GNUNET_ESCROW_Key_Escrow_Method method,
238 GNUNET_ESCROW_AnchorContinuation cb, 244 GNUNET_ESCROW_AnchorContinuation cb,
239 void *cb_cls) 245 void *cb_cls)
@@ -383,21 +389,19 @@ GNUNET_ESCROW_verify (struct GNUNET_ESCROW_Handle *h,
383 * 389 *
384 * @param h the handle for the escrow component 390 * @param h the handle for the escrow component
385 * @param ego the identity ego of which the escrow status has to be determined 391 * @param ego the identity ego of which the escrow status has to be determined
386 * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method
387 * @param method the escrow method to use 392 * @param method the escrow method to use
388 * 393 *
389 * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct 394 * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct
390 */ 395 */
391struct GNUNET_ESCROW_Status * 396struct GNUNET_ESCROW_Status *
392GNUNET_ESCROW_get_status (struct GNUNET_ESCROW_Handle *h, 397GNUNET_ESCROW_get_status (struct GNUNET_ESCROW_Handle *h,
393 const struct GNUNET_IDENTITY_Ego *ego, 398 struct GNUNET_IDENTITY_Ego *ego,
394 struct GNUNET_ESCROW_Anchor *escrowAnchor,
395 enum GNUNET_ESCROW_Key_Escrow_Method method) 399 enum GNUNET_ESCROW_Key_Escrow_Method method)
396{ 400{
397 const struct GNUNET_ESCROW_KeyPluginFunctions *api; 401 const struct GNUNET_ESCROW_KeyPluginFunctions *api;
398 402
399 api = init_plugin (h, method); 403 api = init_plugin (h, method);
400 return api->get_status (h, ego, escrowAnchor); 404 return api->get_status (h, ego);
401} 405}
402 406
403 407
diff --git a/src/escrow/escrow_plugin_helper.c b/src/escrow/escrow_plugin_helper.c
index 7a69d4a0d..36acae049 100644
--- a/src/escrow/escrow_plugin_helper.c
+++ b/src/escrow/escrow_plugin_helper.c
@@ -176,4 +176,186 @@ ESCROW_cleanup_ego_list (struct ESCROW_PluginHandle *ph)
176} 176}
177 177
178 178
179char *
180string_to_upper (const char *str)
181{
182 char *str_upper;
183 uint16_t i;
184
185 str_upper = GNUNET_strdup (str);
186
187 for (i = 0; i < strlen(str_upper); i++)
188 {
189 if (str_upper[i] >= 'a' && str_upper[i] <= 'z')
190 str_upper[i] -= 32; // 'a' - 'A' = 32
191 }
192
193 return str_upper;
194}
195
196
197/**
198 * Update the status of an escrow in the configuration.
199 *
200 * @param h handle for the escrow component
201 * @param ego the ego of which the escrow status is updated
202 * @param plugin_name the name of the used plugin
203 *
204 * @return GNUNET_OK on success
205 */
206int
207ESCROW_update_escrow_status (struct GNUNET_ESCROW_Handle *h,
208 struct GNUNET_IDENTITY_Ego *ego,
209 const char *plugin_name)
210{
211 struct GNUNET_CRYPTO_EcdsaPublicKey *pub;
212 char *config_section, *pubkey_string, *config_option, *plugin_name_upper;
213 struct GNUNET_TIME_Absolute now, next_escrow;
214 struct GNUNET_TIME_Relative escrow_interval;
215 char *conf_file;
216
217 pub = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey);
218 GNUNET_IDENTITY_ego_get_public_key (ego, pub);
219 pubkey_string = GNUNET_CRYPTO_ecdsa_public_key_to_string (pub);
220
221 // allocate enough space for "escrow-PUBKEY"
222 config_section = GNUNET_malloc (7 + strlen (pubkey_string) + 1);
223 sprintf (config_section, "escrow-%s", pubkey_string);
224
225 // allocate enough space for "<plugin_name>_INTERVAL"
226 config_option = GNUNET_malloc (strlen (plugin_name) + 9 + 1);
227 plugin_name_upper = string_to_upper (plugin_name);
228 sprintf (config_option, "%s_INTERVAL", plugin_name_upper);
229
230 now = GNUNET_TIME_absolute_get ();
231 GNUNET_CONFIGURATION_set_value_number (h->cfg,
232 config_section,
233 "LAST_ESCROW_TIME",
234 (unsigned long long)now.abs_value_us);
235 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (h->cfg,
236 "escrow",
237 config_option,
238 &escrow_interval))
239 {
240 fprintf (stderr, "could not find config value for escrow interval\n");
241 GNUNET_free (pub);
242 GNUNET_free (config_section);
243 GNUNET_free (pubkey_string);
244 GNUNET_free (config_option);
245 GNUNET_free (plugin_name_upper);
246 return GNUNET_NO;
247 }
248 next_escrow = GNUNET_TIME_absolute_add (now, escrow_interval);
249 GNUNET_CONFIGURATION_set_value_number (h->cfg,
250 config_section,
251 "NEXT_RECOMMENDED_ESCROW_TIME",
252 (unsigned long long)next_escrow.abs_value_us);
253
254 GNUNET_CONFIGURATION_set_value_string (h->cfg,
255 config_section,
256 "ESCROW_METHOD",
257 plugin_name);
258
259 GNUNET_assert (GNUNET_OK ==
260 GNUNET_CONFIGURATION_get_value_filename (h->cfg,
261 "PATHS",
262 "DEFAULTCONFIG",
263 &conf_file));
264 if (GNUNET_OK != GNUNET_CONFIGURATION_write (h->cfg, conf_file))
265 {
266 fprintf (stderr, "unable to write config file\n");
267 GNUNET_free (pub);
268 GNUNET_free (config_section);
269 GNUNET_free (pubkey_string);
270 GNUNET_free (config_option);
271 GNUNET_free (plugin_name_upper);
272 GNUNET_free (conf_file);
273 return GNUNET_NO;
274 }
275
276 GNUNET_free (pub);
277 GNUNET_free (config_section);
278 GNUNET_free (pubkey_string);
279 GNUNET_free (config_option);
280 GNUNET_free (plugin_name_upper);
281 GNUNET_free (conf_file);
282
283 return GNUNET_OK;
284}
285
286
287/**
288 * Get the status of an escrow from the configuration.
289 *
290 * @param h handle for the escrow component
291 * @param ego the ego of which the escrow status has to be obtained
292 *
293 * @return the status of the escrow, packed into a GNUNET_ESCROW_Status struct
294 */
295struct GNUNET_ESCROW_Status *
296ESCROW_get_escrow_status (struct GNUNET_ESCROW_Handle *h,
297 struct GNUNET_IDENTITY_Ego *ego)
298{
299 struct GNUNET_ESCROW_Status *status;
300 unsigned long long conf_last_escrow, conf_next_escrow;
301 struct GNUNET_CRYPTO_EcdsaPublicKey *pub;
302 char *config_section, *pubkey_string, *conf_escrow_method;
303
304 pub = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey);
305 GNUNET_IDENTITY_ego_get_public_key (ego, pub);
306 pubkey_string = GNUNET_CRYPTO_ecdsa_public_key_to_string (pub);
307
308 // allocate enough space for "escrow-PUBKEY"
309 config_section = GNUNET_malloc (7 + strlen (pubkey_string) + 1);
310 sprintf (config_section, "escrow-%s", pubkey_string);
311
312 status = GNUNET_new (struct GNUNET_ESCROW_Status);
313 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (h->cfg,
314 config_section,
315 "LAST_ESCROW_TIME",
316 &conf_last_escrow))
317 {
318 // TODO: is that the behavior when the section is not defined?
319 status->last_escrow_time = GNUNET_TIME_absolute_get_zero_();
320 }
321 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (h->cfg,
322 config_section,
323 "NEXT_RECOMMENDED_ESCROW_TIME",
324 &conf_next_escrow))
325 {
326 // TODO: is that the behavior when the section is not defined?
327 status->next_recommended_escrow_time = GNUNET_TIME_absolute_get ();
328 }
329 status->last_method = GNUNET_ESCROW_KEY_NONE;
330 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (h->cfg,
331 config_section,
332 "ESCROW_METHOD",
333 &conf_escrow_method))
334 {
335 // TODO: error handling?
336 }
337 status->last_escrow_time.abs_value_us = (uint64_t)conf_last_escrow;
338 status->next_recommended_escrow_time.abs_value_us = (uint64_t)conf_next_escrow;
339 if (NULL != conf_escrow_method)
340 {
341 if (NULL != conf_escrow_method && 0 == strcmp (conf_escrow_method, "plaintext"))
342 status->last_method = GNUNET_ESCROW_KEY_PLAINTEXT;
343 else if (0 == strcmp (conf_escrow_method, "gns"))
344 status->last_method = GNUNET_ESCROW_KEY_GNS;
345 else if (0 == strcmp (conf_escrow_method, "anastasis"))
346 status->last_method = GNUNET_ESCROW_KEY_ANASTASIS;
347 else
348 status->last_method = GNUNET_ESCROW_KEY_NONE;
349 }
350
351
352 GNUNET_free (config_section);
353 GNUNET_free (pubkey_string);
354 GNUNET_free (pub);
355 GNUNET_free (conf_escrow_method);
356
357 return status;
358}
359
360
179/* end of escrow_plugin.c */ 361/* end of escrow_plugin.c */
diff --git a/src/escrow/escrow_plugin_helper.h b/src/escrow/escrow_plugin_helper.h
index d0409bc38..f2a54eb6b 100644
--- a/src/escrow/escrow_plugin_helper.h
+++ b/src/escrow/escrow_plugin_helper.h
@@ -67,9 +67,9 @@
67 */ 67 */
68void 68void
69ESCROW_list_ego (void *cls, 69ESCROW_list_ego (void *cls,
70 struct GNUNET_IDENTITY_Ego *ego, 70 struct GNUNET_IDENTITY_Ego *ego,
71 void **ctx, 71 void **ctx,
72 const char *identifier); 72 const char *identifier);
73 73
74 74
75/** 75/**
@@ -79,3 +79,30 @@ ESCROW_list_ego (void *cls,
79 */ 79 */
80void 80void
81ESCROW_cleanup_ego_list (struct ESCROW_PluginHandle *ph); 81ESCROW_cleanup_ego_list (struct ESCROW_PluginHandle *ph);
82
83
84/**
85 * Update the status of an escrow in the configuration.
86 *
87 * @param h handle for the escrow component
88 * @param ego the ego of which the escrow status is updated
89 * @param plugin_name the name of the used plugin
90 *
91 * @return GNUNET_OK on success
92 */
93int
94ESCROW_update_escrow_status (struct GNUNET_ESCROW_Handle *h,
95 struct GNUNET_IDENTITY_Ego *ego,
96 const char *plugin_name);
97
98/**
99 * Get the status of an escrow from the configuration.
100 *
101 * @param h handle for the escrow component
102 * @param ego the ego of which the escrow status has to be obtained
103 *
104 * @return the status of the escrow, packed into a GNUNET_ESCROW_Status struct
105 */
106struct GNUNET_ESCROW_Status *
107ESCROW_get_escrow_status (struct GNUNET_ESCROW_Handle *h,
108 struct GNUNET_IDENTITY_Ego *ego);
diff --git a/src/escrow/gnunet-escrow.c b/src/escrow/gnunet-escrow.c
index 91ad4fbbe..f8dc835a8 100644
--- a/src/escrow/gnunet-escrow.c
+++ b/src/escrow/gnunet-escrow.c
@@ -73,7 +73,7 @@ static char *status_ego;
73/** 73/**
74 * The ego 74 * The ego
75 */ 75 */
76const struct GNUNET_IDENTITY_Ego *ego; 76struct GNUNET_IDENTITY_Ego *ego;
77 77
78/** 78/**
79 * Anchor string 79 * Anchor string
@@ -313,12 +313,13 @@ start_process ()
313 } 313 }
314 escrow_status = GNUNET_ESCROW_get_status (escrow_handle, 314 escrow_status = GNUNET_ESCROW_get_status (escrow_handle,
315 ego, 315 ego,
316 anchor,
317 method); 316 method);
318 // TODO: formatting/interpretation 317 // TODO: formatting/interpretation
319 fprintf (stdout, "Last escrow:\t\t\t%s\nNext recommended escrow:\t%s\n", 318 fprintf (stdout, "Last escrow:\t\t\t%s\n",
320 GNUNET_STRINGS_absolute_time_to_string (escrow_status->last_escrow_time), 319 GNUNET_STRINGS_absolute_time_to_string (escrow_status->last_escrow_time));
320 fprintf (stdout, "Next recommended escrow:\t%s\n",
321 GNUNET_STRINGS_absolute_time_to_string (escrow_status->next_recommended_escrow_time)); 321 GNUNET_STRINGS_absolute_time_to_string (escrow_status->next_recommended_escrow_time));
322 fprintf (stdout, "Last method:\t\t\t%d\n", escrow_status->last_method);
322 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 323 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
323 return; 324 return;
324 } 325 }
@@ -416,12 +417,6 @@ run (void *cls,
416 else if (NULL != status_ego) 417 else if (NULL != status_ego)
417 { 418 {
418 /* status */ 419 /* status */
419 if (NULL == anchor_string)
420 {
421 ret = 1;
422 fprintf (stderr, _ ("-a is needed for -S!\n"));
423 return;
424 }
425 ego_name = status_ego; 420 ego_name = status_ego;
426 } 421 }
427 else 422 else
diff --git a/src/escrow/plugin_escrow_anastasis.c b/src/escrow/plugin_escrow_anastasis.c
index 538754a6d..92fc75ae6 100644
--- a/src/escrow/plugin_escrow_anastasis.c
+++ b/src/escrow/plugin_escrow_anastasis.c
@@ -54,7 +54,7 @@ struct ESCROW_PluginHandle ph;
54 */ 54 */
55struct ESCROW_PluginOperationWrapper * 55struct ESCROW_PluginOperationWrapper *
56start_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h, 56start_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
57 const struct GNUNET_IDENTITY_Ego *ego, 57 struct GNUNET_IDENTITY_Ego *ego,
58 GNUNET_SCHEDULER_TaskCallback cb, 58 GNUNET_SCHEDULER_TaskCallback cb,
59 uint32_t op_id) 59 uint32_t op_id)
60{ 60{
@@ -138,24 +138,14 @@ restore_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
138 * 138 *
139 * @param h the handle for the escrow component 139 * @param h the handle for the escrow component
140 * @param ego the identity ego of which the status has to be obtained 140 * @param ego the identity ego of which the status has to be obtained
141 * @param escrowAnchor the escrow anchor needed to restore the key
142 * 141 *
143 * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct 142 * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct
144 */ 143 */
145struct GNUNET_ESCROW_Status * 144struct GNUNET_ESCROW_Status *
146anastasis_get_status (struct GNUNET_ESCROW_Handle *h, 145anastasis_get_status (struct GNUNET_ESCROW_Handle *h,
147 const struct GNUNET_IDENTITY_Ego *ego, 146 struct GNUNET_IDENTITY_Ego *ego)
148 struct GNUNET_ESCROW_Anchor *escrowAnchor)
149{ 147{
150 struct GNUNET_ESCROW_Status *status; 148 return ESCROW_get_escrow_status (h, ego);
151
152 status = GNUNET_new (struct GNUNET_ESCROW_Status);
153 // TODO: get the correct time values
154 status->last_escrow_time = GNUNET_TIME_absolute_get ();
155 status->next_recommended_escrow_time = GNUNET_TIME_absolute_get ();
156 // END TODO
157
158 return status;
159} 149}
160 150
161 151
diff --git a/src/escrow/plugin_escrow_gns.c b/src/escrow/plugin_escrow_gns.c
index 8a3d4e033..8c2ac0de4 100644
--- a/src/escrow/plugin_escrow_gns.c
+++ b/src/escrow/plugin_escrow_gns.c
@@ -432,7 +432,7 @@ create_escrow_identities (struct ESCROW_GnsPluginOperation *p_op,
432 */ 432 */
433struct ESCROW_PluginOperationWrapper * 433struct ESCROW_PluginOperationWrapper *
434start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, 434start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
435 const struct GNUNET_IDENTITY_Ego *ego, 435 struct GNUNET_IDENTITY_Ego *ego,
436 GNUNET_SCHEDULER_TaskCallback cb, 436 GNUNET_SCHEDULER_TaskCallback cb,
437 uint32_t op_id) 437 uint32_t op_id)
438{ 438{
@@ -605,24 +605,14 @@ restore_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
605 * 605 *
606 * @param h the handle for the escrow component 606 * @param h the handle for the escrow component
607 * @param ego the identity ego of which the status has to be obtained 607 * @param ego the identity ego of which the status has to be obtained
608 * @param escrowAnchor the escrow anchor needed to restore the key
609 * 608 *
610 * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct 609 * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct
611 */ 610 */
612struct GNUNET_ESCROW_Status * 611struct GNUNET_ESCROW_Status *
613gns_get_status (struct GNUNET_ESCROW_Handle *h, 612gns_get_status (struct GNUNET_ESCROW_Handle *h,
614 const struct GNUNET_IDENTITY_Ego *ego, 613 struct GNUNET_IDENTITY_Ego *ego)
615 struct GNUNET_ESCROW_Anchor *escrowAnchor)
616{ 614{
617 struct GNUNET_ESCROW_Status *status; 615 return ESCROW_get_escrow_status (h, ego);
618
619 status = GNUNET_new (struct GNUNET_ESCROW_Status);
620 // TODO: get the correct time values
621 status->last_escrow_time = GNUNET_TIME_absolute_get ();
622 status->next_recommended_escrow_time = GNUNET_TIME_absolute_get ();
623 // END TODO
624
625 return status;
626} 616}
627 617
628 618
diff --git a/src/escrow/plugin_escrow_plaintext.c b/src/escrow/plugin_escrow_plaintext.c
index 7de922104..9406361d7 100644
--- a/src/escrow/plugin_escrow_plaintext.c
+++ b/src/escrow/plugin_escrow_plaintext.c
@@ -139,7 +139,7 @@ start_cont (void *cls)
139 */ 139 */
140struct ESCROW_PluginOperationWrapper * 140struct ESCROW_PluginOperationWrapper *
141start_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, 141start_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
142 const struct GNUNET_IDENTITY_Ego *ego, 142 struct GNUNET_IDENTITY_Ego *ego,
143 ESCROW_Plugin_Continuation cb, 143 ESCROW_Plugin_Continuation cb,
144 uint32_t op_id) 144 uint32_t op_id)
145{ 145{
@@ -184,6 +184,9 @@ start_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
184 184
185 w->escrowAnchor = anchor; 185 w->escrowAnchor = anchor;
186 186
187 /* set the last escrow time */
188 ESCROW_update_escrow_status (h, ego, "plaintext");
189
187 p_op->sched_task = GNUNET_SCHEDULER_add_now (&start_cont, plugin_op_wrap); 190 p_op->sched_task = GNUNET_SCHEDULER_add_now (&start_cont, plugin_op_wrap);
188 return plugin_op_wrap; 191 return plugin_op_wrap;
189} 192}
@@ -417,24 +420,14 @@ restore_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
417 * 420 *
418 * @param h the handle for the escrow component 421 * @param h the handle for the escrow component
419 * @param ego the identity ego of which the status has to be obtained 422 * @param ego the identity ego of which the status has to be obtained
420 * @param escrowAnchor the escrow anchor needed to restore the key
421 * 423 *
422 * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct 424 * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct
423 */ 425 */
424struct GNUNET_ESCROW_Status * 426struct GNUNET_ESCROW_Status *
425plaintext_get_status (struct GNUNET_ESCROW_Handle *h, 427plaintext_get_status (struct GNUNET_ESCROW_Handle *h,
426 const struct GNUNET_IDENTITY_Ego *ego, 428 struct GNUNET_IDENTITY_Ego *ego)
427 struct GNUNET_ESCROW_Anchor *escrowAnchor)
428{ 429{
429 struct GNUNET_ESCROW_Status *status; 430 return ESCROW_get_escrow_status (h, ego);
430
431 status = GNUNET_new (struct GNUNET_ESCROW_Status);
432 // TODO: get the correct time values
433 status->last_escrow_time = GNUNET_TIME_absolute_get ();
434 status->next_recommended_escrow_time = GNUNET_TIME_absolute_get ();
435 // END TODO
436
437 return status;
438} 431}
439 432
440 433
diff --git a/src/include/gnunet_escrow_lib.h b/src/include/gnunet_escrow_lib.h
index 3573f4870..07321c9e2 100644
--- a/src/include/gnunet_escrow_lib.h
+++ b/src/include/gnunet_escrow_lib.h
@@ -45,6 +45,7 @@ extern "C" {
45 * Enum for the different key escrow methods 45 * Enum for the different key escrow methods
46 */ 46 */
47enum GNUNET_ESCROW_Key_Escrow_Method { 47enum GNUNET_ESCROW_Key_Escrow_Method {
48 GNUNET_ESCROW_KEY_NONE, // error value
48 GNUNET_ESCROW_KEY_PLAINTEXT, 49 GNUNET_ESCROW_KEY_PLAINTEXT,
49 GNUNET_ESCROW_KEY_GNS, 50 GNUNET_ESCROW_KEY_GNS,
50 GNUNET_ESCROW_KEY_ANASTASIS 51 GNUNET_ESCROW_KEY_ANASTASIS
@@ -89,6 +90,11 @@ struct GNUNET_ESCROW_Status {
89 * The time of the next recommended escrow. 90 * The time of the next recommended escrow.
90 */ 91 */
91 struct GNUNET_TIME_Absolute next_recommended_escrow_time; 92 struct GNUNET_TIME_Absolute next_recommended_escrow_time;
93
94 /**
95 * The used escrow method.
96 */
97 enum GNUNET_ESCROW_Key_Escrow_Method last_method;
92}; 98};
93 99
94 100
@@ -146,7 +152,7 @@ struct GNUNET_ESCROW_Handle
146 /** 152 /**
147 * Configuration to use. 153 * Configuration to use.
148 */ 154 */
149 const struct GNUNET_CONFIGURATION_Handle *cfg; 155 struct GNUNET_CONFIGURATION_Handle *cfg;
150 156
151 /** 157 /**
152 * Head of active operations. 158 * Head of active operations.
@@ -273,7 +279,7 @@ GNUNET_ESCROW_fini (
273struct GNUNET_ESCROW_Operation * 279struct GNUNET_ESCROW_Operation *
274GNUNET_ESCROW_put ( 280GNUNET_ESCROW_put (
275 struct GNUNET_ESCROW_Handle *h, 281 struct GNUNET_ESCROW_Handle *h,
276 const struct GNUNET_IDENTITY_Ego *ego, 282 struct GNUNET_IDENTITY_Ego *ego,
277 enum GNUNET_ESCROW_Key_Escrow_Method method, 283 enum GNUNET_ESCROW_Key_Escrow_Method method,
278 GNUNET_ESCROW_AnchorContinuation cb, 284 GNUNET_ESCROW_AnchorContinuation cb,
279 void *cb_cls); 285 void *cb_cls);
@@ -330,7 +336,6 @@ GNUNET_ESCROW_verify (
330 * 336 *
331 * @param h the handle for the escrow component 337 * @param h the handle for the escrow component
332 * @param ego the identity ego of which the escrow status has to be determined 338 * @param ego the identity ego of which the escrow status has to be determined
333 * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method
334 * @param method the escrow method to use 339 * @param method the escrow method to use
335 * 340 *
336 * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct 341 * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct
@@ -338,8 +343,7 @@ GNUNET_ESCROW_verify (
338struct GNUNET_ESCROW_Status * 343struct GNUNET_ESCROW_Status *
339GNUNET_ESCROW_get_status ( 344GNUNET_ESCROW_get_status (
340 struct GNUNET_ESCROW_Handle *h, 345 struct GNUNET_ESCROW_Handle *h,
341 const struct GNUNET_IDENTITY_Ego *ego, 346 struct GNUNET_IDENTITY_Ego *ego,
342 struct GNUNET_ESCROW_Anchor *escrowAnchor,
343 enum GNUNET_ESCROW_Key_Escrow_Method method); 347 enum GNUNET_ESCROW_Key_Escrow_Method method);
344 348
345 349
diff --git a/src/include/gnunet_escrow_plugin.h b/src/include/gnunet_escrow_plugin.h
index bb9f09d78..85cc48b89 100644
--- a/src/include/gnunet_escrow_plugin.h
+++ b/src/include/gnunet_escrow_plugin.h
@@ -56,7 +56,7 @@ extern "C" {
56 */ 56 */
57typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_StartKeyEscrowFunction) ( 57typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_StartKeyEscrowFunction) (
58 struct GNUNET_ESCROW_Handle *h, 58 struct GNUNET_ESCROW_Handle *h,
59 const struct GNUNET_IDENTITY_Ego *ego, 59 struct GNUNET_IDENTITY_Ego *ego,
60 GNUNET_SCHEDULER_TaskCallback cb, 60 GNUNET_SCHEDULER_TaskCallback cb,
61 uint32_t op_id); 61 uint32_t op_id);
62 62
@@ -104,14 +104,12 @@ typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_RestoreKeyFunction
104 * 104 *
105 * @param h the handle for the escrow component 105 * @param h the handle for the escrow component
106 * @param ego the identity ego of which the status has to be obtained 106 * @param ego the identity ego of which the status has to be obtained
107 * @param escrowAnchor the escrow anchor needed to restore the key
108 * 107 *
109 * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct 108 * @return the status of the escrow packed into a GNUNET_ESCROW_Status struct
110 */ 109 */
111typedef struct GNUNET_ESCROW_Status *(*GNUNET_ESCROW_GetEscrowStatusFunction) ( 110typedef struct GNUNET_ESCROW_Status *(*GNUNET_ESCROW_GetEscrowStatusFunction) (
112 struct GNUNET_ESCROW_Handle *h, 111 struct GNUNET_ESCROW_Handle *h,
113 const struct GNUNET_IDENTITY_Ego *ego, 112 struct GNUNET_IDENTITY_Ego *ego);
114 struct GNUNET_ESCROW_Anchor *escrowAnchor);
115 113
116 114
117/** 115/**