aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/revocation/gnunet-revocation.c12
-rw-r--r--src/revocation/gnunet-service-revocation.c10
-rw-r--r--src/revocation/plugin_block_revocation.c12
-rw-r--r--src/revocation/revocation_api.c16
-rw-r--r--src/revocation/test_revocation.c4
-rw-r--r--src/revocation/test_revocation.conf2
6 files changed, 28 insertions, 28 deletions
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c
index 2230114ae..2c46a20e7 100644
--- a/src/revocation/gnunet-revocation.c
+++ b/src/revocation/gnunet-revocation.c
@@ -86,7 +86,7 @@ static unsigned long long matching_bits;
86/** 86/**
87 * Epoch length 87 * Epoch length
88 */ 88 */
89static struct GNUNET_TIME_Relative epoch_length; 89static struct GNUNET_TIME_Relative epoch_duration;
90 90
91/** 91/**
92 * Task used for proof-of-work calculation. 92 * Task used for proof-of-work calculation.
@@ -348,7 +348,7 @@ ego_callback (void *cls, const struct GNUNET_IDENTITY_Ego *ego)
348 if (GNUNET_YES == 348 if (GNUNET_YES ==
349 GNUNET_REVOCATION_check_pow (&proof_of_work, 349 GNUNET_REVOCATION_check_pow (&proof_of_work,
350 (unsigned int) matching_bits, 350 (unsigned int) matching_bits,
351 epoch_length)) 351 epoch_duration))
352 { 352 {
353 fprintf (stderr, "%s", _ ("Revocation certificate ready\n")); 353 fprintf (stderr, "%s", _ ("Revocation certificate ready\n"));
354 if (perform) 354 if (perform)
@@ -432,12 +432,12 @@ run (void *cls,
432 } 432 }
433 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, 433 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg,
434 "REVOCATION", 434 "REVOCATION",
435 "EPOCH_LENGTH", 435 "EPOCH_DURATION",
436 &epoch_length)) 436 &epoch_duration))
437 { 437 {
438 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, 438 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
439 "REVOCATION", 439 "REVOCATION",
440 "EPOCH_LENGTH"); 440 "EPOCH_DURATION");
441 return; 441 return;
442 } 442 }
443 443
@@ -470,7 +470,7 @@ run (void *cls,
470 if (GNUNET_YES != 470 if (GNUNET_YES !=
471 GNUNET_REVOCATION_check_pow (&proof_of_work, 471 GNUNET_REVOCATION_check_pow (&proof_of_work,
472 (unsigned int) matching_bits, 472 (unsigned int) matching_bits,
473 epoch_length)) 473 epoch_duration))
474 { 474 {
475 struct GNUNET_REVOCATION_PowCalculationHandle *ph; 475 struct GNUNET_REVOCATION_PowCalculationHandle *ph;
476 ph = GNUNET_REVOCATION_pow_start (&proof_of_work, 476 ph = GNUNET_REVOCATION_pow_start (&proof_of_work,
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index a9fbd57a7..3c08e8452 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -131,7 +131,7 @@ static unsigned long long revocation_work_required;
131/** 131/**
132 * Length of an expiration expoch 132 * Length of an expiration expoch
133 */ 133 */
134static struct GNUNET_TIME_Relative epoch_length; 134static struct GNUNET_TIME_Relative epoch_duration;
135 135
136/** 136/**
137 * Our application ID for set union operations. Must be the 137 * Our application ID for set union operations. Must be the
@@ -174,7 +174,7 @@ verify_revoke_message (const struct RevokeMessage *rm)
174{ 174{
175 if (GNUNET_YES != GNUNET_REVOCATION_check_pow (&rm->proof_of_work, 175 if (GNUNET_YES != GNUNET_REVOCATION_check_pow (&rm->proof_of_work,
176 (unsigned int) revocation_work_required, 176 (unsigned int) revocation_work_required,
177 epoch_length)) 177 epoch_duration))
178 { 178 {
179 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 179 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
180 "Proof of work invalid!\n"); 180 "Proof of work invalid!\n");
@@ -846,12 +846,12 @@ run (void *cls,
846 if (GNUNET_OK != 846 if (GNUNET_OK !=
847 GNUNET_CONFIGURATION_get_value_time (cfg, 847 GNUNET_CONFIGURATION_get_value_time (cfg,
848 "REVOCATION", 848 "REVOCATION",
849 "EPOCH_LENGTH", 849 "EPOCH_DURATION",
850 &epoch_length)) 850 &epoch_duration))
851 { 851 {
852 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, 852 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
853 "REVOCATION", 853 "REVOCATION",
854 "EPOCH_LENGTH"); 854 "EPOCH_DURATION");
855 GNUNET_SCHEDULER_shutdown (); 855 GNUNET_SCHEDULER_shutdown ();
856 GNUNET_free (fn); 856 GNUNET_free (fn);
857 return; 857 return;
diff --git a/src/revocation/plugin_block_revocation.c b/src/revocation/plugin_block_revocation.c
index f384cfe1d..291c56f70 100644
--- a/src/revocation/plugin_block_revocation.c
+++ b/src/revocation/plugin_block_revocation.c
@@ -52,7 +52,7 @@
52struct InternalContext 52struct InternalContext
53{ 53{
54 unsigned int matching_bits; 54 unsigned int matching_bits;
55 struct GNUNET_TIME_Relative epoch_length; 55 struct GNUNET_TIME_Relative epoch_duration;
56}; 56};
57 57
58 58
@@ -146,7 +146,7 @@ block_plugin_revocation_evaluate (void *cls,
146 if (0 >= 146 if (0 >=
147 GNUNET_REVOCATION_check_pow (&rm->proof_of_work, 147 GNUNET_REVOCATION_check_pow (&rm->proof_of_work,
148 ic->matching_bits, 148 ic->matching_bits,
149 ic->epoch_length)) 149 ic->epoch_duration))
150 { 150 {
151 GNUNET_break_op (0); 151 GNUNET_break_op (0);
152 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 152 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
@@ -210,7 +210,7 @@ libgnunet_plugin_block_revocation_init (void *cls)
210 struct GNUNET_BLOCK_PluginFunctions *api; 210 struct GNUNET_BLOCK_PluginFunctions *api;
211 struct InternalContext *ic; 211 struct InternalContext *ic;
212 unsigned long long matching_bits; 212 unsigned long long matching_bits;
213 struct GNUNET_TIME_Relative epoch_length; 213 struct GNUNET_TIME_Relative epoch_duration;
214 214
215 if (GNUNET_OK != 215 if (GNUNET_OK !=
216 GNUNET_CONFIGURATION_get_value_number (cfg, 216 GNUNET_CONFIGURATION_get_value_number (cfg,
@@ -221,8 +221,8 @@ libgnunet_plugin_block_revocation_init (void *cls)
221 if (GNUNET_OK != 221 if (GNUNET_OK !=
222 GNUNET_CONFIGURATION_get_value_time (cfg, 222 GNUNET_CONFIGURATION_get_value_time (cfg,
223 "REVOCATION", 223 "REVOCATION",
224 "EPOCH_LENGTH", 224 "EPOCH_DURATION",
225 &epoch_length)) 225 &epoch_duration))
226 return NULL; 226 return NULL;
227 227
228 api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions); 228 api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions);
@@ -232,7 +232,7 @@ libgnunet_plugin_block_revocation_init (void *cls)
232 api->types = types; 232 api->types = types;
233 ic = GNUNET_new (struct InternalContext); 233 ic = GNUNET_new (struct InternalContext);
234 ic->matching_bits = (unsigned int) matching_bits; 234 ic->matching_bits = (unsigned int) matching_bits;
235 ic->epoch_length = epoch_length; 235 ic->epoch_duration = epoch_duration;
236 api->cls = ic; 236 api->cls = ic;
237 return api; 237 return api;
238} 238}
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index 7bf7799de..bff004698 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -311,7 +311,7 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
311 GNUNET_MQ_handler_end () 311 GNUNET_MQ_handler_end ()
312 }; 312 };
313 unsigned long long matching_bits; 313 unsigned long long matching_bits;
314 struct GNUNET_TIME_Relative epoch_length; 314 struct GNUNET_TIME_Relative epoch_duration;
315 struct RevokeMessage *rm; 315 struct RevokeMessage *rm;
316 struct GNUNET_MQ_Envelope *env; 316 struct GNUNET_MQ_Envelope *env;
317 317
@@ -328,8 +328,8 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
328 if ((GNUNET_OK != 328 if ((GNUNET_OK !=
329 GNUNET_CONFIGURATION_get_value_time (cfg, 329 GNUNET_CONFIGURATION_get_value_time (cfg,
330 "REVOCATION", 330 "REVOCATION",
331 "EPOCH_LENGTH", 331 "EPOCH_DURATION",
332 &epoch_length))) 332 &epoch_duration)))
333 { 333 {
334 GNUNET_break (0); 334 GNUNET_break (0);
335 GNUNET_free (h); 335 GNUNET_free (h);
@@ -337,7 +337,7 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
337 } 337 }
338 if (GNUNET_YES != GNUNET_REVOCATION_check_pow (pow, 338 if (GNUNET_YES != GNUNET_REVOCATION_check_pow (pow,
339 (unsigned int) matching_bits, 339 (unsigned int) matching_bits,
340 epoch_length)) 340 epoch_duration))
341 { 341 {
342 GNUNET_break (0); 342 GNUNET_break (0);
343 GNUNET_free (h); 343 GNUNET_free (h);
@@ -431,7 +431,7 @@ calculate_score (const struct GNUNET_REVOCATION_PowCalculationHandle *ph)
431enum GNUNET_GenericReturnValue 431enum GNUNET_GenericReturnValue
432GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow, 432GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
433 unsigned int difficulty, 433 unsigned int difficulty,
434 struct GNUNET_TIME_Relative epoch_length) 434 struct GNUNET_TIME_Relative epoch_duration)
435{ 435{
436 char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) 436 char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
437 + sizeof (struct GNUNET_TIME_AbsoluteNBO) 437 + sizeof (struct GNUNET_TIME_AbsoluteNBO)
@@ -462,7 +462,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
462 &pow->signature, 462 &pow->signature,
463 &pow->key)) 463 &pow->key))
464 { 464 {
465 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 465 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
466 "Proof of work signature invalid!\n"); 466 "Proof of work signature invalid!\n");
467 return GNUNET_NO; 467 return GNUNET_NO;
468 } 468 }
@@ -508,12 +508,12 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
508 * Check expiration 508 * Check expiration
509 */ 509 */
510 ts = GNUNET_TIME_absolute_ntoh (pow->timestamp); 510 ts = GNUNET_TIME_absolute_ntoh (pow->timestamp);
511 ttl = GNUNET_TIME_relative_multiply (epoch_length, 511 ttl = GNUNET_TIME_relative_multiply (epoch_duration,
512 epochs); 512 epochs);
513 /** 513 /**
514 * Extend by 10% for unsynchronized clocks 514 * Extend by 10% for unsynchronized clocks
515 */ 515 */
516 buffer = GNUNET_TIME_relative_divide (epoch_length, 516 buffer = GNUNET_TIME_relative_divide (epoch_duration,
517 10); 517 10);
518 exp = GNUNET_TIME_absolute_add (ts, ttl); 518 exp = GNUNET_TIME_absolute_add (ts, ttl);
519 exp = GNUNET_TIME_absolute_add (exp, 519 exp = GNUNET_TIME_absolute_add (exp,
diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c
index 84f90fe54..a7de15a3f 100644
--- a/src/revocation/test_revocation.c
+++ b/src/revocation/test_revocation.c
@@ -141,14 +141,14 @@ revocation_cb (void *cls, enum GNUNET_GenericReturnValue is_valid)
141 } 141 }
142} 142}
143 143
144struct GNUNET_REVOCATION_Pow proof_of_work;
145
144 146
145static void 147static void
146ego_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) 148ego_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego)
147{ 149{
148 static int completed = 0; 150 static int completed = 0;
149 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 151 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
150 struct GNUNET_REVOCATION_Pow proof_of_work;
151
152 152
153 if ((NULL != ego) && (cls == &testpeers[0])) 153 if ((NULL != ego) && (cls == &testpeers[0]))
154 { 154 {
diff --git a/src/revocation/test_revocation.conf b/src/revocation/test_revocation.conf
index f195429b4..66e2cdcc9 100644
--- a/src/revocation/test_revocation.conf
+++ b/src/revocation/test_revocation.conf
@@ -7,7 +7,7 @@ SERVICEHOME=$GNUNET_TMP/test-revocation-service
7[revocation] 7[revocation]
8WORKBITS = 3 8WORKBITS = 3
9IMMEDIATE_START = YES 9IMMEDIATE_START = YES
10EPOCH_LENGTH = 365 d 10EPOCH_DURATION = 365 d
11 11
12[identity] 12[identity]
13# Directory where we store information about our egos 13# Directory where we store information about our egos