disable use of signatures if nse proof is disabled -- for example, this is done in...
authorChristian Grothoff <christian@grothoff.org>
Thu, 24 Nov 2011 12:31:32 +0000 (12:31 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 24 Nov 2011 12:31:32 +0000 (12:31 +0000)
src/nse/gnunet-service-nse.c
src/nse/nse_profiler_test.conf

index 03c19e0cfa6860b6006a5b78849b150c8a9cd868..dc40cc9182f3c6bf89430b6cbac0fa6df3e33976 100644 (file)
@@ -657,9 +657,12 @@ setup_flood_message (unsigned int slot, struct GNUNET_TIME_Absolute ts)
   fm->timestamp = GNUNET_TIME_absolute_hton (ts);
   fm->pkey = my_public_key;
   fm->proof_of_work = my_proof;
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CRYPTO_rsa_sign (my_private_key, &fm->purpose,
-                                         &fm->signature));
+  if (nse_work_required > 0)
+    GNUNET_assert (GNUNET_OK ==
+                  GNUNET_CRYPTO_rsa_sign (my_private_key, &fm->purpose,
+                                          &fm->signature));
+  else
+    memset (&fm->signature, 0, sizeof (fm->signature));
 }
 
 
@@ -847,12 +850,15 @@ find_proof (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
         if (ntohl (size_estimate_messages[i].hop_count) == 0)
         {
           size_estimate_messages[i].proof_of_work = my_proof;
-          GNUNET_assert (GNUNET_OK ==
-                         GNUNET_CRYPTO_rsa_sign (my_private_key,
-                                                 &size_estimate_messages
-                                                 [i].purpose,
-                                                 &size_estimate_messages
-                                                 [i].signature));
+         if (nse_work_required > 0)
+           GNUNET_assert (GNUNET_OK ==
+                          GNUNET_CRYPTO_rsa_sign (my_private_key,
+                                                  &size_estimate_messages
+                                                  [i].purpose,
+                                                  &size_estimate_messages
+                                                  [i].signature));
+         else
+           memset (&size_estimate_messages[i].signature, 0, sizeof (struct GNUNET_CRYPTO_RsaSignature));
         }
       write_proof ();
       return;
@@ -902,11 +908,12 @@ verify_message_crypto (const struct GNUNET_NSE_FloodMessage *incoming_flood)
     GNUNET_break_op (0);
     return GNUNET_NO;
   }
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_NSE_SEND,
-                                &incoming_flood->purpose,
-                                &incoming_flood->signature,
-                                &incoming_flood->pkey))
+  if ( (nse_work_required > 0) &&
+       (GNUNET_OK !=
+       GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_NSE_SEND,
+                                 &incoming_flood->purpose,
+                                 &incoming_flood->signature,
+                                 &incoming_flood->pkey)) )
   {
     GNUNET_break_op (0);
     return GNUNET_NO;
index 67b56e912ffcb8abba7e043bf346775be2fcf751..2f97a2c09a62ccbb7bf25a1f3b3bcdd79c975d9c 100644 (file)
@@ -13,7 +13,7 @@ DEBUG = NO
 CONFIG = $DEFAULTCONFIG
 # Overriding network settings for faster testing (do NOT use
 # these values in production just because they are here)
-WORKDELAY = 10 s
+WORKDELAY = 60 s
 INTERVAL = 15 s
 WORKBITS = 0
 PROOFFILE = $SERVICEHOME/nse.proof
@@ -70,7 +70,7 @@ PORT = 0
 plugins = unix
 
 [testing]
-NUM_PEERS = 2000
+NUM_PEERS = 1000
 WEAKRANDOM = YES
 TOPOLOGY = NONE
 CONNECT_TOPOLOGY = SMALL_WORLD_RING
@@ -105,5 +105,6 @@ TOPOLOGY_OUTPUT_FILE = nse_topo_100_peers
 #ROUND3 = 100
 #ROUND2 = 500
 #ROUND3 = 1000
-WAIT_TIME = 1200 s
+WAIT_TIME = 120 s
 CONNECTION_LIMIT = 10
+