gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 02/02: add configurable rekey interval


From: gnunet
Subject: [gnunet] 02/02: add configurable rekey interval
Date: Tue, 31 Dec 2019 04:58:47 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit a91090c6625ba08b6b1ae040a48823bdb0e00609
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Tue Dec 31 12:55:22 2019 +0900

    add configurable rekey interval
---
 src/transport/gnunet-communicator-tcp.c | 15 +++++++++++++--
 1 file 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 @@
 /**
  * How often do we rekey based on time (at least)
  */
-#define REKEY_TIME_INTERVAL GNUNET_TIME_UNIT_DAYS
+#define DEFAULT_REKEY_INTERVAL GNUNET_TIME_UNIT_DAYS
 
 /**
  * How long do we wait until we must have received the initial KX?
@@ -521,6 +521,11 @@ static struct GNUNET_NETWORK_Handle *listen_sock;
  */
 static struct GNUNET_PeerIdentity my_identity;
 
+/**
+ * The rekey interval
+ */
+static struct GNUNET_TIME_Relative rekey_interval;
+
 /**
  * Our private key.
  */
@@ -1246,7 +1251,7 @@ setup_out_cipher (struct Queue *queue)
   /* we don't need the private key anymore, drop it! */
   memset (&queue->ephemeral, 0, sizeof(queue->ephemeral));
   setup_cipher (&dh, &queue->target, &queue->out_cipher, &queue->out_hmac);
-  queue->rekey_time = GNUNET_TIME_relative_to_absolute (REKEY_TIME_INTERVAL);
+  queue->rekey_time = GNUNET_TIME_relative_to_absolute (rekey_interval);
   queue->rekey_left_bytes =
     GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, REKEY_MAX_BYTES);
 }
@@ -2148,6 +2153,12 @@ run (void *cls,
                                              "MAX_QUEUE_LENGTH",
                                              &max_queue_length))
     max_queue_length = DEFAULT_MAX_QUEUE_LENGTH;
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_time (cfg,
+                                             COMMUNICATOR_CONFIG_SECTION,
+                                             "REKEY_INTERVAL",
+                                             &rekey_interval))
+    rekey_interval = DEFAULT_REKEY_INTERVAL;
 
   in = tcp_address_to_sockaddr (bindto, &in_len);
   if (NULL == in)

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]