- add send kx for axolotl
authorBart Polot <bart@net.in.tum.de>
Mon, 27 Apr 2015 19:14:35 +0000 (19:14 +0000)
committerBart Polot <bart@net.in.tum.de>
Mon, 27 Apr 2015 19:14:35 +0000 (19:14 +0000)
src/cadet/gnunet-service-cadet_tunnel.c
src/cadet/gnunet-service-cadet_tunnel.h

index 2d2ba7366d19b1e33f0e30daebd4129f20e4318f..c2e3a92c7d39a2b99bf88c275df35fa091b71638 100644 (file)
@@ -2325,13 +2325,6 @@ handle_pong (struct CadetTunnel *t, const struct GNUNET_CADET_KX_Pong *msg)
 }
 
 
-static void
-send_ax_kx ()
-{
-  //FIXME
-}
-
-
 /**
  * WARNING! DANGER! Do not use this if you don't know what you are doing!
  * Ask Christian Grothoff, Werner Koch, Dan Bernstein and $GOD!
@@ -3643,6 +3636,33 @@ GCT_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
   return send_prebuilt_message (message, t, c, force, cont, cont_cls, NULL);
 }
 
+
+/**
+ * Send an Axolotl KX message.
+ *
+ * @param t Tunnel on which to send it.
+ */
+void
+GCT_send_ax_kx (struct CadetTunnel *t)
+{
+  struct GNUNET_CADET_AX_KX msg;
+  struct CadetConnection *c;
+
+  LOG (GNUNET_ERROR_TYPE_INFO, "===> AX_KX for %s\n", GCT_2s (t));
+
+  msg.header.size = sizeof (msg);
+  msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_AX_KX);
+  GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->kx_0, &msg.ephemeral_key);
+  GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->DHRs, &msg.ratchet_key);
+
+  c = tunnel_get_connection (t);
+  /* TODO: save queue */
+  GCC_send_prebuilt_message (&msg.header, GNUNET_MESSAGE_TYPE_CADET_AX_KX, 0,
+                             c, GCC_is_origin (c, GNUNET_YES), GNUNET_NO,
+                             NULL, NULL);
+}
+
+
 /**
  * Sends an already built and encrypted message on a tunnel, choosing the best
  * connection. Useful for re-queueing messages queued on a destroyed connection.
index aef965181c045e30be0a7d71c6bde6ca728791b2..4bc7ca7da46f48fab99f309557b3735030f6ade1 100644 (file)
@@ -442,6 +442,14 @@ GCT_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
                            struct CadetTunnel *t, struct CadetConnection *c,
                            int force, GCT_sent cont, void *cont_cls);
 
+/**
+ * Send an Axolotl KX message.
+ *
+ * @param t Tunnel on which to send it.
+ */
+void
+GCT_send_ax_kx (struct CadetTunnel *t);
+
 /**
  * Sends an already built and encrypted message on a tunnel, choosing the best
  * connection. Useful for re-queueing messages queued on a destroyed connection.