check signature in check_pow
authorSchanzenbach, Martin <mschanzenbach@posteo.de>
Mon, 20 Apr 2020 16:33:43 +0000 (18:33 +0200)
committerSchanzenbach, Martin <mschanzenbach@posteo.de>
Mon, 20 Apr 2020 16:33:43 +0000 (18:33 +0200)
src/revocation/plugin_block_revocation.c
src/revocation/revocation_api.c

index 934c8d8c9740261178d02285158f8da6180d996e..7c1ec26ebf109dabcfcf08309c1bdd7e4166bb94 100644 (file)
@@ -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);
index 771bcb92dbc7b55eed155cb0cb83d55339c674a0..2979e7400212603a38bdb79692b6d88e3dfb6c1e 100644 (file)
@@ -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
    */