CADET_CONNECTION_READY
};
+struct CadetConnectionCreatePS
+{
+
+ /**
+ * Purpose is #GNUNET_SIGNATURE_PURPOSE_CADET_CONNECTION_INITIATOR
+ */
+ struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+
+ /**
+ * Time at the initiator when generating the signature.
+ *
+ * Note that the receiver MUST IGNORE the absolute time, and only interpret
+ * the value as a mononic time and reject "older" values than the last one
+ * observed. This is necessary as we do not want to require synchronized
+ * clocks and may not have a bidirectional communication channel.
+ *
+ * Even with this, there is no real guarantee against replay achieved here,
+ * unless the latest timestamp is persisted. Persistence should be
+ * provided via PEERSTORE if possible.
+ */
+ struct GNUNET_TIME_AbsoluteNBO monotonic_time;
+
+}
/**
* Low-level connection to a destination.
*/
static struct GNUNET_SCHEDULER_Task *timeout_task;
+static int
+check_monotime_sig (struc GNUNET_PeerIdentity *pid,
+ const struct GNUNET_CADET_ConnectionCreateMessage *msg)
+{
+
+ struct CCCreatePS cp = { .purpose.purpose = htonl (
+ GNUNET_SIGNATURE_PURPOSE_CADET_CONNECTION_INITIATOR),
+ .purpose.size = htonl (sizeof(cp)),
+ .monotonic_time = sender_monotonic_time};
+
+ if (
+ GNUNET_OK !=
+ GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_CADET_CONNECTION_INITIATOR,
+ &cp.purpose,
+ msg->monotime_sig,
+ &pid->public_key))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
+ return GNUNET_OK;
+}
/**
* Get the route corresponding to a hash.
t = GCP_get_tunnel (sender, GNUNET_YES);
// Check for CADET state in case the other side has lost the tunnel (xrs,t3ss)
- if ((NULL != msg->monotime) && check_monotime_sig(msg)
+ if ((NULL != msg->monotime) && GNUNET_OK == check_monotime_sig(origin->pid, &msg)
(CADET_TUNNEL_KEY_OK == GCT_get_estate(t)))
{
GCT_change_estate (t, CADET_TUNNEL_KEY_UNINITIALIZED);
*/
#define GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DV_INITIATOR 37
+/**
+ * Signature by a peer that like to create a connection.
+ */
+#define GNUNET_SIGNATURE_PURPOSE_CADET_CONNECTION_INITIATOR 38
#if 0 /* keep Emacsens' auto-indent happy */
{