From 424cd50ecd0144b264a547fe149839cf2866c21f Mon Sep 17 00:00:00 2001 From: "Schanzenbach, Martin" Date: Mon, 20 Apr 2020 18:33:43 +0200 Subject: [PATCH] check signature in check_pow --- src/revocation/plugin_block_revocation.c | 9 --------- src/revocation/revocation_api.c | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/revocation/plugin_block_revocation.c b/src/revocation/plugin_block_revocation.c index 934c8d8c9..7c1ec26eb 100644 --- a/src/revocation/plugin_block_revocation.c +++ b/src/revocation/plugin_block_revocation.c @@ -149,15 +149,6 @@ block_plugin_revocation_evaluate (void *cls, GNUNET_break_op (0); return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; } - 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_BLOCK_EVALUATION_RESULT_INVALID; - } GNUNET_CRYPTO_hash (&rm->proof_of_work.key, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), &chash); diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index 771bcb92d..2979e7400 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c @@ -423,6 +423,20 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow, unsigned int epochs; uint64_t pow_val; + /** + * Check if signature valid + */ + if (GNUNET_OK != + GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION, + &pow->purpose, + &pow->signature, + &pow->key)) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Proof of work signature invalid!\n"); + return -1; + } + /** * First, check if any duplicates are in the PoW set */ -- 2.25.1