gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r34049 - gnunet/src/cadet


From: gnunet
Subject: [GNUnet-SVN] r34049 - gnunet/src/cadet
Date: Fri, 25 Jul 2014 05:30:02 +0200

Author: bartpolot
Date: 2014-07-25 05:30:02 +0200 (Fri, 25 Jul 2014)
New Revision: 34049

Modified:
   gnunet/src/cadet/gnunet-service-cadet_tunnel.c
Log:
- if an "old_key" is not valid (for instance, at tunnel establishment), clear 
the context ASAP

Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2014-07-25 03:30:00 UTC 
(rev 34048)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2014-07-25 03:30:02 UTC 
(rev 34049)
@@ -411,6 +411,28 @@
 
 
 /**
+ * Check if a key is invalid (NULL pointer or all 0)
+ *
+ * @param key Key to check.
+ *
+ * @return #GNUNET_YES if key is null, #GNUNET_NO if exists and is not 0.
+ */
+static int
+is_key_null (struct GNUNET_CRYPTO_SymmetricSessionKey *key)
+{
+  struct GNUNET_CRYPTO_SymmetricSessionKey null_key;
+
+  if (NULL == key)
+    return GNUNET_YES;
+
+  memset (&null_key, 0, sizeof (null_key));
+  if (0 == memcmp (key, &null_key, sizeof (null_key)))
+    return GNUNET_YES;
+  return GNUNET_NO;
+}
+
+
+/**
  * Ephemeral key message purpose size.
  *
  * @return Size of the part of the ephemeral key message that must be signed.
@@ -900,6 +922,12 @@
   if (NULL == t->kx_ctx || GNUNET_SCHEDULER_NO_TASK != t->kx_ctx->finish_task)
     return;
 
+  if (is_key_null (&t->kx_ctx->e_key_old))
+  {
+    t->kx_ctx->finish_task = GNUNET_SCHEDULER_add_now (finish_kx, t);
+    return;
+  }
+
   delay = GNUNET_TIME_relative_divide (rekey_period, 4);
   delay = GNUNET_TIME_relative_min (delay, GNUNET_TIME_UNIT_MINUTES);
 




reply via email to

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