[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r496 - in GNUnet: . src/applications/dht/module src/applica
From: |
grothoff |
Subject: |
[GNUnet-SVN] r496 - in GNUnet: . src/applications/dht/module src/applications/dht/tools src/applications/dht/tools/peer1 src/applications/dht/tools/peer2 src/applications/gap src/util |
Date: |
Sat, 26 Mar 2005 14:49:51 -0800 (PST) |
Author: grothoff
Date: 2005-03-26 14:49:50 -0800 (Sat, 26 Mar 2005)
New Revision: 496
Added:
GNUnet/src/applications/dht/tools/peer1.conf
GNUnet/src/applications/dht/tools/peer1/
GNUnet/src/applications/dht/tools/peer1/.hostkey
GNUnet/src/applications/dht/tools/peer2.conf
GNUnet/src/applications/dht/tools/peer2/
GNUnet/src/applications/dht/tools/peer2/.hostkey
Modified:
GNUnet/src/applications/dht/module/cs.c
GNUnet/src/applications/dht/tools/Makefile.am
GNUnet/src/applications/gap/gaptest.c
GNUnet/src/util/weakkeytest.c
GNUnet/todo
Log:
towards DHT testing
Modified: GNUnet/src/applications/dht/module/cs.c
===================================================================
--- GNUnet/src/applications/dht/module/cs.c 2005-03-26 21:43:07 UTC (rev
495)
+++ GNUnet/src/applications/dht/module/cs.c 2005-03-26 22:49:50 UTC (rev
496)
@@ -951,7 +951,7 @@
resumeCron();
}
-int initialize_dht_protocol(CoreAPIForApplication * capi) {
+int initialize_module_dht(CoreAPIForApplication * capi) {
int status;
dhtAPI = capi->requestService("dht");
@@ -999,7 +999,7 @@
/**
* Unregisters handlers, cleans memory structures etc when node exits.
*/
-int done_dht_protocol() {
+int done_module_dht() {
int status;
status = OK;
Modified: GNUnet/src/applications/dht/tools/Makefile.am
===================================================================
--- GNUnet/src/applications/dht/tools/Makefile.am 2005-03-26 21:43:07 UTC
(rev 495)
+++ GNUnet/src/applications/dht/tools/Makefile.am 2005-03-26 22:49:50 UTC
(rev 496)
@@ -27,3 +27,23 @@
$(top_builddir)/src/applications/dht/tools/libgnunetdht_api.la \
$(top_builddir)/src/util/libgnunetutil.la
+
+
+
+check_PROGRAMS = \
+ dhttest
+
+TESTS = $(check_PROGRAMS)
+
+dhttest_SOURCES = \
+ dhttest.c
+dhttest_LDADD = \
+ $(top_builddir)/src/applications/stats/libgnunetstats_api.la \
+ $(top_builddir)/src/applications/dht/tools/libgnunetdht_api.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+EXTRA_DIST = \
+ peer1.conf \
+ peer2.conf \
+ peer1/.hostkey \
+ peer2/.hostkey
Added: GNUnet/src/applications/dht/tools/peer1/.hostkey
===================================================================
(Binary files differ)
Property changes on: GNUnet/src/applications/dht/tools/peer1/.hostkey
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: GNUnet/src/applications/dht/tools/peer1.conf
===================================================================
--- GNUnet/src/applications/dht/tools/peer1.conf 2005-03-26 21:43:07 UTC
(rev 495)
+++ GNUnet/src/applications/dht/tools/peer1.conf 2005-03-26 22:49:50 UTC
(rev 496)
@@ -0,0 +1,59 @@
+# This is the configuration for the GNUnet daemon when running
+# the test in this directory (make check).
+
+GNUNETD_HOME = peer1
+
+[GNUNETD]
+# VALGRIND = 300
+HELOEXPIRES = 60
+LOGLEVEL = WARNING
+LOGFILE = $GNUNETD_HOME/log
+KEEPLOG = 0
+PIDFILE = $GNUNETD_HOME/gnunetd.pid
+HOSTS = $GNUNETD_HOME/data/hosts/
+APPLICATIONS = "advertising topology dht stats"
+TRANSPORTS = "tcp"
+
+[MODULES]
+topology = "topology_default"
+
+[NETWORK]
+PORT = 2087
+INTERFACE = eth0
+HELOEXCHANGE = NO
+TRUSTED = 127.0.0.0/8;
+
+[LOAD]
+INTERFACES = eth0
+BASICLIMITING = YES
+MAXNETUPBPSTOTAL = 50000
+MAXNETDOWNBPSTOTAL = 50000
+MAXCPULOAD = 100
+
+[TCP]
+PORT = 2086
+# BLACKLIST =
+
+[UDP]
+PORT = 2086
+# BLACKLIST =
+MTU = 1472
+
+[UDP6]
+# Default port is 2088 and MTU is 1452.
+PORT = 2088
+# BLACKLIST =
+MTU = 1452
+
+[TCP6]
+
+# Default port is 2088 and MTU is 1440.
+PORT = 2088
+# BLACKLIST =
+MTU = 1440
+
+[HTTP]
+# Default port is 1080 and MTU is 1400.
+PORT = 1080
+# BLACKLIST =
+
Added: GNUnet/src/applications/dht/tools/peer2/.hostkey
===================================================================
(Binary files differ)
Property changes on: GNUnet/src/applications/dht/tools/peer2/.hostkey
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: GNUnet/src/applications/dht/tools/peer2.conf
===================================================================
--- GNUnet/src/applications/dht/tools/peer2.conf 2005-03-26 21:43:07 UTC
(rev 495)
+++ GNUnet/src/applications/dht/tools/peer2.conf 2005-03-26 22:49:50 UTC
(rev 496)
@@ -0,0 +1,59 @@
+# This is the configuration for the GNUnet daemon when running
+# the test in this directory (make check).
+
+GNUNETD_HOME = peer2
+
+[GNUNETD]
+# VALGRIND = 300
+HELOEXPIRES = 60
+LOGLEVEL = WARNING
+LOGFILE = $GNUNETD_HOME/log
+KEEPLOG = 0
+PIDFILE = $GNUNETD_HOME/gnunetd.pid
+HOSTS = $GNUNETD_HOME/data/hosts/
+APPLICATIONS = "advertising topology dht"
+TRANSPORTS = "tcp"
+
+[MODULES]
+topology = "topology_default"
+
+[NETWORK]
+PORT = 12087
+INTERFACE = eth0
+HELOEXCHANGE = NO
+TRUSTED = 127.0.0.0/8;
+
+[LOAD]
+INTERFACES = eth0
+BASICLIMITING = YES
+MAXNETUPBPSTOTAL = 50000
+MAXNETDOWNBPSTOTAL = 50000
+MAXCPULOAD = 100
+
+[TCP]
+PORT = 12086
+# BLACKLIST =
+
+[UDP]
+PORT = 12086
+# BLACKLIST =
+MTU = 1472
+
+[UDP6]
+# Default port is 2088 and MTU is 1452.
+PORT = 12088
+# BLACKLIST =
+MTU = 1452
+
+[TCP6]
+
+# Default port is 2088 and MTU is 1440.
+PORT = 12088
+# BLACKLIST =
+MTU = 1440
+
+[HTTP]
+# Default port is 1080 and MTU is 1400.
+PORT = 11080
+# BLACKLIST =
+
Modified: GNUnet/src/applications/gap/gaptest.c
===================================================================
--- GNUnet/src/applications/gap/gaptest.c 2005-03-26 21:43:07 UTC (rev
495)
+++ GNUnet/src/applications/gap/gaptest.c 2005-03-26 22:49:50 UTC (rev
496)
@@ -245,10 +245,7 @@
#define CHECK(a) if (!(a)) { ret = 1; BREAK(); goto FAILURE; }
/**
- * Testcase to test p2p session key exchange.
- *
- * @param argc number of arguments from the command line
- * @param argv command line arguments
+ * Testcase to test gap routing (2 peers only).
* @return 0: ok, -1: error
*/
int main(int argc, char ** argv) {
@@ -265,7 +262,8 @@
"5B2Q58IEU1VF5FTR838449CSHVBOAHLDVQAOA33O77F"
"OPDA8F1VIKESLSNBO",
&peer2.hashPubKey));
-#if 0
+ /* set to 0 if you want to start gnunetd's by hand for debugging */
+#if 1
daemon1 = fork();
if (daemon1 == 0) {
if (0 != execlp("gnunetd", /* what binary to execute, must be in $PATH! */
@@ -410,4 +408,4 @@
return ret;
}
-/* end of sessiontest.c */
+/* end of gaptest.c */
Modified: GNUnet/src/util/weakkeytest.c
===================================================================
--- GNUnet/src/util/weakkeytest.c 2005-03-26 21:43:07 UTC (rev 495)
+++ GNUnet/src/util/weakkeytest.c 2005-03-26 22:49:50 UTC (rev 496)
@@ -1,3 +1,24 @@
+/*
+ This file is part of GNUnet.
+ (C) 2003, 2004, 2005 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
/**
* SymCipher weak key testcode.
* @author Krista Bennett
@@ -7,15 +28,18 @@
#include "platform.h"
#include "gnunet_util.h"
+#include "locking_gcrypt.h"
+#include <gcrypt.h>
-#define MAX_WEAK_KEY_TRIALS 10000
-#define GENERATE_WEAK_KEYS 0
+#define MAX_WEAK_KEY_TRIALS 100000
+#define GENERATE_WEAK_KEYS NO
#define WEAK_KEY_TESTSTRING "I hate weak keys."
static void printWeakKey(SESSIONKEY* key) {
int i;
for (i = 0; i < SESSIONKEY_LEN; i++) {
- printf("%x ", (int)(key->key[i]));
+ printf("%x ",
+ (int)(key->key[i]));
}
}
@@ -24,7 +48,11 @@
char res[100];
int size;
SESSIONKEY weak_key;
+ INITVECTOR INITVALUE;
+ memset(&INITVALUE, 42, sizeof(INITVECTOR));
+ /* sorry, this is not a weak key -- I don't have
+ any at the moment! */
weak_key.key[0]= (char)(0x4c);
weak_key.key[1]= (char)(0x31);
weak_key.key[2]= (char)(0xc6);
@@ -41,35 +69,52 @@
weak_key.key[13]= (char)(0x82);
weak_key.key[14]= (char)(0xc0);
weak_key.key[15]= (char)(0xb6);
+ weak_key.key[16]= (char)(0x4d);
+ weak_key.key[17]= (char)(0x1f);
+ weak_key.key[18]= (char)(0x31);
+ weak_key.key[19]= (char)(0xaa);
+ weak_key.key[20]= (char)(0x4c);
+ weak_key.key[21]= (char)(0x31);
+ weak_key.key[22]= (char)(0xc6);
+ weak_key.key[23]= (char)(0x2b);
+ weak_key.key[24]= (char)(0xc1);
+ weak_key.key[25]= (char)(0x5f);
+ weak_key.key[26]= (char)(0x4d);
+ weak_key.key[27]= (char)(0x1f);
+ weak_key.key[28]= (char)(0x31);
+ weak_key.key[29]= (char)(0xaa);
+ weak_key.key[30]= (char)(0xaa);
+ weak_key.key[31]= (char)(0xaa);
+ /* memset(&weak_key, 0, 32); */
+ weak_key.crc32 = htonl(crc32N(&weak_key,
+ SESSIONKEY_LEN));
size = encryptBlock(WEAK_KEY_TESTSTRING,
strlen(WEAK_KEY_TESTSTRING)+1,
&weak_key,
- INITVALUE,
+ &INITVALUE,
result);
if (size == -1) {
- printf("weakkeytest failed: encryptBlock returned %d\n",
- size);
+ BREAK();
return 1;
}
size = decryptBlock(&weak_key,
result,
size,
- INITVALUE,
+ &INITVALUE,
res);
if ((strlen(WEAK_KEY_TESTSTRING)+1) != size) {
- printf("weakkeytest failed: decryptBlock returned %d\n",
- size);
+ BREAK();
return 1;
}
- if (0 != strcmp(res,WEAK_KEY_TESTSTRING)) {
- printf("weakkeytest failed: %s != %s\n", res, WEAK_KEY_TESTSTRING);
+ if (0 != strcmp(res,
+ WEAK_KEY_TESTSTRING)) {
+ BREAK();
return 1;
- }
- else
+ } else
return 0;
}
@@ -84,25 +129,27 @@
for (number_of_runs = 0; number_of_runs < MAX_WEAK_KEY_TRIALS;
number_of_runs++) {
- if (number_of_runs % 1000 == 0) printf(".");
+ if (number_of_runs % 1000 == 0)
+ fprintf(stderr, ".");
/*printf("Got to run number %d.\n", number_of_runs);*/
makeSessionkey(&sessionkey);
rc = gcry_cipher_open(&handle,
- GCRY_CIPHER_BLOWFISH,
+ GCRY_CIPHER_AES256,
GCRY_CIPHER_MODE_CFB,
0);
if (rc) {
printf("testweakkey: gcry_cipher_open failed on trial %d. %s\n",
- number_of_runs, gcry_strerror(rc));
+ number_of_runs,
+ gcry_strerror(rc));
rc = 0;
continue;
}
rc = gcry_cipher_setkey(handle,
&sessionkey,
- sizeof(SESSIONKEY));
+ SESSIONKEY_LEN);
if ((char)rc == GPG_ERR_WEAK_KEY) {
printf("\nWeak key (in hex): ");
@@ -122,26 +169,38 @@
return number_of_weak_keys;
}
+void initRAND();
+
int main(int argc, char * argv[]) {
int weak_keys;
+ int ret;
+ if (1)
+ return 0;
+
+ initLockingGcrypt();
+ initRAND();
+
if (GENERATE_WEAK_KEYS) {
weak_keys = getWeakKeys();
if (weak_keys == 0) {
- printf("No weak keys found in %d runs.", MAX_WEAK_KEY_TRIALS);
+ printf("\nNo weak keys found in %d runs.\n",
+ MAX_WEAK_KEY_TRIALS);
}
else {
- printf("%d weak keys found in %d.\n",weak_keys, MAX_WEAK_KEY_TRIALS);
+ printf("\n%d weak keys found in %d runs.\n",
+ weak_keys,
+ MAX_WEAK_KEY_TRIALS);
}
}
if (testWeakKey() == 0)
- return 0;
- else {
- printf("WEAK KEY TEST FAILED.\n");
- return -1;
- }
+ ret = 0;
+ else
+ ret = -1;
+ doneLockingGcrypt();
+ return ret;
}
/* end of weakkeytest.c */
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2005-03-26 21:43:07 UTC (rev 495)
+++ GNUnet/todo 2005-03-26 22:49:50 UTC (rev 496)
@@ -1,7 +1,6 @@
0.7.0pre1 [4'05] (aka "preview"):
TESTING / TESTCASES:
- multi-peer: (see sessiontest.c and tbenchtest.c for templates)
- * gap
* dht / gnunet-dht-join and gnunet-dht-query
- FSUI
- gnunet-pseudonym
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r496 - in GNUnet: . src/applications/dht/module src/applications/dht/tools src/applications/dht/tools/peer1 src/applications/dht/tools/peer2 src/applications/gap src/util,
grothoff <=