From a92668f2a2ab74578c3c7aee7ef9f621f1498cd4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 24 Nov 2011 12:31:32 +0000 Subject: [PATCH] disable use of signatures if nse proof is disabled -- for example, this is done in testing/benchmarking --- src/nse/gnunet-service-nse.c | 35 ++++++++++++++++++++-------------- src/nse/nse_profiler_test.conf | 7 ++++--- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 03c19e0cf..dc40cc918 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c @@ -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; diff --git a/src/nse/nse_profiler_test.conf b/src/nse/nse_profiler_test.conf index 67b56e912..2f97a2c09 100644 --- a/src/nse/nse_profiler_test.conf +++ b/src/nse/nse_profiler_test.conf @@ -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 + -- 2.25.1