summaryrefslogtreecommitdiff
path: root/src/revocation
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2020-04-21 18:25:36 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2020-04-21 18:25:36 +0200
commite3866c8f09e173e7d36cce25015ecfbd666cd5bc (patch)
tree9eabafeac99f0fcc7a96a83b375b04c72f6ca43f /src/revocation
parent6bda628f704707ab92b17c4006a4a8fcf6bd48dd (diff)
update API for cleanup of handle
Diffstat (limited to 'src/revocation')
-rw-r--r--src/revocation/gnunet-revocation.c3
-rw-r--r--src/revocation/revocation_api.c29
-rw-r--r--src/revocation/test_revocation.c2
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)
GNUNET_SCHEDULER_cancel (pow_task);
pow_task = NULL;
}
- GNUNET_REVOCATION_pow_cleanup (ph);
+ if (NULL != ph)
+ GNUNET_REVOCATION_pow_stop (ph);
}
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,
"REVOCATION",
"WORKBITS",
&matching_bits)))
- {
+ {
GNUNET_break (0);
GNUNET_free (h);
return NULL;
}
if ((GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
- "REVOCATION",
- "EPOCH_DURATION",
- &epoch_duration)))
+ "REVOCATION",
+ "EPOCH_DURATION",
+ &epoch_duration)))
{
GNUNET_break (0);
GNUNET_free (h);
@@ -345,7 +345,6 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
}
-
h->mq = GNUNET_CLIENT_connect (cfg,
"revocation",
handlers,
@@ -454,8 +453,8 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
spurp.timestamp = pow->timestamp;
spurp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION);
spurp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
- + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
- + sizeof (struct GNUNET_TIME_AbsoluteNBO));
+ + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
+ + sizeof (struct GNUNET_TIME_AbsoluteNBO));
if (GNUNET_OK !=
GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION,
&spurp.purpose,
@@ -555,8 +554,8 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
rp.timestamp = pow->timestamp;
rp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION);
rp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
- + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
- + sizeof (struct GNUNET_TIME_AbsoluteNBO));
+ + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
+ + sizeof (struct GNUNET_TIME_AbsoluteNBO));
GNUNET_CRYPTO_ecdsa_key_get_public (key, &pow->key);
rp.key = pow->key;
GNUNET_assert (GNUNET_OK ==
@@ -577,8 +576,8 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
*/
struct GNUNET_REVOCATION_PowCalculationHandle*
GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_Pow *pow,
- int epochs,
- unsigned int difficulty)
+ int epochs,
+ unsigned int difficulty)
{
struct GNUNET_REVOCATION_PowCalculationHandle *pc;
@@ -651,15 +650,17 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
/**
- * Cleanup a PoW calculation
+ * Stop a PoW calculation
*
* @param pc the calculation to clean up
+ * @return #GNUNET_YES if pow valid, #GNUNET_NO if pow was set but is not
+ * valid
*/
void
-GNUNET_REVOCATION_pow_cleanup (struct
- GNUNET_REVOCATION_PowCalculationHandle *pc)
+GNUNET_REVOCATION_pow_stop (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
{
GNUNET_free (pc);
}
+
/* 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)
&proof_of_work,
&revocation_cb,
NULL);
- GNUNET_REVOCATION_pow_cleanup (testpeers[1].pow);
+ GNUNET_REVOCATION_pow_stop (testpeers[1].pow);
}
}