- intialize a new kx_ctx on receipt of a new ephemeral key if none exists
authorBart Polot <bart@net.in.tum.de>
Tue, 17 Jun 2014 12:13:20 +0000 (12:13 +0000)
committerBart Polot <bart@net.in.tum.de>
Tue, 17 Jun 2014 12:13:20 +0000 (12:13 +0000)
src/cadet/gnunet-service-cadet_tunnel.c

index 6c4d949e3cf9e6f7c2f0661328cd91174daa2b55..bcb7eb873191892db20cd7f5a95d102b78f8504d 100644 (file)
@@ -1668,6 +1668,15 @@ handle_ephemeral (struct CadetTunnel *t,
     GNUNET_break_op (0);
     return;
   }
+  if (NULL == t->kx_ctx)
+  {
+    t->kx_ctx = GNUNET_new (struct CadetTunnelKXCtx);
+    t->kx_ctx->rekey_start_time = GNUNET_TIME_absolute_get ();
+    t->kx_ctx->e_key_old = t->e_key;
+    t->kx_ctx->d_key_old = t->d_key;
+    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 (CADET_TUNNEL3_KEY_SENT == t->estate)