gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 19/31: check signature in check_pow


From: gnunet
Subject: [gnunet] 19/31: check signature in check_pow
Date: Wed, 22 Apr 2020 21:53:10 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit 424cd50ecd0144b264a547fe149839cf2866c21f
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Mon Apr 20 18:33:43 2020 +0200

    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
    */

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]