struct GNUNET_MessageHeader header;
/**
- * For alignment.
+ * Connection options in network byte order.
+ * #GNUNET_CADET_OPTION_DEFAULT for buffered;
+ * #GNUNET_CADET_OPTION_NOBUFFER for unbuffered.
+ * Other flags are ignored and should not be set at this level.
*/
- uint32_t reserved GNUNET_PACKED;
+ uint32_t options GNUNET_PACKED;
/**
* ID of the connection
/**
* Message for ack'ing a connection
*/
-struct GNUNET_CADET_ConnectionCreateMessageAckMessage
+struct GNUNET_CADET_ConnectionCreateAckMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK
struct GNUNET_CADET_TunnelKeyExchangeMessage
{
/**
- * Type: #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX.
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX or
+ * #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX_AUTH as part
+ * of `struct GNUNET_CADET_TunnelKeyExchangeAuthMessage`.
*/
struct GNUNET_MessageHeader header;
*/
struct GNUNET_CRYPTO_EcdhePublicKey ratchet_key;
-#ifdef NEW_CADET
+};
+
+
+/**
+ * Message for a Key eXchange for a tunnel, with authentication.
+ * Used as a response to the initial KX as well as for rekeying.
+ */
+struct GNUNET_CADET_TunnelKeyExchangeAuthMessage
+{
+
/**
- * Proof that sender could compute the 3-DH, in lieu of a signature.
+ * Message header with key material.
*/
- struct GNUNET_HashCode triple_dh_proof;
-#endif
+ struct GNUNET_CADET_TunnelKeyExchangeMessage kx;
+
+ /**
+ * KDF-proof that sender could compute the 3-DH, used in lieu of a
+ * signature or payload data.
+ */
+ struct GNUNET_HashCode auth;
+
+};
+
+
+/**
+ * Encrypted axolotl header with numbers that identify which
+ * keys in which ratchet are to be used to decrypt the body.
+ */
+struct GNUNET_CADET_AxHeader
+{
+
+ /**
+ * Number of messages sent with the current ratchet key.
+ */
+ uint32_t Ns GNUNET_PACKED;
+
+ /**
+ * Number of messages sent with the previous ratchet key.
+ */
+ uint32_t PNs GNUNET_PACKED;
+
+ /**
+ * Current ratchet key.
+ */
+ struct GNUNET_CRYPTO_EcdhePublicKey DHRs;
+
};
/**
- * Axolotl tunnel message.
+ * Axolotl-encrypted tunnel message with application payload.
*/
struct GNUNET_CADET_TunnelEncryptedMessage
{
*/
struct GNUNET_MessageHeader header;
+#if NEW_CADET
+ /**
+ * Reserved, for alignment.
+ */
+ uint32_t reserved GNUNET_PACKED;
+#else
/**
- * ID of the packet (hop by hop).
+ * Maximum packet ID authorized.
*/
struct CadetEncryptedMessageIdentifier cemi;
+#endif
/**
* ID of the connection.
*/
struct GNUNET_ShortHashCode hmac;
- /**************** AX_HEADER start ****************/
-
+ #if NEW_CADET
+ /**
+ * Axolotl-header that specifies which keys to use in which ratchet
+ * to decrypt the body that follows.
+ */
+ struct GNUNET_CADET_AxHeader ax_header;
+#else
/**
* Number of messages sent with the current ratchet key.
*/
* Current ratchet key.
*/
struct GNUNET_CRYPTO_EcdhePublicKey DHRs;
-
- /**************** AX_HEADER end ****************/
-
+#endif
/**
* Encrypted content follows.
*/
};
+#ifndef NEW_CADET
+
/**
* Message to query a peer about its Flow Control status regarding a tunnel.
*
struct GNUNET_CADET_ConnectionTunnelIdentifier cid;
};
+#endif
+
/******************************************************************************/
/******************************* CHANNEL ***********************************/
/**
* ID of the channel within the tunnel.
*/
- struct GNUNET_CADET_ChannelTunnelNumber chid;
+ struct GNUNET_CADET_ChannelTunnelNumber ctn;
};
/**
- * Message to manage a Channel (CHANNEL_CREATE_ACK, CHANNEL_DESTROY).
+ * Message to manage a Channel
+ * (#GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK,
+ * #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY).
*/
struct GNUNET_CADET_ChannelManageMessage
{
/**
- * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK or
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK or
* #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY
*/
struct GNUNET_MessageHeader header;
/**
* ID of the channel
*/
- struct GNUNET_CADET_ChannelTunnelNumber chid;
+ struct GNUNET_CADET_ChannelTunnelNumber ctn;
};
/**
* ID of the channel
*/
- struct GNUNET_CADET_ChannelTunnelNumber chid;
+ struct GNUNET_CADET_ChannelTunnelNumber ctn;
/**
* Payload follows
/**
* ID of the channel
*/
- struct GNUNET_CADET_ChannelTunnelNumber chid;
+ struct GNUNET_CADET_ChannelTunnelNumber ctn;
/**
- * Bitfield of already-received newer messages
+ * Bitfield of already-received messages past @e mid.
* pid + 1 @ LSB
* pid + 64 @ MSB
*/
struct GNUNET_CADET_ChannelAppDataMessage
{
/**
- * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST,
- * #GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA.
*/
struct GNUNET_MessageHeader header;
/**
* ID of the channel
*/
- struct GNUNET_CADET_ChannelTunnelNumber chid;
+ struct GNUNET_CADET_ChannelTunnelNumber ctn;
/**
* Payload follows
/**
* ID of the channel
*/
- struct GNUNET_CADET_ChannelTunnelNumber chid;
+ struct GNUNET_CADET_ChannelTunnelNumber ctn;
/**
- * Bitfield of already-received messages past @e mid.
- * pid + 1 @ LSB
- * pid + 64 @ MSB
+ * Bitfield of already-received newer messages. Note that bit 0
+ * corresponds to @e mid + 1.
+ *
+ * pid + 0 @ LSB
+ * pid + 63 @ MSB
*/
uint64_t futures GNUNET_PACKED;
/**
- * Last message ID received.
+ * Next message ID expected.
*/
struct ChannelMessageIdentifier mid;
};