diff options
author | harsha <harsha@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-10-11 18:54:14 +0000 |
---|---|---|
committer | harsha <harsha@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-10-11 18:54:14 +0000 |
commit | 672410298994424792e1f2fd04699ce2c63b68ba (patch) | |
tree | d614bec9528c17355b762ca8c6b38b38a8159b64 /src/testing | |
parent | f7c2965089d1ba5ac4217db59f25e61e779b5523 (diff) |
using header-defined hostkeyfilesize
git-svn-id: https://gnunet.org/svn/gnunet@24278 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/testing.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c index 8a5ff66797..b4f8c81002 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -37,11 +37,6 @@ GNUNET_log_from (kind, "testing-api", __VA_ARGS__) /** - * Size of a hostkey when written to a file - */ -#define HOSTKEYFILESIZE 914 - -/** * Lowest port used for GNUnet testing. Should be high enough to not * conflict with other applications running on the hosts but be low * enough to not conflict with client-ports (typically starting around @@ -79,7 +74,7 @@ struct GNUNET_TESTING_System char *hostname; /** - * Hostkeys data, contains "HOSTKEYFILESIZE * total_hostkeys" bytes. + * Hostkeys data, contains "GNUNET_TESTING_HOSTKEYFILESIZE * total_hostkeys" bytes. */ char *hostkeys_data; @@ -213,7 +208,7 @@ hostkeys_load (struct GNUNET_TESTING_System *system) GNUNET_free (filename); return GNUNET_SYSERR; /* File is empty */ } - if (0 != (fs % HOSTKEYFILESIZE)) + if (0 != (fs % GNUNET_TESTING_HOSTKEYFILESIZE)) { LOG (GNUNET_ERROR_TYPE_ERROR, _("Incorrect hostkey file format: %s\n"), filename); @@ -228,7 +223,7 @@ hostkeys_load (struct GNUNET_TESTING_System *system) GNUNET_free (filename); return GNUNET_SYSERR; } - system->total_hostkeys = fs / HOSTKEYFILESIZE; + system->total_hostkeys = fs / GNUNET_TESTING_HOSTKEYFILESIZE; system->hostkeys_data = GNUNET_DISK_file_map (system->map_fd, &system->map, GNUNET_DISK_MAP_TYPE_READ, @@ -524,8 +519,9 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, return NULL; } private_key = GNUNET_CRYPTO_rsa_decode_key (system->hostkeys_data + - (key_number * HOSTKEYFILESIZE), - HOSTKEYFILESIZE); + (key_number * + GNUNET_TESTING_HOSTKEYFILESIZE), + GNUNET_TESTING_HOSTKEYFILESIZE); if (NULL == private_key) { LOG (GNUNET_ERROR_TYPE_ERROR, @@ -892,10 +888,10 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, GNUNET_break (0); return NULL; } - if (HOSTKEYFILESIZE != + if (GNUNET_TESTING_HOSTKEYFILESIZE != GNUNET_DISK_file_write (fd, system->hostkeys_data - + (key_number * HOSTKEYFILESIZE), - HOSTKEYFILESIZE)) + + (key_number * GNUNET_TESTING_HOSTKEYFILESIZE), + GNUNET_TESTING_HOSTKEYFILESIZE)) { GNUNET_asprintf (&emsg_, _("Failed to write hostkey file for peer %u: %s\n"), |