gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r34577 - gnunet/src/cadet
Date: Mon, 15 Dec 2014 08:17:36 +0100

Author: bartpolot
Date: 2014-12-15 08:17:36 +0100 (Mon, 15 Dec 2014)
New Revision: 34577

Modified:
   gnunet/src/cadet/gnunet-service-cadet_tunnel.c
Log:
Fix conservation of old keys in case of simultaneous KX:
 when creating a new kx_ctx, copy old keys based on tunnel estate, not 
finish_task

Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2014-12-15 07:17:35 UTC 
(rev 34576)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2014-12-15 07:17:36 UTC 
(rev 34577)
@@ -865,8 +865,8 @@
 /**
  * Create a new Key eXchange context for the tunnel.
  *
- * If context exists, just cancels the finish_task, does not create new nonce.
- * Otherwise copies the keys, timestamps the KX and creates a new nonce.
+ * If the old keys were verified, keep them for old traffic. Create a new KX
+ * timestamp and a new nonce.
  *
  * @param t Tunnel for which to create the KX ctx.
  */
@@ -883,14 +883,19 @@
       GNUNET_SCHEDULER_cancel (t->kx_ctx->finish_task);
       t->kx_ctx->finish_task = GNUNET_SCHEDULER_NO_TASK;
     }
-    return;
   }
+  else
+  {
+    t->kx_ctx = GNUNET_new (struct CadetTunnelKXCtx);
+  }
 
-  t->kx_ctx = GNUNET_new (struct CadetTunnelKXCtx);
   t->kx_ctx->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
                                                    UINT32_MAX);
-  t->kx_ctx->d_key_old = t->d_key;
-  t->kx_ctx->e_key_old = t->e_key;
+  if (CADET_TUNNEL_KEY_OK == t->estate)
+  {
+    t->kx_ctx->d_key_old = t->d_key;
+    t->kx_ctx->e_key_old = t->e_key;
+  }
   t->kx_ctx->rekey_start_time = GNUNET_TIME_absolute_get ();
 }
 




reply via email to

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