[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Add ExtendByEd25519ID consensus parameter/torrc option



commit 9e840e6c7d10a3dfa188d2186ce3c67ca1d698f5
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Fri Oct 28 11:15:21 2016 -0400

    Add ExtendByEd25519ID consensus parameter/torrc option
    
    I need to be able to turn on Ed25519 support in client generation
    of  extend cells so I can test it, but leave it off-by-default until
    enough clients support it for us to turn it on for a bunch at once.
    
    This is part of #15056 / prop#220.
---
 doc/tor.1.txt         |  7 +++++++
 src/or/circuitbuild.c |  4 ++--
 src/or/config.c       |  1 +
 src/or/onion.c        | 15 +++++++++++++++
 src/or/or.h           |  4 ++++
 5 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index cbc7ac1..1071168 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -717,6 +717,13 @@ GENERAL OPTIONS
     127.0.0.1 or 10.0.0.1.  This is mostly useful for debugging
     rate-limiting.  (Default: 0)
 
+[[ExtendByEd25519ID]] **ExtendByEd25519ID** **0**|**1**|**auto**::
+    If this option is set to 1, we always try to include a relay's Ed25519 ID
+    when telling the proceeding relay in a circuit to extend to it.
+    If this option is set to 0, we never include Ed25519 IDs when extending
+    circuits.  If the option is set to "default", we obey a
+    parameter in the consensus document. (Default: auto)
+
 CLIENT OPTIONS
 --------------
 
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index e833fcb..bdbbacd 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1043,8 +1043,8 @@ circuit_send_next_onion_skin(origin_circuit_t *circ)
     ec.orport_ipv4.port = hop->extend_info->port;
     tor_addr_make_unspec(&ec.orport_ipv6.addr);
     memcpy(ec.node_id, hop->extend_info->identity_digest, DIGEST_LEN);
-    /* 15056 Either here or in the onion.c encoding code, we should make an
-     * option to decide whether we declare the ED identity (if we know one) */
+    /* Set the ED25519 identity too -- it will only get included
+     * in the extend2 cell if we're configured to use it, though. */
     memcpy(&ec.ed_pubkey, &hop->extend_info->ed_identity,
            sizeof(ed25519_public_key_t));
 
diff --git a/src/or/config.c b/src/or/config.c
index 9553822..51c6290 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -305,6 +305,7 @@ static config_var_t option_vars_[] = {
   V(ExtORPortCookieAuthFile,     STRING,   NULL),
   V(ExtORPortCookieAuthFileGroupReadable, BOOL, "0"),
   V(ExtraInfoStatistics,         BOOL,     "1"),
+  V(ExtendByEd25519ID,           AUTOBOOL, "auto"),
   V(FallbackDir,                 LINELIST, NULL),
   V(UseDefaultFallbackDirs,      BOOL,     "1"),
 
diff --git a/src/or/onion.c b/src/or/onion.c
index f49707f..8e0896f 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -1170,6 +1170,21 @@ created_cell_format(cell_t *cell_out, const created_cell_t *cell_in)
   return 0;
 }
 
+/** Return true iff we are configured (by torrc or by the networkstatus
+ * parameters) to use Ed25519 identities in our Extend2 cells. */
+static int
+should_include_ed25519_id_extend_cells(const networkstatus_t *ns,
+                                       const or_options_t *options)
+{
+  if (options->ExtendByEd25519ID != -1)
+    return options->ExtendByEd25519ID; /* The user has an opinion. */
+
+  return (int) networkstatus_get_param(ns, "ExtendByEd25519ID",
+                                       0 /* default */,
+                                       0 /* min */,
+                                       1 /*max*/);
+}
+
 /** Format the EXTEND{,2} cell in <b>cell_in</b>, storing its relay payload in
  * <b>payload_out</b>, the number of bytes used in *<b>len_out</b>, and the
  * relay command in *<b>command_out</b>. The <b>payload_out</b> must have
diff --git a/src/or/or.h b/src/or/or.h
index 32c194a..0ebeda2 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -4571,6 +4571,10 @@ typedef struct {
 
   /** If 1, we skip all OOS checks. */
   int DisableOOSCheck;
+
+  /** Autobool: Should we include Ed25519 identities in extend2 cells?
+   * If -1, we should do whatever the consensus parameter says. */
+  int ExtendByEd25519ID;
 } or_options_t;
 
 /** Persistent state for an onion router, as saved to disk. */



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits