summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2020-04-20 18:33:43 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2020-04-20 18:33:43 +0200
commit424cd50ecd0144b264a547fe149839cf2866c21f (patch)
tree373a8f4fd6aa8b993cfb388601b05d54bd6b8799
parent24d5d46ade3ad70889855cdbe3a1a61754bdfb92 (diff)
check signature in check_pow
-rw-r--r--src/revocation/plugin_block_revocation.c9
-rw-r--r--src/revocation/revocation_api.c14
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
@@ -424,6 +424,20 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
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
*/
for (unsigned int i = 0; i < POW_COUNT; i++)