aboutsummaryrefslogtreecommitdiff
path: root/src/testing/gnunet-testing.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-08-06 14:18:31 +0000
committerChristian Grothoff <christian@grothoff.org>2013-08-06 14:18:31 +0000
commitfe76c075e315c0351e2fe465434ae39087daf014 (patch)
tree436887ccaf331932a3c13a8b9d2a2a710dad4be6 /src/testing/gnunet-testing.c
parent7eb2835d8a494c83aedb720a2ac6f6e5ba23f22f (diff)
downloadgnunet-fe76c075e315c0351e2fe465434ae39087daf014.tar.gz
gnunet-fe76c075e315c0351e2fe465434ae39087daf014.zip
moving to new, fixed-size encoding of public and private ECC keys everywhere, also improving ECC API to better support ECRS/GADS operations
Diffstat (limited to 'src/testing/gnunet-testing.c')
-rw-r--r--src/testing/gnunet-testing.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/testing/gnunet-testing.c b/src/testing/gnunet-testing.c
index 574b585fc..45ca4978c 100644
--- a/src/testing/gnunet-testing.c
+++ b/src/testing/gnunet-testing.c
@@ -118,13 +118,10 @@ create_unique_cfgs (const char * template, const unsigned int no)
118static int 118static int
119create_hostkeys (const unsigned int no) 119create_hostkeys (const unsigned int no)
120{ 120{
121 static char pad[GNUNET_TESTING_HOSTKEYFILESIZE];
122 struct GNUNET_TESTING_System *system; 121 struct GNUNET_TESTING_System *system;
123 struct GNUNET_PeerIdentity id; 122 struct GNUNET_PeerIdentity id;
124 struct GNUNET_DISK_FileHandle *fd; 123 struct GNUNET_DISK_FileHandle *fd;
125 struct GNUNET_CRYPTO_EccPrivateKey *pk; 124 struct GNUNET_CRYPTO_EccPrivateKey *pk;
126 struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *pkb;
127 ssize_t ret;
128 125
129 system = GNUNET_TESTING_system_create ("testing", NULL, NULL, NULL); 126 system = GNUNET_TESTING_system_create ("testing", NULL, NULL, NULL);
130 pk = GNUNET_TESTING_hostkey_get (system, create_no, &id); 127 pk = GNUNET_TESTING_hostkey_get (system, create_no, &id);
@@ -141,19 +138,11 @@ create_hostkeys (const unsigned int no)
141 GNUNET_DISK_PERM_USER_READ | 138 GNUNET_DISK_PERM_USER_READ |
142 GNUNET_DISK_PERM_USER_WRITE); 139 GNUNET_DISK_PERM_USER_WRITE);
143 GNUNET_assert (fd != NULL); 140 GNUNET_assert (fd != NULL);
144 pkb = GNUNET_CRYPTO_ecc_encode_key (pk); 141 ret = GNUNET_DISK_file_write (fd, pk,
145 ret = GNUNET_DISK_file_write (fd, pkb, 142 sizeof (struct GNUNET_CRYPTO_EccPrivateKey));
146 ntohs (pkb->size));
147 GNUNET_assert (ntohs (pkb->size) == ret);
148 GNUNET_assert (ntohs (pkb->size) < GNUNET_TESTING_HOSTKEYFILESIZE);
149 GNUNET_assert (GNUNET_TESTING_HOSTKEYFILESIZE - ret ==
150 GNUNET_DISK_file_write (fd, pad,
151 GNUNET_TESTING_HOSTKEYFILESIZE - ret));
152
153 GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fd)); 143 GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fd));
154 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing", 144 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
155 "Wrote hostkey to file: `%s'\n", create_hostkey); 145 "Wrote hostkey to file: `%s'\n", create_hostkey);
156 GNUNET_free (pkb);
157 GNUNET_CRYPTO_ecc_key_free (pk); 146 GNUNET_CRYPTO_ecc_key_free (pk);
158 GNUNET_TESTING_system_destroy (system, GNUNET_YES); 147 GNUNET_TESTING_system_destroy (system, GNUNET_YES);
159 return 0; 148 return 0;