From 19b772329cb8968e5e96e33d5238f172f5553dc4 Mon Sep 17 00:00:00 2001 From: "Schanzenbach, Martin" Date: Tue, 21 Apr 2020 11:52:12 +0200 Subject: [PATCH] new pass API --- src/include/gnunet_revocation_service.h | 73 +++++++++-------- src/revocation/gnunet-revocation.c | 92 ++++++++-------------- src/revocation/gnunet-service-revocation.c | 9 --- src/revocation/revocation_api.c | 84 ++++++++++---------- src/revocation/test_revocation.c | 17 ++-- 5 files changed, 125 insertions(+), 150 deletions(-) diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h index 6bd2e88d3..e8824bd8a 100644 --- a/src/include/gnunet_revocation_service.h +++ b/src/include/gnunet_revocation_service.h @@ -69,7 +69,7 @@ struct GNUNET_REVOCATION_Pow /** * The TTL of this revocation (purely informational) */ - uint64_t ttl GNUNET_PACKED; + struct GNUNET_TIME_RelativeNBO ttl GNUNET_PACKED; /** * The PoWs @@ -81,6 +81,18 @@ struct GNUNET_REVOCATION_Pow */ struct GNUNET_CRYPTO_EcdsaSignature signature; + /** + * The revoked public key + */ + struct GNUNET_CRYPTO_EcdsaPublicKey key; +}; + + +/** + * The signature object we use for the PoW + */ +struct GNUNET_REVOCATION_SignaturePurpose +{ /** * The signature purpose */ @@ -90,11 +102,19 @@ struct GNUNET_REVOCATION_Pow * The revoked public key */ struct GNUNET_CRYPTO_EcdsaPublicKey key; + + /** + * The timestamp of the revocation + */ + struct GNUNET_TIME_AbsoluteNBO timestamp; }; GNUNET_NETWORK_STRUCT_END +/** + * Handle to a running proof-of-work calculation. + */ struct GNUNET_REVOCATION_PowCalculationHandle; /** @@ -112,7 +132,8 @@ struct GNUNET_REVOCATION_Query; * */ typedef void (*GNUNET_REVOCATION_Callback) (void *cls, - int is_valid); + enum GNUNET_GenericReturnValue + is_valid); /** @@ -151,7 +172,7 @@ struct GNUNET_REVOCATION_Handle; * @param cfg the configuration to use * @param pow proof of work to use (should have been created by * iteratively calling #GNUNET_REVOCATION_pow_round) - * @param func funtion to call with the result of the check + * @param func function to call with the result of the check * (called with `is_valid` being #GNUNET_NO if * the revocation worked). * @param func_cls closure to pass to @a func @@ -177,40 +198,37 @@ GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h); * * @param pow proof of work * @param matching_bits how many bits must match (configuration) - * @param epoch_length length of single epoch in configuration - * @return GNUNET_YES if the @a pow is acceptable, GNUNET_NO if not + * @param epoch_duration length of single epoch in configuration + * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not */ -int +enum GNUNET_GenericReturnValue GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow, unsigned int matching_bits, - struct GNUNET_TIME_Relative epoch_length); - + struct GNUNET_TIME_Relative epoch_duration); /** - * Initializes a fresh PoW computation + * Initializes a fresh PoW computation. * * @param key the key to calculate the PoW for. - * @param epochs the number of epochs for which the PoW must be valid. - * @param difficulty the base difficulty of the PoW - * @return a handle for use in PoW rounds + * @param pow the pow object to work with in the calculation. */ -struct GNUNET_REVOCATION_PowCalculationHandle* +void GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, - int epochs, - unsigned int difficulty); + struct GNUNET_REVOCATION_Pow *pow); /** - * Initializes PoW computation based on an existing PoW. + * Starts a proof-of-work calculation given the pow object as well as + * target epochs and difficulty. * - * @param pow the PoW to continue the calculations from. + * @param pow the PoW to based calculations on. * @param epochs the number of epochs for which the PoW must be valid. - * @param difficulty the base difficulty of the PoW + * @param difficulty the base difficulty of the PoW. * @return a handle for use in PoW rounds */ struct GNUNET_REVOCATION_PowCalculationHandle* -GNUNET_REVOCATION_pow_init2 (const struct GNUNET_REVOCATION_Pow *pow, +GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_Pow *pow, int epochs, unsigned int difficulty); @@ -221,29 +239,18 @@ GNUNET_REVOCATION_pow_init2 (const struct GNUNET_REVOCATION_Pow *pow, * @param pc handle to the PoW, initially called with NULL. * @return GNUNET_YES if the @a pow is acceptable, GNUNET_NO if not */ -int +enum GNUNET_GenericReturnValue GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc); -/** - * Return the current PoW state from the calculation - * - * @param pc the calculation to get it from - * @return a pointer to the PoW - */ -const struct GNUNET_REVOCATION_Pow* -GNUNET_REVOCATION_pow_get (const struct - GNUNET_REVOCATION_PowCalculationHandle *pc); - - /** * Cleanup a PoW calculation * * @param pc the calculation to clean up */ void -GNUNET_REVOCATION_pow_cleanup (struct - GNUNET_REVOCATION_PowCalculationHandle *pc); +GNUNET_REVOCATION_pow_cleanup ( + struct GNUNET_REVOCATION_PowCalculationHandle *pc); #if 0 /* keep Emacsens' auto-indent happy */ { diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index d290d34c7..2230114ae 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c @@ -93,6 +93,10 @@ static struct GNUNET_TIME_Relative epoch_length; */ static struct GNUNET_SCHEDULER_Task *pow_task; +/** + * Proof-of-work object + */ +static struct GNUNET_REVOCATION_Pow proof_of_work; /** * Function run if the user aborts with CTRL-C. @@ -197,41 +201,14 @@ print_revocation_result (void *cls, int is_valid) } -/** - * Data needed to perform a revocation. - */ -struct RevocationData -{ - /** - * Public key. - */ - struct GNUNET_CRYPTO_EcdsaPublicKey key; - - /** - * Revocation signature data. - */ - struct GNUNET_CRYPTO_EcdsaSignature sig; - - /** - * Time of revocation - */ - struct GNUNET_TIME_AbsoluteNBO ts; - - /** - * Proof of work (in NBO). - */ - uint64_t pow GNUNET_PACKED; -}; - - /** * Perform the revocation. */ static void -perform_revocation (const struct GNUNET_REVOCATION_Pow *pow) +perform_revocation () { h = GNUNET_REVOCATION_revoke (cfg, - pow, + &proof_of_work, &print_revocation_result, NULL); } @@ -244,12 +221,12 @@ perform_revocation (const struct GNUNET_REVOCATION_Pow *pow) * @param rd data to sync */ static void -sync_pow (const struct GNUNET_REVOCATION_Pow *pow) +sync_pow () { if ((NULL != filename) && (sizeof(struct GNUNET_REVOCATION_Pow) != GNUNET_DISK_fn_write (filename, - pow, + &proof_of_work, sizeof(struct GNUNET_REVOCATION_Pow), GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE))) @@ -267,7 +244,7 @@ calculate_pow_shutdown (void *cls) { struct GNUNET_REVOCATION_PowCalculationHandle *ph = cls; fprintf (stderr, "%s", _ ("Cancelling calculation.\n")); - sync_pow (GNUNET_REVOCATION_pow_get (ph)); + sync_pow (); if (NULL != pow_task) { GNUNET_SCHEDULER_cancel (pow_task); @@ -290,22 +267,21 @@ calculate_pow (void *cls) /* store temporary results */ pow_task = NULL; if (0 == (pow_passes % 128)) - sync_pow (GNUNET_REVOCATION_pow_get(ph)); + sync_pow (); /* actually do POW calculation */ if (GNUNET_OK == GNUNET_REVOCATION_pow_round (ph)) { - const struct GNUNET_REVOCATION_Pow *pow = GNUNET_REVOCATION_pow_get (ph); if ((NULL != filename) && (sizeof(struct GNUNET_REVOCATION_Pow) != GNUNET_DISK_fn_write (filename, - pow, + &proof_of_work, sizeof(struct GNUNET_REVOCATION_Pow), GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE))) GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename); if (perform) { - perform_revocation (pow); + perform_revocation (); } else { @@ -343,7 +319,6 @@ calculate_pow (void *cls) static void ego_callback (void *cls, const struct GNUNET_IDENTITY_Ego *ego) { - struct GNUNET_REVOCATION_Pow *pow; struct GNUNET_CRYPTO_EcdsaPublicKey key; const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; struct GNUNET_REVOCATION_PowCalculationHandle *ph = NULL; @@ -357,32 +332,29 @@ ego_callback (void *cls, const struct GNUNET_IDENTITY_Ego *ego) } GNUNET_IDENTITY_ego_get_public_key (ego, &key); privkey = GNUNET_IDENTITY_ego_get_private_key (ego); - pow = GNUNET_new (struct GNUNET_REVOCATION_Pow); + memset(&proof_of_work, 0, sizeof (proof_of_work)); if ((NULL != filename) && (GNUNET_YES == GNUNET_DISK_file_test (filename)) && - (sizeof(struct GNUNET_REVOCATION_Pow) == - GNUNET_DISK_fn_read (filename, pow, sizeof(struct - GNUNET_REVOCATION_Pow)))) + (sizeof(proof_of_work) == + GNUNET_DISK_fn_read (filename, &proof_of_work, sizeof(proof_of_work)))) { - if (0 != GNUNET_memcmp (&pow->key, &key)) + if (0 != GNUNET_memcmp (&proof_of_work.key, &key)) { fprintf (stderr, _ ("Error: revocation certificate in `%s' is not for `%s'\n"), filename, revoke_ego); - GNUNET_free (pow); return; } if (GNUNET_YES == - GNUNET_REVOCATION_check_pow (pow, + GNUNET_REVOCATION_check_pow (&proof_of_work, (unsigned int) matching_bits, epoch_length)) { fprintf (stderr, "%s", _ ("Revocation certificate ready\n")); if (perform) - perform_revocation (pow); + perform_revocation (); else GNUNET_SCHEDULER_shutdown (); - GNUNET_free (pow); return; } /** @@ -391,18 +363,21 @@ ego_callback (void *cls, const struct GNUNET_IDENTITY_Ego *ego) fprintf (stderr, "%s", _("Continuing calculation where left off...\n")); - ph = GNUNET_REVOCATION_pow_init2 (pow, + ph = GNUNET_REVOCATION_pow_start (&proof_of_work, 1, /* Epochs */ matching_bits); - GNUNET_free (pow); } fprintf (stderr, "%s", _ ("Revocation certificate not ready, calculating proof of work\n")); if (NULL == ph) - ph = GNUNET_REVOCATION_pow_init (privkey, - 1, /* Epochs */ - matching_bits); + { + GNUNET_REVOCATION_pow_init (privkey, + &proof_of_work); + ph = GNUNET_REVOCATION_pow_start (&proof_of_work, + 1, /* Epochs */ + matching_bits); + } pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph); GNUNET_SCHEDULER_add_shutdown (&calculate_pow_shutdown, ph); } @@ -423,7 +398,6 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c) { struct GNUNET_CRYPTO_EcdsaPublicKey pk; - struct GNUNET_REVOCATION_Pow pow; cfg = c; if (NULL != test_ego) @@ -483,7 +457,9 @@ run (void *cls, } if ((NULL != filename) && (perform)) { - if (sizeof(pow) != GNUNET_DISK_fn_read (filename, &pow, sizeof(pow))) + if (sizeof(proof_of_work) != GNUNET_DISK_fn_read (filename, + &proof_of_work, + sizeof(proof_of_work))) { fprintf (stderr, _ ("Failed to read revocation certificate from `%s'\n"), @@ -492,20 +468,20 @@ run (void *cls, } GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); if (GNUNET_YES != - GNUNET_REVOCATION_check_pow (&pow, + GNUNET_REVOCATION_check_pow (&proof_of_work, (unsigned int) matching_bits, epoch_length)) { struct GNUNET_REVOCATION_PowCalculationHandle *ph; - ph = GNUNET_REVOCATION_pow_init2 (&pow, - 1, /* Epochs */ - matching_bits); + ph = GNUNET_REVOCATION_pow_start (&proof_of_work, + 1, /* Epochs */ + matching_bits); pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph); GNUNET_SCHEDULER_add_shutdown (&calculate_pow_shutdown, ph); return; } - perform_revocation (&pow); + perform_revocation (); return; } fprintf (stderr, "%s", _ ("No action specified. Nothing to do.\n")); diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index bd35b1055..a9fbd57a7 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c @@ -181,15 +181,6 @@ verify_revoke_message (const struct RevokeMessage *rm) GNUNET_break_op (0); return GNUNET_NO; } - if (GNUNET_OK != - GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION, - &rm->proof_of_work.purpose, - &rm->proof_of_work.signature, - &rm->proof_of_work.key)) - { - GNUNET_break_op (0); - return GNUNET_NO; - } return GNUNET_YES; } diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index 291c58dd8..7bf7799de 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c @@ -83,7 +83,7 @@ struct GNUNET_REVOCATION_PowCalculationHandle /** * The final PoW result data structure. */ - struct GNUNET_REVOCATION_Pow pow; + struct GNUNET_REVOCATION_Pow *pow; /** * The current nonce to try @@ -421,23 +421,22 @@ calculate_score (const struct GNUNET_REVOCATION_PowCalculationHandle *ph) /** - * Check if the given proof-of-work value - * would be acceptable for revoking the given key. + * Check if the given proof-of-work is valid. * - * @param key key to check for - * @param ts revocation timestamp - * @param pow proof of work value + * @param pow proof of work * @param matching_bits how many bits must match (configuration) - * @return GNUNET_YES if the @a pow is acceptable, GNUNET_NO if not + * @param epoch_duration length of single epoch in configuration + * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not */ -int +enum GNUNET_GenericReturnValue GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow, unsigned int difficulty, struct GNUNET_TIME_Relative epoch_length) { char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) - + sizeof (uint64_t) + + sizeof (struct GNUNET_TIME_AbsoluteNBO) + sizeof (uint64_t)] GNUNET_ALIGN; + struct GNUNET_REVOCATION_SignaturePurpose spurp; struct GNUNET_HashCode result; struct GNUNET_TIME_Absolute ts; struct GNUNET_TIME_Absolute exp; @@ -451,9 +450,15 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow, /** * Check if signature valid */ + spurp.key = pow->key; + 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)); if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION, - &pow->purpose, + &spurp.purpose, &pow->signature, &pow->key)) { @@ -527,20 +532,17 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow, /** - * Initializes a fresh PoW computation + * Initializes a fresh PoW computation. * * @param key the key to calculate the PoW for. - * @param epochs the number of epochs for which the PoW must be valid. - * @param difficulty the base difficulty of the PoW - * @return a handle for use in PoW rounds + * @param[out] pow starting point for PoW calculation (not yet valid) */ -struct GNUNET_REVOCATION_PowCalculationHandle* +void GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, - int epochs, - unsigned int difficulty) + struct GNUNET_REVOCATION_Pow *pow) { - struct GNUNET_REVOCATION_PowCalculationHandle *pc; struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get (); + struct GNUNET_REVOCATION_SignaturePurpose rp; /** * Predate the validity period to prevent rejections due to @@ -549,42 +551,39 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, ts = GNUNET_TIME_absolute_subtract (ts, GNUNET_TIME_UNIT_WEEKS); - pc = GNUNET_new (struct GNUNET_REVOCATION_PowCalculationHandle); - pc->pow.timestamp = GNUNET_TIME_absolute_hton (ts); - pc->pow.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); - pc->pow.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) - + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); - GNUNET_CRYPTO_ecdsa_key_get_public (key, &pc->pow.key); + pow->timestamp = GNUNET_TIME_absolute_hton (ts); + 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)); + GNUNET_CRYPTO_ecdsa_key_get_public (key, &pow->key); + rp.key = pow->key; GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecdsa_sign_ (key, - &pc->pow.purpose, - &pc->pow.signature)); - pc->current_pow = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, - UINT64_MAX); - pc->difficulty = difficulty; - pc->epochs = epochs; - return pc; + &rp.purpose, + &pow->signature)); } /** - * Initializes PoW computation based on an existing PoW. + * Starts a proof-of-work calculation given the pow object as well as + * target epochs and difficulty. * - * @param pow the PoW to continue the calculations from. + * @param pow the PoW to based calculations on. * @param epochs the number of epochs for which the PoW must be valid. - * @param difficulty the base difficulty of the PoW + * @param difficulty the base difficulty of the PoW. * @return a handle for use in PoW rounds */ struct GNUNET_REVOCATION_PowCalculationHandle* -GNUNET_REVOCATION_pow_init2 (const struct GNUNET_REVOCATION_Pow *pow, +GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_Pow *pow, int epochs, unsigned int difficulty) { struct GNUNET_REVOCATION_PowCalculationHandle *pc; pc = GNUNET_new (struct GNUNET_REVOCATION_PowCalculationHandle); - pc->pow.key = pow->key; - pc->pow.timestamp = pow->timestamp; + pc->pow = pow; pc->current_pow = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); pc->difficulty = difficulty; @@ -593,7 +592,6 @@ GNUNET_REVOCATION_pow_init2 (const struct GNUNET_REVOCATION_Pow *pow, } - /** * Calculate a key revocation valid for broadcasting for a number * of epochs. @@ -604,7 +602,7 @@ GNUNET_REVOCATION_pow_init2 (const struct GNUNET_REVOCATION_Pow *pow, * @param difficulty current base difficulty to achieve * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not */ -int +enum GNUNET_GenericReturnValue GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) { char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) @@ -624,10 +622,10 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) GNUNET_memcpy (buf, &pc->current_pow, sizeof(uint64_t)); GNUNET_memcpy (&buf[sizeof(uint64_t)], - &pc->pow.timestamp, + &pc->pow->timestamp, sizeof (uint64_t)); GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], - &pc->pow.key, + &pc->pow->key, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); GNUNET_CRYPTO_pow_hash ("gnunet-revocation-proof-of-work", buf, @@ -640,7 +638,7 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) { pc->best[i].bits = zeros; pc->best[i].pow = pc->current_pow; - pc->pow.pow[i] = GNUNET_htonll (pc->current_pow); + pc->pow->pow[i] = GNUNET_htonll (pc->current_pow); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New best score %u with %" PRIu64 " (#%u)\n", zeros, pc->current_pow, i); @@ -662,7 +660,7 @@ const struct GNUNET_REVOCATION_Pow* GNUNET_REVOCATION_pow_get (const struct GNUNET_REVOCATION_PowCalculationHandle *pc) { - return &pc->pow; + return pc->pow; } diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c index 07f5e6e61..84f90fe54 100644 --- a/src/revocation/test_revocation.c +++ b/src/revocation/test_revocation.c @@ -131,7 +131,7 @@ check_revocation (void *cls) static void -revocation_cb (void *cls, int is_valid) +revocation_cb (void *cls, enum GNUNET_GenericReturnValue is_valid) { testpeers[1].revok_handle = NULL; if (GNUNET_NO == is_valid) @@ -147,6 +147,8 @@ ego_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) { static int completed = 0; const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; + struct GNUNET_REVOCATION_Pow proof_of_work; + if ((NULL != ego) && (cls == &testpeers[0])) { @@ -162,9 +164,12 @@ ego_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) GNUNET_IDENTITY_ego_get_public_key (ego, &testpeers[1].pubkey); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Calculating proof of work...\n"); privkey = GNUNET_IDENTITY_ego_get_private_key (ego); - testpeers[1].pow = GNUNET_REVOCATION_pow_init (privkey, - 1, - 5); + memset (&proof_of_work, 0, sizeof (proof_of_work)); + GNUNET_REVOCATION_pow_init (privkey, + &proof_of_work); + testpeers[1].pow = GNUNET_REVOCATION_pow_start (&proof_of_work, + 1, + 5); int res = GNUNET_REVOCATION_pow_round (testpeers[1].pow); while (GNUNET_OK != res) @@ -177,11 +182,9 @@ ego_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) } if (2 == completed) { - const struct GNUNET_REVOCATION_Pow *pow; - pow = GNUNET_REVOCATION_pow_get (testpeers[1].pow); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Egos retrieved\n"); testpeers[1].revok_handle = GNUNET_REVOCATION_revoke (testpeers[1].cfg, - pow, + &proof_of_work, &revocation_cb, NULL); GNUNET_REVOCATION_pow_cleanup (testpeers[1].pow); -- 2.25.1