- only create keys on new ephemeral info
authorBart Polot <bart@net.in.tum.de>
Tue, 17 Jun 2014 12:13:32 +0000 (12:13 +0000)
committerBart Polot <bart@net.in.tum.de>
Tue, 17 Jun 2014 12:13:32 +0000 (12:13 +0000)
src/cadet/gnunet-service-cadet_tunnel.c

index adc3eb342a9e99da2c7113367e8e6b3a8f6cbbd3..227c29fd6c488706e69de2620cb2d91170c3e5ce 100644 (file)
@@ -400,7 +400,7 @@ is_ready (struct CadetTunnel *t)
   int ready;
 
   GCT_debug (t, GNUNET_ERROR_TYPE_DEBUG);
-  ready = (CADET_TUNNEL3_READY == t->cstate && CADET_TUNNEL3_KEY_OK == t->estate);
+  ready = CADET_TUNNEL3_READY == t->cstate && CADET_TUNNEL3_KEY_OK == t->estate;
   ready = ready || GCT_is_loopback (t);
   return ready;
 }
@@ -1704,8 +1704,12 @@ handle_ephemeral (struct CadetTunnel *t,
     t->kx_ctx->challenge =
         GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
   }
-  t->peers_ephemeral_key = msg->ephemeral_key;
-  create_keys (t);
+  if (0 != memcmp (&t->peers_ephemeral_key, &msg->ephemeral_key,
+                   sizeof (msg->ephemeral_key)))
+  {
+    t->peers_ephemeral_key = msg->ephemeral_key;
+    create_keys (t);
+  }
   if (CADET_TUNNEL3_KEY_SENT == t->estate)
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  our key was sent, sending ping\n");