summaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-11 21:43:28 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-11 21:43:34 +0200
commit90ff9edfa9c5fcfa3a36d1653ff105e89b888e21 (patch)
tree780a2071f5072c8e8e044db741eb295c3f3ea2a7 /src/transport
parent3bcfe59f1ce533246bda271f00b3ee957cae304d (diff)
fixing #6149
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-communicator-tcp.c6
-rw-r--r--src/transport/gnunet-communicator-udp.c2
-rw-r--r--src/transport/gnunet-service-tng.c3
-rw-r--r--src/transport/gnunet-service-transport.c27
-rw-r--r--src/transport/gnunet-service-transport.h2
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c2
-rw-r--r--src/transport/gnunet-service-transport_validation.c2
7 files changed, 20 insertions, 24 deletions
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c
index 2786ba184..82ee309a5 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -1270,8 +1270,7 @@ inject_rekey (struct Queue *queue)
GNUNET_assert (0 == queue->pwrite_off);
memset (&rekey, 0, sizeof(rekey));
- GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_ecdhe_key_create2 (&queue->ephemeral));
+ GNUNET_CRYPTO_ecdhe_key_create (&queue->ephemeral);
rekey.header.type = ntohs (GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_REKEY);
rekey.header.size = ntohs (sizeof(rekey));
GNUNET_CRYPTO_ecdhe_key_get_public (&queue->ephemeral, &rekey.ephemeral);
@@ -1610,8 +1609,7 @@ start_initial_kx_out (struct Queue *queue)
{
struct GNUNET_CRYPTO_EcdhePublicKey epub;
- GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_ecdhe_key_create2 (&queue->ephemeral));
+ GNUNET_CRYPTO_ecdhe_key_create (&queue->ephemeral);
GNUNET_CRYPTO_ecdhe_key_get_public (&queue->ephemeral, &epub);
setup_out_cipher (queue);
transmit_kx (queue, &epub);
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c
index 1542a7702..e0b14f669 100644
--- a/src/transport/gnunet-communicator-udp.c
+++ b/src/transport/gnunet-communicator-udp.c
@@ -1918,7 +1918,7 @@ mq_send (struct GNUNET_MQ_Handle *mq,
struct SharedSecret *ss;
/* setup key material */
- GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecdhe_key_create2 (&epriv));
+ GNUNET_CRYPTO_ecdhe_key_create (&epriv);
ss = setup_shared_secret_enc (&epriv, receiver);
setup_cipher (&ss->master, 0, &out_cipher);
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index 75763fd9d..5f3178939 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -4130,8 +4130,7 @@ update_ephemeral (struct DistanceVector *dv)
dv->monotime = GNUNET_TIME_absolute_get_monotonic (GST_cfg);
dv->ephemeral_validity =
GNUNET_TIME_absolute_add (dv->monotime, EPHEMERAL_VALIDITY);
- GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_ecdhe_key_create2 (&dv->private_key));
+ GNUNET_CRYPTO_ecdhe_key_create (&dv->private_key);
GNUNET_CRYPTO_ecdhe_key_get_public (&dv->private_key, &dv->ephemeral_key);
ec.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_EPHEMERAL);
ec.purpose.size = htonl (sizeof(ec));
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 927a8753c..93fa031f4 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -384,7 +384,7 @@ struct GNUNET_PEERINFO_Handle *GST_peerinfo;
/**
* Our private key.
*/
-struct GNUNET_CRYPTO_EddsaPrivateKey *GST_my_private_key;
+struct GNUNET_CRYPTO_EddsaPrivateKey GST_my_private_key;
/**
* ATS scheduling handle.
@@ -2183,11 +2183,6 @@ shutdown_task (void *cls)
GNUNET_STATISTICS_destroy (GST_stats, GNUNET_NO);
GST_stats = NULL;
}
- if (NULL != GST_my_private_key)
- {
- GNUNET_free (GST_my_private_key);
- GST_my_private_key = NULL;
- }
}
@@ -2611,7 +2606,6 @@ run (void *cls,
struct GNUNET_SERVICE_Handle *service)
{
char *keyfile;
- struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
long long unsigned int max_fd_cfg;
int max_fd_rlimit;
int max_fd;
@@ -2638,17 +2632,22 @@ run (void *cls,
{
hello_expiration = GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION;
}
- pk = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile);
+ if (GNUNET_SYSERR ==
+ GNUNET_CRYPTO_eddsa_key_from_file (keyfile,
+ GNUNET_YES,
+ &GST_my_private_key))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to setup peer's private key\n");
+ GNUNET_SCHEDULER_shutdown ();
+ GNUNET_free (keyfile);
+ return;
+ }
GNUNET_free (keyfile);
- GNUNET_assert (NULL != pk);
- GST_my_private_key = pk;
-
GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg);
GST_peerinfo = GNUNET_PEERINFO_connect (GST_cfg);
- GNUNET_CRYPTO_eddsa_key_get_public (GST_my_private_key,
+ GNUNET_CRYPTO_eddsa_key_get_public (&GST_my_private_key,
&GST_my_identity.public_key);
- GNUNET_assert (NULL != GST_my_private_key);
-
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"My identity is `%s'\n",
GNUNET_i2s_full (&GST_my_identity));
diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h
index acb1de395..ea9e71e4b 100644
--- a/src/transport/gnunet-service-transport.h
+++ b/src/transport/gnunet-service-transport.h
@@ -56,7 +56,7 @@ extern struct GNUNET_PEERINFO_Handle *GST_peerinfo;
/**
* Our private key.
*/
-extern struct GNUNET_CRYPTO_EddsaPrivateKey *GST_my_private_key;
+extern struct GNUNET_CRYPTO_EddsaPrivateKey GST_my_private_key;
/**
* ATS handle.
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index ec64ca607..ca1b4d1da 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1045,7 +1045,7 @@ send_disconnect (struct NeighbourMapEntry *n)
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
disconnect_msg.public_key = GST_my_identity.public_key;
GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_eddsa_sign_ (GST_my_private_key,
+ GNUNET_CRYPTO_eddsa_sign_ (&GST_my_private_key,
&disconnect_msg.purpose,
&disconnect_msg.signature));
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index 610c45a21..e5d670889 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -1271,7 +1271,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
*sig_cache_exp = GNUNET_TIME_relative_to_absolute (PONG_SIGNATURE_LIFETIME);
pong->expiration = GNUNET_TIME_absolute_hton (*sig_cache_exp);
if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_sign_ (GST_my_private_key,
+ GNUNET_CRYPTO_eddsa_sign_ (&GST_my_private_key,
&pong->purpose,
sig_cache))
{