aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjospaeth <spaethj@in.tum.de>2020-09-02 21:36:05 +0200
committerjospaeth <spaethj@in.tum.de>2020-09-02 21:36:05 +0200
commit3fd3f3fbc9c2f83b3505d4aafe026817944e73c1 (patch)
treea91a4b93714cd7361b8ec70488809dfd879a1661
parente431696955001e45836ab5d2eeda6e49120049e1 (diff)
downloadgnunet-3fd3f3fbc9c2f83b3505d4aafe026817944e73c1.tar.gz
gnunet-3fd3f3fbc9c2f83b3505d4aafe026817944e73c1.zip
minor improvements
add static/const
-rw-r--r--src/escrow/escrow_api.c12
-rw-r--r--src/escrow/escrow_plugin_helper.c2
-rw-r--r--src/escrow/gnunet-escrow.c1
-rw-r--r--src/escrow/plugin_escrow_anastasis.c8
-rw-r--r--src/escrow/plugin_escrow_gns.c16
-rw-r--r--src/escrow/plugin_escrow_plaintext.c18
-rw-r--r--src/include/gnunet_escrow_lib.h4
-rw-r--r--src/include/gnunet_escrow_plugin.h4
8 files changed, 33 insertions, 32 deletions
diff --git a/src/escrow/escrow_api.c b/src/escrow/escrow_api.c
index 4b3f5e68d..5d1701405 100644
--- a/src/escrow/escrow_api.c
+++ b/src/escrow/escrow_api.c
@@ -99,8 +99,8 @@ static struct GNUNET_ESCROW_KeyPluginFunctions *anastasis_api;
99 * 99 *
100 * @return pointer to the escrow plugin API 100 * @return pointer to the escrow plugin API
101 */ 101 */
102const struct GNUNET_ESCROW_KeyPluginFunctions * 102static const struct GNUNET_ESCROW_KeyPluginFunctions *
103init_plugin (struct GNUNET_ESCROW_Handle *h, 103init_plugin (const struct GNUNET_ESCROW_Handle *h,
104 enum GNUNET_ESCROW_Key_Escrow_Method method) 104 enum GNUNET_ESCROW_Key_Escrow_Method method)
105{ 105{
106 switch (method) 106 switch (method)
@@ -228,7 +228,7 @@ GNUNET_ESCROW_fini (struct GNUNET_ESCROW_Handle *h)
228} 228}
229 229
230 230
231void 231static void
232handle_start_escrow_result (void *cls) 232handle_start_escrow_result (void *cls)
233{ 233{
234 struct ESCROW_Plugin_AnchorContinuationWrapper *w = cls; 234 struct ESCROW_Plugin_AnchorContinuationWrapper *w = cls;
@@ -328,7 +328,7 @@ handle_restore_key_result (void *cls)
328 */ 328 */
329struct GNUNET_ESCROW_Operation * 329struct GNUNET_ESCROW_Operation *
330GNUNET_ESCROW_get (struct GNUNET_ESCROW_Handle *h, 330GNUNET_ESCROW_get (struct GNUNET_ESCROW_Handle *h,
331 struct GNUNET_ESCROW_Anchor *anchor, 331 const struct GNUNET_ESCROW_Anchor *anchor,
332 enum GNUNET_ESCROW_Key_Escrow_Method method, 332 enum GNUNET_ESCROW_Key_Escrow_Method method,
333 GNUNET_ESCROW_EgoContinuation cb, 333 GNUNET_ESCROW_EgoContinuation cb,
334 void *cb_cls) 334 void *cb_cls)
@@ -351,7 +351,7 @@ GNUNET_ESCROW_get (struct GNUNET_ESCROW_Handle *h,
351} 351}
352 352
353 353
354void 354static void
355handle_verify_escrow_result (void *cls) 355handle_verify_escrow_result (void *cls)
356{ 356{
357 struct ESCROW_Plugin_VerifyContinuationWrapper *w = cls; 357 struct ESCROW_Plugin_VerifyContinuationWrapper *w = cls;
@@ -388,7 +388,7 @@ handle_verify_escrow_result (void *cls)
388struct GNUNET_ESCROW_Operation * 388struct GNUNET_ESCROW_Operation *
389GNUNET_ESCROW_verify (struct GNUNET_ESCROW_Handle *h, 389GNUNET_ESCROW_verify (struct GNUNET_ESCROW_Handle *h,
390 struct GNUNET_IDENTITY_Ego *ego, 390 struct GNUNET_IDENTITY_Ego *ego,
391 struct GNUNET_ESCROW_Anchor *anchor, 391 const struct GNUNET_ESCROW_Anchor *anchor,
392 enum GNUNET_ESCROW_Key_Escrow_Method method, 392 enum GNUNET_ESCROW_Key_Escrow_Method method,
393 GNUNET_ESCROW_VerifyContinuation cb, 393 GNUNET_ESCROW_VerifyContinuation cb,
394 void *cb_cls) 394 void *cb_cls)
diff --git a/src/escrow/escrow_plugin_helper.c b/src/escrow/escrow_plugin_helper.c
index 36acae049..3e14edf4f 100644
--- a/src/escrow/escrow_plugin_helper.c
+++ b/src/escrow/escrow_plugin_helper.c
@@ -176,7 +176,7 @@ ESCROW_cleanup_ego_list (struct ESCROW_PluginHandle *ph)
176} 176}
177 177
178 178
179char * 179static char *
180string_to_upper (const char *str) 180string_to_upper (const char *str)
181{ 181{
182 char *str_upper; 182 char *str_upper;
diff --git a/src/escrow/gnunet-escrow.c b/src/escrow/gnunet-escrow.c
index 36728f949..2f22fa194 100644
--- a/src/escrow/gnunet-escrow.c
+++ b/src/escrow/gnunet-escrow.c
@@ -215,6 +215,7 @@ put_cb (void *cls,
215 "in order to restore the key later!\n%s\n", anchorString); 215 "in order to restore the key later!\n%s\n", anchorString);
216 } 216 }
217 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 217 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
218 GNUNET_free (anchor);
218} 219}
219 220
220 221
diff --git a/src/escrow/plugin_escrow_anastasis.c b/src/escrow/plugin_escrow_anastasis.c
index 512918742..5353b435a 100644
--- a/src/escrow/plugin_escrow_anastasis.c
+++ b/src/escrow/plugin_escrow_anastasis.c
@@ -39,7 +39,7 @@ static struct GNUNET_IDENTITY_Handle *identity_handle;
39/** 39/**
40 * Handle for the plugin instance 40 * Handle for the plugin instance
41 */ 41 */
42struct ESCROW_PluginHandle ph; 42static struct ESCROW_PluginHandle ph;
43 43
44 44
45/** 45/**
@@ -88,7 +88,7 @@ start_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
88struct ESCROW_PluginOperationWrapper * 88struct ESCROW_PluginOperationWrapper *
89verify_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h, 89verify_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
90 struct GNUNET_IDENTITY_Ego *ego, 90 struct GNUNET_IDENTITY_Ego *ego,
91 struct GNUNET_ESCROW_Anchor *anchor, 91 const struct GNUNET_ESCROW_Anchor *anchor,
92 GNUNET_SCHEDULER_TaskCallback cb, 92 GNUNET_SCHEDULER_TaskCallback cb,
93 uint32_t op_id) 93 uint32_t op_id)
94{ 94{
@@ -118,7 +118,7 @@ verify_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
118 */ 118 */
119struct ESCROW_PluginOperationWrapper * 119struct ESCROW_PluginOperationWrapper *
120restore_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h, 120restore_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
121 struct GNUNET_ESCROW_Anchor *anchor, 121 const struct GNUNET_ESCROW_Anchor *anchor,
122 GNUNET_SCHEDULER_TaskCallback cb, 122 GNUNET_SCHEDULER_TaskCallback cb,
123 uint32_t op_id) 123 uint32_t op_id)
124{ 124{
@@ -168,7 +168,7 @@ cancel_anastasis_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap
168/** 168/**
169 * IdentityInitContinuation for the Anastasis plugin 169 * IdentityInitContinuation for the Anastasis plugin
170 */ 170 */
171void 171static void
172anastasis_cont_init () 172anastasis_cont_init ()
173{ 173{
174 return; 174 return;
diff --git a/src/escrow/plugin_escrow_gns.c b/src/escrow/plugin_escrow_gns.c
index bd96d2315..cf12602ca 100644
--- a/src/escrow/plugin_escrow_gns.c
+++ b/src/escrow/plugin_escrow_gns.c
@@ -355,14 +355,14 @@ static struct GNUNET_IDENTITY_Handle *identity_handle;
355/** 355/**
356 * Handle for the plugin instance 356 * Handle for the plugin instance
357 */ 357 */
358struct ESCROW_PluginHandle ph; 358static struct ESCROW_PluginHandle ph;
359 359
360 360
361/** 361/**
362 * Clean up a plugin operation, i.e. remove it from the list and 362 * Clean up a plugin operation, i.e. remove it from the list and
363 * free the respective memory 363 * free the respective memory
364 */ 364 */
365void 365static void
366cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) 366cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap)
367{ 367{
368 struct ESCROW_GnsPluginOperation *p_op; 368 struct ESCROW_GnsPluginOperation *p_op;
@@ -459,7 +459,7 @@ cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap)
459} 459}
460 460
461 461
462void 462static void
463start_cont (void *cls) 463start_cont (void *cls)
464{ 464{
465 struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls; 465 struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls;
@@ -472,7 +472,7 @@ start_cont (void *cls)
472} 472}
473 473
474 474
475void 475static void
476verify_cont (void *cls) 476verify_cont (void *cls)
477{ 477{
478 struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls; 478 struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls;
@@ -1109,7 +1109,7 @@ start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
1109 1109
1110 1110
1111static uint8_t 1111static uint8_t
1112count_keyshares (sss_Keyshare *keyshares, uint8_t n) 1112count_keyshares (const sss_Keyshare *keyshares, uint8_t n)
1113{ 1113{
1114 uint8_t i, c; 1114 uint8_t i, c;
1115 sss_Keyshare null_ks; 1115 sss_Keyshare null_ks;
@@ -1313,7 +1313,7 @@ get_user_secret_from_anchor (const struct GNUNET_ESCROW_Anchor *anchor)
1313 1313
1314static void 1314static void
1315restore_private_key (struct ESCROW_PluginOperationWrapper *plugin_op_wrap, 1315restore_private_key (struct ESCROW_PluginOperationWrapper *plugin_op_wrap,
1316 struct GNUNET_ESCROW_Anchor *anchor, 1316 const struct GNUNET_ESCROW_Anchor *anchor,
1317 PkContinuation cont, 1317 PkContinuation cont,
1318 void *cont_cls) 1318 void *cont_cls)
1319{ 1319{
@@ -1423,7 +1423,7 @@ verify_restored_pk (void *cls,
1423struct ESCROW_PluginOperationWrapper * 1423struct ESCROW_PluginOperationWrapper *
1424verify_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, 1424verify_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
1425 struct GNUNET_IDENTITY_Ego *ego, 1425 struct GNUNET_IDENTITY_Ego *ego,
1426 struct GNUNET_ESCROW_Anchor *anchor, 1426 const struct GNUNET_ESCROW_Anchor *anchor,
1427 GNUNET_SCHEDULER_TaskCallback cb, 1427 GNUNET_SCHEDULER_TaskCallback cb,
1428 uint32_t op_id) 1428 uint32_t op_id)
1429{ 1429{
@@ -1577,7 +1577,7 @@ restore_ego_from_pk (void *cls,
1577 */ 1577 */
1578struct ESCROW_PluginOperationWrapper * 1578struct ESCROW_PluginOperationWrapper *
1579restore_gns_key_escrow (struct GNUNET_ESCROW_Handle *h, 1579restore_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
1580 struct GNUNET_ESCROW_Anchor *anchor, 1580 const struct GNUNET_ESCROW_Anchor *anchor,
1581 GNUNET_SCHEDULER_TaskCallback cb, 1581 GNUNET_SCHEDULER_TaskCallback cb,
1582 uint32_t op_id) 1582 uint32_t op_id)
1583{ 1583{
diff --git a/src/escrow/plugin_escrow_plaintext.c b/src/escrow/plugin_escrow_plaintext.c
index 9eb1fb120..623504a6b 100644
--- a/src/escrow/plugin_escrow_plaintext.c
+++ b/src/escrow/plugin_escrow_plaintext.c
@@ -86,14 +86,14 @@ static struct GNUNET_IDENTITY_Handle *identity_handle;
86/** 86/**
87 * Handle for the plugin instance 87 * Handle for the plugin instance
88 */ 88 */
89struct ESCROW_PluginHandle ph; 89static struct ESCROW_PluginHandle ph;
90 90
91 91
92/** 92/**
93 * Clean up a plugin operation, i.e. remove it from the list and 93 * Clean up a plugin operation, i.e. remove it from the list and
94 * free the respective memory 94 * free the respective memory
95 */ 95 */
96void 96static void
97cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) 97cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap)
98{ 98{
99 struct ESCROW_PlaintextPluginOperation *p_op; 99 struct ESCROW_PlaintextPluginOperation *p_op;
@@ -114,7 +114,7 @@ cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap)
114} 114}
115 115
116 116
117void 117static void
118start_cont (void *cls) 118start_cont (void *cls)
119{ 119{
120 struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls; 120 struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls;
@@ -196,7 +196,7 @@ start_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
196} 196}
197 197
198 198
199void 199static void
200verify_cont (void *cls) 200verify_cont (void *cls)
201{ 201{
202 struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls; 202 struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls;
@@ -223,7 +223,7 @@ verify_cont (void *cls)
223struct ESCROW_PluginOperationWrapper * 223struct ESCROW_PluginOperationWrapper *
224verify_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, 224verify_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
225 struct GNUNET_IDENTITY_Ego *ego, 225 struct GNUNET_IDENTITY_Ego *ego,
226 struct GNUNET_ESCROW_Anchor *anchor, 226 const struct GNUNET_ESCROW_Anchor *anchor,
227 ESCROW_Plugin_Continuation cb, 227 ESCROW_Plugin_Continuation cb,
228 uint32_t op_id) 228 uint32_t op_id)
229{ 229{
@@ -277,7 +277,7 @@ verify_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
277} 277}
278 278
279 279
280void 280static void
281ego_created (const struct GNUNET_IDENTITY_Ego *ego) 281ego_created (const struct GNUNET_IDENTITY_Ego *ego)
282{ 282{
283 struct ESCROW_PluginOperationWrapper *curr; 283 struct ESCROW_PluginOperationWrapper *curr;
@@ -348,7 +348,7 @@ create_finished (void *cls,
348} 348}
349 349
350 350
351void 351static void
352handle_restore_error (void *cls) 352handle_restore_error (void *cls)
353{ 353{
354 struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls; 354 struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls;
@@ -373,7 +373,7 @@ handle_restore_error (void *cls)
373 */ 373 */
374struct ESCROW_PluginOperationWrapper * 374struct ESCROW_PluginOperationWrapper *
375restore_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h, 375restore_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
376 struct GNUNET_ESCROW_Anchor *anchor, 376 const struct GNUNET_ESCROW_Anchor *anchor,
377 ESCROW_Plugin_Continuation cb, 377 ESCROW_Plugin_Continuation cb,
378 uint32_t op_id) 378 uint32_t op_id)
379{ 379{
@@ -478,7 +478,7 @@ cancel_plaintext_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap
478/** 478/**
479 * IdentityInitContinuation for the plaintext plugin 479 * IdentityInitContinuation for the plaintext plugin
480 */ 480 */
481void 481static void
482plaintext_cont_init () 482plaintext_cont_init ()
483{ 483{
484 return; 484 return;
diff --git a/src/include/gnunet_escrow_lib.h b/src/include/gnunet_escrow_lib.h
index 3d3e39664..e02906934 100644
--- a/src/include/gnunet_escrow_lib.h
+++ b/src/include/gnunet_escrow_lib.h
@@ -320,7 +320,7 @@ GNUNET_ESCROW_put (
320struct GNUNET_ESCROW_Operation * 320struct GNUNET_ESCROW_Operation *
321GNUNET_ESCROW_get ( 321GNUNET_ESCROW_get (
322 struct GNUNET_ESCROW_Handle *h, 322 struct GNUNET_ESCROW_Handle *h,
323 struct GNUNET_ESCROW_Anchor *anchor, 323 const struct GNUNET_ESCROW_Anchor *anchor,
324 enum GNUNET_ESCROW_Key_Escrow_Method method, 324 enum GNUNET_ESCROW_Key_Escrow_Method method,
325 GNUNET_ESCROW_EgoContinuation cb, 325 GNUNET_ESCROW_EgoContinuation cb,
326 void *cb_cls); 326 void *cb_cls);
@@ -342,7 +342,7 @@ struct GNUNET_ESCROW_Operation *
342GNUNET_ESCROW_verify ( 342GNUNET_ESCROW_verify (
343 struct GNUNET_ESCROW_Handle *h, 343 struct GNUNET_ESCROW_Handle *h,
344 struct GNUNET_IDENTITY_Ego *ego, 344 struct GNUNET_IDENTITY_Ego *ego,
345 struct GNUNET_ESCROW_Anchor *anchor, 345 const struct GNUNET_ESCROW_Anchor *anchor,
346 enum GNUNET_ESCROW_Key_Escrow_Method method, 346 enum GNUNET_ESCROW_Key_Escrow_Method method,
347 GNUNET_ESCROW_VerifyContinuation cb, 347 GNUNET_ESCROW_VerifyContinuation cb,
348 void *cb_cls); 348 void *cb_cls);
diff --git a/src/include/gnunet_escrow_plugin.h b/src/include/gnunet_escrow_plugin.h
index 3095d3616..bc1ea6f52 100644
--- a/src/include/gnunet_escrow_plugin.h
+++ b/src/include/gnunet_escrow_plugin.h
@@ -77,7 +77,7 @@ typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_StartKeyEscrowFunc
77typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_VerifyKeyEscrowFunction) ( 77typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_VerifyKeyEscrowFunction) (
78 struct GNUNET_ESCROW_Handle *h, 78 struct GNUNET_ESCROW_Handle *h,
79 struct GNUNET_IDENTITY_Ego *ego, 79 struct GNUNET_IDENTITY_Ego *ego,
80 struct GNUNET_ESCROW_Anchor *anchor, 80 const struct GNUNET_ESCROW_Anchor *anchor,
81 GNUNET_SCHEDULER_TaskCallback cb, 81 GNUNET_SCHEDULER_TaskCallback cb,
82 uint32_t op_id); 82 uint32_t op_id);
83 83
@@ -93,7 +93,7 @@ typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_VerifyKeyEscrowFun
93 */ 93 */
94typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_RestoreKeyFunction) ( 94typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_RestoreKeyFunction) (
95 struct GNUNET_ESCROW_Handle *h, 95 struct GNUNET_ESCROW_Handle *h,
96 struct GNUNET_ESCROW_Anchor *anchor, 96 const struct GNUNET_ESCROW_Anchor *anchor,
97 GNUNET_SCHEDULER_TaskCallback cb, 97 GNUNET_SCHEDULER_TaskCallback cb,
98 uint32_t op_id); 98 uint32_t op_id);
99 99