aboutsummaryrefslogtreecommitdiff
path: root/src/testing/gnunet-testing.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-02-05 20:49:21 +0000
committerChristian Grothoff <christian@grothoff.org>2013-02-05 20:49:21 +0000
commitca35f67faee8371fa763bdf49f04a8d5d4cdc021 (patch)
tree5535df5e5a2428ed838c6a0e60b2c6c68a7842c5 /src/testing/gnunet-testing.c
parentdd7cca21c5dbaef4d56f92bab3932f0f73d092d1 (diff)
downloadgnunet-ca35f67faee8371fa763bdf49f04a8d5d4cdc021.tar.gz
gnunet-ca35f67faee8371fa763bdf49f04a8d5d4cdc021.zip
switching to ECDHE cryptography f, implementation is incomplete and INSECURE, do not use for anything but testing
Diffstat (limited to 'src/testing/gnunet-testing.c')
-rw-r--r--src/testing/gnunet-testing.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/testing/gnunet-testing.c b/src/testing/gnunet-testing.c
index 28c5be965..eb85e155e 100644
--- a/src/testing/gnunet-testing.c
+++ b/src/testing/gnunet-testing.c
@@ -28,7 +28,7 @@
28#include "gnunet_testing_lib.h" 28#include "gnunet_testing_lib.h"
29 29
30 30
31#define HOSTKEYFILESIZE 914 31#define HOSTKEYFILESIZE 1024
32 32
33/** 33/**
34 * Final status code. 34 * Final status code.
@@ -119,11 +119,13 @@ create_unique_cfgs (const char * template, const unsigned int no)
119static int 119static int
120create_hostkeys (const unsigned int no) 120create_hostkeys (const unsigned int no)
121{ 121{
122 static char pad[HOSTKEYFILESIZE];
122 struct GNUNET_TESTING_System *system; 123 struct GNUNET_TESTING_System *system;
123 struct GNUNET_PeerIdentity id; 124 struct GNUNET_PeerIdentity id;
124 struct GNUNET_DISK_FileHandle *fd; 125 struct GNUNET_DISK_FileHandle *fd;
125 struct GNUNET_CRYPTO_RsaPrivateKey *pk; 126 struct GNUNET_CRYPTO_EccPrivateKey *pk;
126 struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded *pkb; 127 struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *pkb;
128 ssize_t ret;
127 129
128 system = GNUNET_TESTING_system_create ("testing", NULL, NULL); 130 system = GNUNET_TESTING_system_create ("testing", NULL, NULL);
129 pk = GNUNET_TESTING_hostkey_get (system, create_no, &id); 131 pk = GNUNET_TESTING_hostkey_get (system, create_no, &id);
@@ -140,14 +142,20 @@ create_hostkeys (const unsigned int no)
140 GNUNET_DISK_PERM_USER_READ | 142 GNUNET_DISK_PERM_USER_READ |
141 GNUNET_DISK_PERM_USER_WRITE); 143 GNUNET_DISK_PERM_USER_WRITE);
142 GNUNET_assert (fd != NULL); 144 GNUNET_assert (fd != NULL);
143 pkb = GNUNET_CRYPTO_rsa_encode_key (pk); 145 pkb = GNUNET_CRYPTO_ecc_encode_key (pk);
144 GNUNET_assert (HOSTKEYFILESIZE == 146 ret = GNUNET_DISK_file_write (fd, pkb,
145 GNUNET_DISK_file_write (fd, pkb, ntohs (pkb->len))); 147 ntohs (pkb->size));
148 GNUNET_assert (ntohs (pkb->size) == ret);
149 GNUNET_assert (ntohs (pkb->size) < HOSTKEYFILESIZE);
150 GNUNET_assert (HOSTKEYFILESIZE - ret ==
151 GNUNET_DISK_file_write (fd, pad,
152 HOSTKEYFILESIZE - ret));
153
146 GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fd)); 154 GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fd));
147 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing", 155 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
148 "Wrote hostkey to file: `%s'\n", create_hostkey); 156 "Wrote hostkey to file: `%s'\n", create_hostkey);
149 GNUNET_free (pkb); 157 GNUNET_free (pkb);
150 GNUNET_CRYPTO_rsa_key_free (pk); 158 GNUNET_CRYPTO_ecc_key_free (pk);
151 GNUNET_TESTING_system_destroy (system, GNUNET_YES); 159 GNUNET_TESTING_system_destroy (system, GNUNET_YES);
152 return 0; 160 return 0;
153} 161}