aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-12-31 12:55:22 +0900
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-12-31 12:55:22 +0900
commita91090c6625ba08b6b1ae040a48823bdb0e00609 (patch)
tree9af3fc16033ae1faf3b3708b70f4a6a02429cae0 /src/transport
parent9aa5f80626ef47b1c5f027308abc5dcef0adbb89 (diff)
downloadgnunet-a91090c6625ba08b6b1ae040a48823bdb0e00609.tar.gz
gnunet-a91090c6625ba08b6b1ae040a48823bdb0e00609.zip
add configurable rekey interval
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-communicator-tcp.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c
index 63e980204..045a57d0f 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -68,7 +68,7 @@
68/** 68/**
69 * How often do we rekey based on time (at least) 69 * How often do we rekey based on time (at least)
70 */ 70 */
71#define REKEY_TIME_INTERVAL GNUNET_TIME_UNIT_DAYS 71#define DEFAULT_REKEY_INTERVAL GNUNET_TIME_UNIT_DAYS
72 72
73/** 73/**
74 * How long do we wait until we must have received the initial KX? 74 * How long do we wait until we must have received the initial KX?
@@ -522,6 +522,11 @@ static struct GNUNET_NETWORK_Handle *listen_sock;
522static struct GNUNET_PeerIdentity my_identity; 522static struct GNUNET_PeerIdentity my_identity;
523 523
524/** 524/**
525 * The rekey interval
526 */
527static struct GNUNET_TIME_Relative rekey_interval;
528
529/**
525 * Our private key. 530 * Our private key.
526 */ 531 */
527static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; 532static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
@@ -1246,7 +1251,7 @@ setup_out_cipher (struct Queue *queue)
1246 /* we don't need the private key anymore, drop it! */ 1251 /* we don't need the private key anymore, drop it! */
1247 memset (&queue->ephemeral, 0, sizeof(queue->ephemeral)); 1252 memset (&queue->ephemeral, 0, sizeof(queue->ephemeral));
1248 setup_cipher (&dh, &queue->target, &queue->out_cipher, &queue->out_hmac); 1253 setup_cipher (&dh, &queue->target, &queue->out_cipher, &queue->out_hmac);
1249 queue->rekey_time = GNUNET_TIME_relative_to_absolute (REKEY_TIME_INTERVAL); 1254 queue->rekey_time = GNUNET_TIME_relative_to_absolute (rekey_interval);
1250 queue->rekey_left_bytes = 1255 queue->rekey_left_bytes =
1251 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, REKEY_MAX_BYTES); 1256 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, REKEY_MAX_BYTES);
1252} 1257}
@@ -2148,6 +2153,12 @@ run (void *cls,
2148 "MAX_QUEUE_LENGTH", 2153 "MAX_QUEUE_LENGTH",
2149 &max_queue_length)) 2154 &max_queue_length))
2150 max_queue_length = DEFAULT_MAX_QUEUE_LENGTH; 2155 max_queue_length = DEFAULT_MAX_QUEUE_LENGTH;
2156 if (GNUNET_OK !=
2157 GNUNET_CONFIGURATION_get_value_time (cfg,
2158 COMMUNICATOR_CONFIG_SECTION,
2159 "REKEY_INTERVAL",
2160 &rekey_interval))
2161 rekey_interval = DEFAULT_REKEY_INTERVAL;
2151 2162
2152 in = tcp_address_to_sockaddr (bindto, &in_len); 2163 in = tcp_address_to_sockaddr (bindto, &in_len);
2153 if (NULL == in) 2164 if (NULL == in)