aboutsummaryrefslogtreecommitdiff
path: root/src/nse
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-11-24 12:31:32 +0000
committerChristian Grothoff <christian@grothoff.org>2011-11-24 12:31:32 +0000
commita92668f2a2ab74578c3c7aee7ef9f621f1498cd4 (patch)
treea263f9e5a909327bbe045b0f1f80f5c91997ad63 /src/nse
parentce43938102711364faf74972884862dc13a0d985 (diff)
downloadgnunet-a92668f2a2ab74578c3c7aee7ef9f621f1498cd4.tar.gz
gnunet-a92668f2a2ab74578c3c7aee7ef9f621f1498cd4.zip
disable use of signatures if nse proof is disabled -- for example, this is done in testing/benchmarking
Diffstat (limited to 'src/nse')
-rw-r--r--src/nse/gnunet-service-nse.c35
-rw-r--r--src/nse/nse_profiler_test.conf7
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)
657 fm->timestamp = GNUNET_TIME_absolute_hton (ts); 657 fm->timestamp = GNUNET_TIME_absolute_hton (ts);
658 fm->pkey = my_public_key; 658 fm->pkey = my_public_key;
659 fm->proof_of_work = my_proof; 659 fm->proof_of_work = my_proof;
660 GNUNET_assert (GNUNET_OK == 660 if (nse_work_required > 0)
661 GNUNET_CRYPTO_rsa_sign (my_private_key, &fm->purpose, 661 GNUNET_assert (GNUNET_OK ==
662 &fm->signature)); 662 GNUNET_CRYPTO_rsa_sign (my_private_key, &fm->purpose,
663 &fm->signature));
664 else
665 memset (&fm->signature, 0, sizeof (fm->signature));
663} 666}
664 667
665 668
@@ -847,12 +850,15 @@ find_proof (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
847 if (ntohl (size_estimate_messages[i].hop_count) == 0) 850 if (ntohl (size_estimate_messages[i].hop_count) == 0)
848 { 851 {
849 size_estimate_messages[i].proof_of_work = my_proof; 852 size_estimate_messages[i].proof_of_work = my_proof;
850 GNUNET_assert (GNUNET_OK == 853 if (nse_work_required > 0)
851 GNUNET_CRYPTO_rsa_sign (my_private_key, 854 GNUNET_assert (GNUNET_OK ==
852 &size_estimate_messages 855 GNUNET_CRYPTO_rsa_sign (my_private_key,
853 [i].purpose, 856 &size_estimate_messages
854 &size_estimate_messages 857 [i].purpose,
855 [i].signature)); 858 &size_estimate_messages
859 [i].signature));
860 else
861 memset (&size_estimate_messages[i].signature, 0, sizeof (struct GNUNET_CRYPTO_RsaSignature));
856 } 862 }
857 write_proof (); 863 write_proof ();
858 return; 864 return;
@@ -902,11 +908,12 @@ verify_message_crypto (const struct GNUNET_NSE_FloodMessage *incoming_flood)
902 GNUNET_break_op (0); 908 GNUNET_break_op (0);
903 return GNUNET_NO; 909 return GNUNET_NO;
904 } 910 }
905 if (GNUNET_OK != 911 if ( (nse_work_required > 0) &&
906 GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_NSE_SEND, 912 (GNUNET_OK !=
907 &incoming_flood->purpose, 913 GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_NSE_SEND,
908 &incoming_flood->signature, 914 &incoming_flood->purpose,
909 &incoming_flood->pkey)) 915 &incoming_flood->signature,
916 &incoming_flood->pkey)) )
910 { 917 {
911 GNUNET_break_op (0); 918 GNUNET_break_op (0);
912 return GNUNET_NO; 919 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
13CONFIG = $DEFAULTCONFIG 13CONFIG = $DEFAULTCONFIG
14# Overriding network settings for faster testing (do NOT use 14# Overriding network settings for faster testing (do NOT use
15# these values in production just because they are here) 15# these values in production just because they are here)
16WORKDELAY = 10 s 16WORKDELAY = 60 s
17INTERVAL = 15 s 17INTERVAL = 15 s
18WORKBITS = 0 18WORKBITS = 0
19PROOFFILE = $SERVICEHOME/nse.proof 19PROOFFILE = $SERVICEHOME/nse.proof
@@ -70,7 +70,7 @@ PORT = 0
70plugins = unix 70plugins = unix
71 71
72[testing] 72[testing]
73NUM_PEERS = 2000 73NUM_PEERS = 1000
74WEAKRANDOM = YES 74WEAKRANDOM = YES
75TOPOLOGY = NONE 75TOPOLOGY = NONE
76CONNECT_TOPOLOGY = SMALL_WORLD_RING 76CONNECT_TOPOLOGY = SMALL_WORLD_RING
@@ -105,5 +105,6 @@ TOPOLOGY_OUTPUT_FILE = nse_topo_100_peers
105#ROUND3 = 100 105#ROUND3 = 100
106#ROUND2 = 500 106#ROUND2 = 500
107#ROUND3 = 1000 107#ROUND3 = 1000
108WAIT_TIME = 1200 s 108WAIT_TIME = 120 s
109CONNECTION_LIMIT = 10 109CONNECTION_LIMIT = 10
110