From 7cde88367991dcd1deca2485970c353fec5aff3e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 30 Nov 2019 23:08:49 +0100 Subject: use new POW function consistently, also in revocation --- src/revocation/revocation_api.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'src/revocation/revocation_api.c') diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index fd25050e2..ea8db835f 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c @@ -323,29 +323,6 @@ GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h) } -/** - * Calculate the 'proof-of-work' hash (an expensive hash). - * - * @param buf data to hash - * @param buf_len number of bytes in @a buf - * @param result where to write the resulting hash - */ -static void -pow_hash (const void *buf, - size_t buf_len, - struct GNUNET_HashCode *result) -{ - GNUNET_break (0 == - gcry_kdf_derive (buf, buf_len, - GCRY_KDF_SCRYPT, - 1 /* subalgo */, - "gnunet-revocation-proof-of-work", - strlen ("gnunet-revocation-proof-of-work"), - 2 /* iterations; keep cost of individual op small */, - sizeof(struct GNUNET_HashCode), result)); -} - - /** * Count the leading zeroes in hash. * @@ -385,7 +362,10 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key, GNUNET_memcpy (buf, &pow, sizeof(pow)); GNUNET_memcpy (&buf[sizeof(pow)], key, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); - pow_hash (buf, sizeof(buf), &result); + GNUNET_CRYPTO_pow_hash ("gnunet-revocation-proof-of-work", + buf, + sizeof(buf), + &result); return (count_leading_zeroes (&result) >= matching_bits) ? GNUNET_YES : GNUNET_NO; } -- cgit v1.2.3