diff options
-rw-r--r-- | src/include/gnunet_revocation_service.h | 17 | ||||
-rw-r--r-- | src/revocation/gnunet-revocation.c | 10 | ||||
-rw-r--r-- | src/revocation/revocation.h | 2 | ||||
-rw-r--r-- | src/revocation/revocation_api.c | 14 |
4 files changed, 23 insertions, 20 deletions
diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h index 9a8918b43..105bb1149 100644 --- a/src/include/gnunet_revocation_service.h +++ b/src/include/gnunet_revocation_service.h | |||
@@ -48,7 +48,7 @@ extern "C" | |||
48 | /** | 48 | /** |
49 | * Version of the key revocation API. | 49 | * Version of the key revocation API. |
50 | */ | 50 | */ |
51 | #define GNUNET_REVOCATION_VERSION 0x00000000 | 51 | #define GNUNET_REVOCATION_VERSION 0x00000001 |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * The proof-of-work narrowing factor. | 54 | * The proof-of-work narrowing factor. |
@@ -59,7 +59,10 @@ extern "C" | |||
59 | 59 | ||
60 | GNUNET_NETWORK_STRUCT_BEGIN | 60 | GNUNET_NETWORK_STRUCT_BEGIN |
61 | 61 | ||
62 | struct GNUNET_REVOCATION_Pow | 62 | /** |
63 | * Struct for a proof of work as part of the revocation. | ||
64 | */ | ||
65 | struct GNUNET_REVOCATION_PowP | ||
63 | { | 66 | { |
64 | /** | 67 | /** |
65 | * The timestamp of the revocation | 68 | * The timestamp of the revocation |
@@ -91,7 +94,7 @@ struct GNUNET_REVOCATION_Pow | |||
91 | /** | 94 | /** |
92 | * The signature object we use for the PoW | 95 | * The signature object we use for the PoW |
93 | */ | 96 | */ |
94 | struct GNUNET_REVOCATION_SignaturePurpose | 97 | struct GNUNET_REVOCATION_SignaturePurposePS |
95 | { | 98 | { |
96 | /** | 99 | /** |
97 | * The signature purpose | 100 | * The signature purpose |
@@ -180,7 +183,7 @@ struct GNUNET_REVOCATION_Handle; | |||
180 | */ | 183 | */ |
181 | struct GNUNET_REVOCATION_Handle * | 184 | struct GNUNET_REVOCATION_Handle * |
182 | GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | 185 | GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, |
183 | const struct GNUNET_REVOCATION_Pow *pow, | 186 | const struct GNUNET_REVOCATION_PowP *pow, |
184 | GNUNET_REVOCATION_Callback func, void *func_cls); | 187 | GNUNET_REVOCATION_Callback func, void *func_cls); |
185 | 188 | ||
186 | 189 | ||
@@ -202,7 +205,7 @@ GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h); | |||
202 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not | 205 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not |
203 | */ | 206 | */ |
204 | enum GNUNET_GenericReturnValue | 207 | enum GNUNET_GenericReturnValue |
205 | GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow, | 208 | GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, |
206 | unsigned int matching_bits, | 209 | unsigned int matching_bits, |
207 | struct GNUNET_TIME_Relative epoch_duration); | 210 | struct GNUNET_TIME_Relative epoch_duration); |
208 | 211 | ||
@@ -215,7 +218,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow, | |||
215 | */ | 218 | */ |
216 | void | 219 | void |
217 | GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 220 | GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, |
218 | struct GNUNET_REVOCATION_Pow *pow); | 221 | struct GNUNET_REVOCATION_PowP *pow); |
219 | 222 | ||
220 | 223 | ||
221 | /** | 224 | /** |
@@ -228,7 +231,7 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
228 | * @return a handle for use in PoW rounds | 231 | * @return a handle for use in PoW rounds |
229 | */ | 232 | */ |
230 | struct GNUNET_REVOCATION_PowCalculationHandle* | 233 | struct GNUNET_REVOCATION_PowCalculationHandle* |
231 | GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_Pow *pow, | 234 | GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow, |
232 | int epochs, | 235 | int epochs, |
233 | unsigned int difficulty); | 236 | unsigned int difficulty); |
234 | 237 | ||
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index 8b7cf33c6..1edd98f0e 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c | |||
@@ -101,7 +101,7 @@ static struct GNUNET_SCHEDULER_Task *pow_task; | |||
101 | /** | 101 | /** |
102 | * Proof-of-work object | 102 | * Proof-of-work object |
103 | */ | 103 | */ |
104 | static struct GNUNET_REVOCATION_Pow proof_of_work; | 104 | static struct GNUNET_REVOCATION_PowP proof_of_work; |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * Function run if the user aborts with CTRL-C. | 107 | * Function run if the user aborts with CTRL-C. |
@@ -229,10 +229,10 @@ static void | |||
229 | sync_pow () | 229 | sync_pow () |
230 | { | 230 | { |
231 | if ((NULL != filename) && | 231 | if ((NULL != filename) && |
232 | (sizeof(struct GNUNET_REVOCATION_Pow) != | 232 | (sizeof(struct GNUNET_REVOCATION_PowP) != |
233 | GNUNET_DISK_fn_write (filename, | 233 | GNUNET_DISK_fn_write (filename, |
234 | &proof_of_work, | 234 | &proof_of_work, |
235 | sizeof(struct GNUNET_REVOCATION_Pow), | 235 | sizeof(struct GNUNET_REVOCATION_PowP), |
236 | GNUNET_DISK_PERM_USER_READ | 236 | GNUNET_DISK_PERM_USER_READ |
237 | | GNUNET_DISK_PERM_USER_WRITE))) | 237 | | GNUNET_DISK_PERM_USER_WRITE))) |
238 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename); | 238 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename); |
@@ -278,10 +278,10 @@ calculate_pow (void *cls) | |||
278 | if (GNUNET_OK == GNUNET_REVOCATION_pow_round (ph)) | 278 | if (GNUNET_OK == GNUNET_REVOCATION_pow_round (ph)) |
279 | { | 279 | { |
280 | if ((NULL != filename) && | 280 | if ((NULL != filename) && |
281 | (sizeof(struct GNUNET_REVOCATION_Pow) != | 281 | (sizeof(struct GNUNET_REVOCATION_PowP) != |
282 | GNUNET_DISK_fn_write (filename, | 282 | GNUNET_DISK_fn_write (filename, |
283 | &proof_of_work, | 283 | &proof_of_work, |
284 | sizeof(struct GNUNET_REVOCATION_Pow), | 284 | sizeof(struct GNUNET_REVOCATION_PowP), |
285 | GNUNET_DISK_PERM_USER_READ | 285 | GNUNET_DISK_PERM_USER_READ |
286 | | GNUNET_DISK_PERM_USER_WRITE))) | 286 | | GNUNET_DISK_PERM_USER_WRITE))) |
287 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename); | 287 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename); |
diff --git a/src/revocation/revocation.h b/src/revocation/revocation.h index 868c2b853..635c56cfc 100644 --- a/src/revocation/revocation.h +++ b/src/revocation/revocation.h | |||
@@ -92,7 +92,7 @@ struct RevokeMessage | |||
92 | /** | 92 | /** |
93 | * Number that causes a hash collision with the @e public_key. | 93 | * Number that causes a hash collision with the @e public_key. |
94 | */ | 94 | */ |
95 | struct GNUNET_REVOCATION_Pow proof_of_work; | 95 | struct GNUNET_REVOCATION_PowP proof_of_work; |
96 | }; | 96 | }; |
97 | 97 | ||
98 | 98 | ||
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index 18a312ab8..12cb63c57 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -83,7 +83,7 @@ struct GNUNET_REVOCATION_PowCalculationHandle | |||
83 | /** | 83 | /** |
84 | * The final PoW result data structure. | 84 | * The final PoW result data structure. |
85 | */ | 85 | */ |
86 | struct GNUNET_REVOCATION_Pow *pow; | 86 | struct GNUNET_REVOCATION_PowP *pow; |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * The current nonce to try | 89 | * The current nonce to try |
@@ -297,7 +297,7 @@ handle_revocation_response (void *cls, | |||
297 | */ | 297 | */ |
298 | struct GNUNET_REVOCATION_Handle * | 298 | struct GNUNET_REVOCATION_Handle * |
299 | GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | 299 | GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, |
300 | const struct GNUNET_REVOCATION_Pow *pow, | 300 | const struct GNUNET_REVOCATION_PowP *pow, |
301 | GNUNET_REVOCATION_Callback func, | 301 | GNUNET_REVOCATION_Callback func, |
302 | void *func_cls) | 302 | void *func_cls) |
303 | { | 303 | { |
@@ -428,14 +428,14 @@ calculate_score (const struct GNUNET_REVOCATION_PowCalculationHandle *ph) | |||
428 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not | 428 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not |
429 | */ | 429 | */ |
430 | enum GNUNET_GenericReturnValue | 430 | enum GNUNET_GenericReturnValue |
431 | GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow, | 431 | GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, |
432 | unsigned int difficulty, | 432 | unsigned int difficulty, |
433 | struct GNUNET_TIME_Relative epoch_duration) | 433 | struct GNUNET_TIME_Relative epoch_duration) |
434 | { | 434 | { |
435 | char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | 435 | char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) |
436 | + sizeof (struct GNUNET_TIME_AbsoluteNBO) | 436 | + sizeof (struct GNUNET_TIME_AbsoluteNBO) |
437 | + sizeof (uint64_t)] GNUNET_ALIGN; | 437 | + sizeof (uint64_t)] GNUNET_ALIGN; |
438 | struct GNUNET_REVOCATION_SignaturePurpose spurp; | 438 | struct GNUNET_REVOCATION_SignaturePurposePS spurp; |
439 | struct GNUNET_HashCode result; | 439 | struct GNUNET_HashCode result; |
440 | struct GNUNET_TIME_Absolute ts; | 440 | struct GNUNET_TIME_Absolute ts; |
441 | struct GNUNET_TIME_Absolute exp; | 441 | struct GNUNET_TIME_Absolute exp; |
@@ -538,10 +538,10 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow, | |||
538 | */ | 538 | */ |
539 | void | 539 | void |
540 | GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 540 | GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, |
541 | struct GNUNET_REVOCATION_Pow *pow) | 541 | struct GNUNET_REVOCATION_PowP *pow) |
542 | { | 542 | { |
543 | struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get (); | 543 | struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get (); |
544 | struct GNUNET_REVOCATION_SignaturePurpose rp; | 544 | struct GNUNET_REVOCATION_SignaturePurposePS rp; |
545 | 545 | ||
546 | /** | 546 | /** |
547 | * Predate the validity period to prevent rejections due to | 547 | * Predate the validity period to prevent rejections due to |
@@ -575,7 +575,7 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
575 | * @return a handle for use in PoW rounds | 575 | * @return a handle for use in PoW rounds |
576 | */ | 576 | */ |
577 | struct GNUNET_REVOCATION_PowCalculationHandle* | 577 | struct GNUNET_REVOCATION_PowCalculationHandle* |
578 | GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_Pow *pow, | 578 | GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow, |
579 | int epochs, | 579 | int epochs, |
580 | unsigned int difficulty) | 580 | unsigned int difficulty) |
581 | { | 581 | { |