diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-04-21 18:25:36 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-04-21 18:25:36 +0200 |
commit | e3866c8f09e173e7d36cce25015ecfbd666cd5bc (patch) | |
tree | 9eabafeac99f0fcc7a96a83b375b04c72f6ca43f /src/revocation | |
parent | 6bda628f704707ab92b17c4006a4a8fcf6bd48dd (diff) | |
download | gnunet-e3866c8f09e173e7d36cce25015ecfbd666cd5bc.tar.gz gnunet-e3866c8f09e173e7d36cce25015ecfbd666cd5bc.zip |
update API for cleanup of handle
Diffstat (limited to 'src/revocation')
-rw-r--r-- | src/revocation/gnunet-revocation.c | 3 | ||||
-rw-r--r-- | src/revocation/revocation_api.c | 29 | ||||
-rw-r--r-- | src/revocation/test_revocation.c | 2 |
3 files changed, 18 insertions, 16 deletions
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index 2c46a20e7..de9560172 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c | |||
@@ -250,7 +250,8 @@ calculate_pow_shutdown (void *cls) | |||
250 | GNUNET_SCHEDULER_cancel (pow_task); | 250 | GNUNET_SCHEDULER_cancel (pow_task); |
251 | pow_task = NULL; | 251 | pow_task = NULL; |
252 | } | 252 | } |
253 | GNUNET_REVOCATION_pow_cleanup (ph); | 253 | if (NULL != ph) |
254 | GNUNET_REVOCATION_pow_stop (ph); | ||
254 | } | 255 | } |
255 | 256 | ||
256 | 257 | ||
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index 5494f379c..18a312ab8 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -320,16 +320,16 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
320 | "REVOCATION", | 320 | "REVOCATION", |
321 | "WORKBITS", | 321 | "WORKBITS", |
322 | &matching_bits))) | 322 | &matching_bits))) |
323 | { | 323 | { |
324 | GNUNET_break (0); | 324 | GNUNET_break (0); |
325 | GNUNET_free (h); | 325 | GNUNET_free (h); |
326 | return NULL; | 326 | return NULL; |
327 | } | 327 | } |
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_DURATION", | 331 | "EPOCH_DURATION", |
332 | &epoch_duration))) | 332 | &epoch_duration))) |
333 | { | 333 | { |
334 | GNUNET_break (0); | 334 | GNUNET_break (0); |
335 | GNUNET_free (h); | 335 | GNUNET_free (h); |
@@ -345,7 +345,6 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
345 | } | 345 | } |
346 | 346 | ||
347 | 347 | ||
348 | |||
349 | h->mq = GNUNET_CLIENT_connect (cfg, | 348 | h->mq = GNUNET_CLIENT_connect (cfg, |
350 | "revocation", | 349 | "revocation", |
351 | handlers, | 350 | handlers, |
@@ -454,8 +453,8 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow, | |||
454 | spurp.timestamp = pow->timestamp; | 453 | spurp.timestamp = pow->timestamp; |
455 | spurp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); | 454 | spurp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); |
456 | spurp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) | 455 | spurp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) |
457 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | 456 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) |
458 | + sizeof (struct GNUNET_TIME_AbsoluteNBO)); | 457 | + sizeof (struct GNUNET_TIME_AbsoluteNBO)); |
459 | if (GNUNET_OK != | 458 | if (GNUNET_OK != |
460 | GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION, | 459 | GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION, |
461 | &spurp.purpose, | 460 | &spurp.purpose, |
@@ -555,8 +554,8 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
555 | rp.timestamp = pow->timestamp; | 554 | rp.timestamp = pow->timestamp; |
556 | rp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); | 555 | rp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); |
557 | rp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) | 556 | rp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) |
558 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | 557 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) |
559 | + sizeof (struct GNUNET_TIME_AbsoluteNBO)); | 558 | + sizeof (struct GNUNET_TIME_AbsoluteNBO)); |
560 | GNUNET_CRYPTO_ecdsa_key_get_public (key, &pow->key); | 559 | GNUNET_CRYPTO_ecdsa_key_get_public (key, &pow->key); |
561 | rp.key = pow->key; | 560 | rp.key = pow->key; |
562 | GNUNET_assert (GNUNET_OK == | 561 | GNUNET_assert (GNUNET_OK == |
@@ -577,8 +576,8 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
577 | */ | 576 | */ |
578 | struct GNUNET_REVOCATION_PowCalculationHandle* | 577 | struct GNUNET_REVOCATION_PowCalculationHandle* |
579 | GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_Pow *pow, | 578 | GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_Pow *pow, |
580 | int epochs, | 579 | int epochs, |
581 | unsigned int difficulty) | 580 | unsigned int difficulty) |
582 | { | 581 | { |
583 | struct GNUNET_REVOCATION_PowCalculationHandle *pc; | 582 | struct GNUNET_REVOCATION_PowCalculationHandle *pc; |
584 | 583 | ||
@@ -651,15 +650,17 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) | |||
651 | 650 | ||
652 | 651 | ||
653 | /** | 652 | /** |
654 | * Cleanup a PoW calculation | 653 | * Stop a PoW calculation |
655 | * | 654 | * |
656 | * @param pc the calculation to clean up | 655 | * @param pc the calculation to clean up |
656 | * @return #GNUNET_YES if pow valid, #GNUNET_NO if pow was set but is not | ||
657 | * valid | ||
657 | */ | 658 | */ |
658 | void | 659 | void |
659 | GNUNET_REVOCATION_pow_cleanup (struct | 660 | GNUNET_REVOCATION_pow_stop (struct GNUNET_REVOCATION_PowCalculationHandle *pc) |
660 | GNUNET_REVOCATION_PowCalculationHandle *pc) | ||
661 | { | 661 | { |
662 | GNUNET_free (pc); | 662 | GNUNET_free (pc); |
663 | } | 663 | } |
664 | 664 | ||
665 | |||
665 | /* end of revocation_api.c */ | 666 | /* end of revocation_api.c */ |
diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c index a7de15a3f..f193d5f6c 100644 --- a/src/revocation/test_revocation.c +++ b/src/revocation/test_revocation.c | |||
@@ -187,7 +187,7 @@ ego_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | |||
187 | &proof_of_work, | 187 | &proof_of_work, |
188 | &revocation_cb, | 188 | &revocation_cb, |
189 | NULL); | 189 | NULL); |
190 | GNUNET_REVOCATION_pow_cleanup (testpeers[1].pow); | 190 | GNUNET_REVOCATION_pow_stop (testpeers[1].pow); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||