aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing.c')
-rw-r--r--src/testing/testing.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c
index dd80f6ea5..16f902890 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -202,7 +202,7 @@ hostkeys_load (struct GNUNET_TESTING_System *system)
202 202
203 GNUNET_assert (NULL == system->hostkeys_data); 203 GNUNET_assert (NULL == system->hostkeys_data);
204 data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); 204 data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
205 GNUNET_asprintf (&filename, "%s/testing_hostkeys.dat", data_dir); 205 GNUNET_asprintf (&filename, "%s/testing_hostkeys.ecc", data_dir);
206 GNUNET_free (data_dir); 206 GNUNET_free (data_dir);
207 207
208 if (GNUNET_YES != GNUNET_DISK_file_test (filename)) 208 if (GNUNET_YES != GNUNET_DISK_file_test (filename))
@@ -525,13 +525,13 @@ reserve_path (struct GNUNET_TESTING_System *system)
525 * key; if NULL, GNUNET_SYSERR is returned immediately 525 * key; if NULL, GNUNET_SYSERR is returned immediately
526 * @return NULL on error (not enough keys) 526 * @return NULL on error (not enough keys)
527 */ 527 */
528struct GNUNET_CRYPTO_RsaPrivateKey * 528struct GNUNET_CRYPTO_EccPrivateKey *
529GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, 529GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
530 uint32_t key_number, 530 uint32_t key_number,
531 struct GNUNET_PeerIdentity *id) 531 struct GNUNET_PeerIdentity *id)
532{ 532{
533 struct GNUNET_CRYPTO_RsaPrivateKey *private_key; 533 struct GNUNET_CRYPTO_EccPrivateKey *private_key;
534 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded public_key; 534 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded public_key;
535 535
536 if ((NULL == id) || (NULL == system->hostkeys_data)) 536 if ((NULL == id) || (NULL == system->hostkeys_data))
537 return NULL; 537 return NULL;
@@ -541,7 +541,7 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
541 _("Key number %u does not exist\n"), key_number); 541 _("Key number %u does not exist\n"), key_number);
542 return NULL; 542 return NULL;
543 } 543 }
544 private_key = GNUNET_CRYPTO_rsa_decode_key (system->hostkeys_data + 544 private_key = GNUNET_CRYPTO_ecc_decode_key (system->hostkeys_data +
545 (key_number * 545 (key_number *
546 GNUNET_TESTING_HOSTKEYFILESIZE), 546 GNUNET_TESTING_HOSTKEYFILESIZE),
547 GNUNET_TESTING_HOSTKEYFILESIZE); 547 GNUNET_TESTING_HOSTKEYFILESIZE);
@@ -551,9 +551,9 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
551 _("Error while decoding key %u\n"), key_number); 551 _("Error while decoding key %u\n"), key_number);
552 return NULL; 552 return NULL;
553 } 553 }
554 GNUNET_CRYPTO_rsa_key_get_public (private_key, &public_key); 554 GNUNET_CRYPTO_ecc_key_get_public (private_key, &public_key);
555 GNUNET_CRYPTO_hash (&public_key, 555 GNUNET_CRYPTO_hash (&public_key,
556 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 556 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded),
557 &(id->hashPubKey)); 557 &(id->hashPubKey));
558 return private_key; 558 return private_key;
559} 559}
@@ -855,7 +855,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
855 char *config_filename; 855 char *config_filename;
856 char *libexec_binary; 856 char *libexec_binary;
857 char *emsg_; 857 char *emsg_;
858 struct GNUNET_CRYPTO_RsaPrivateKey *pk; 858 struct GNUNET_CRYPTO_EccPrivateKey *pk;
859 859
860 if (NULL != emsg) 860 if (NULL != emsg)
861 *emsg = NULL; 861 *emsg = NULL;
@@ -897,12 +897,13 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
897 return NULL; 897 return NULL;
898 } 898 }
899 if (NULL != pk) 899 if (NULL != pk)
900 GNUNET_CRYPTO_rsa_key_free (pk); 900 GNUNET_CRYPTO_ecc_key_free (pk);
901 GNUNET_assert (GNUNET_OK == 901 GNUNET_assert (GNUNET_OK ==
902 GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS", 902 GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS",
903 "SERVICEHOME", 903 "SERVICEHOME",
904 &service_home)); 904 &service_home));
905 GNUNET_snprintf (hostkey_filename, sizeof (hostkey_filename), "%s/.hostkey", 905 /* FIXME: might be better to evaluate actual configuration option here... */
906 GNUNET_snprintf (hostkey_filename, sizeof (hostkey_filename), "%s/private.ecc",
906 service_home); 907 service_home);
907 GNUNET_free (service_home); 908 GNUNET_free (service_home);
908 fd = GNUNET_DISK_file_open (hostkey_filename, 909 fd = GNUNET_DISK_file_open (hostkey_filename,
@@ -978,7 +979,7 @@ void
978GNUNET_TESTING_peer_get_identity (const struct GNUNET_TESTING_Peer *peer, 979GNUNET_TESTING_peer_get_identity (const struct GNUNET_TESTING_Peer *peer,
979 struct GNUNET_PeerIdentity *id) 980 struct GNUNET_PeerIdentity *id)
980{ 981{
981 GNUNET_CRYPTO_rsa_key_free (GNUNET_TESTING_hostkey_get (peer->system, 982 GNUNET_CRYPTO_ecc_key_free (GNUNET_TESTING_hostkey_get (peer->system,
982 peer->key_number, 983 peer->key_number,
983 id)); 984 id));
984} 985}