diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-11-10 12:24:07 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-12-08 16:47:58 -0500 |
commit | 7daf15217240acefaf2ef802b6d89e04f4e51cae (patch) | |
tree | 8be8786446066323340cf4ae4d7d194f164c14aa /src/or/circuitbuild.c | |
parent | 2cdd24ddd69a3cde2deae3eb69c24ae179d83834 (diff) | |
download | tor-7daf15217240acefaf2ef802b6d89e04f4e51cae.tar.gz tor-7daf15217240acefaf2ef802b6d89e04f4e51cae.zip |
Enforce Ed25519 identities (client-side)
This patch makes two absolutely critical changes:
- If an ed25519 identity is not as expected when creating a channel,
we call that channel unsuccessful and close it.
- When a client creating a channel or an extend cell for a circuit, we
only include the ed25519 identity if we believe that the node on
the other side supports ed25519 link authentication (from
#15055). Otherwise we will insist on nodes without the right
link protocol authenticating themselves.
- When deciding to extend to another relay, we only upgrade the
extend to extend by ed25519 ID when we know the ed25519 ID _and_
we know that the other side can authenticate.
This patch also tells directory servers, when probing nodes, to
try to check their ed25519 identities too (if they can authenticate
by ed25519 identity).
Also, handle the case where we connect by RSA Id, and learn the
ED25519 ID for the node in doing so.
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r-- | src/or/circuitbuild.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index bdbbacd3ec..bac68bba48 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1180,7 +1180,9 @@ circuit_extend(cell_t *cell, circuit_t *circ) if (ed25519_public_key_is_zero(&ec.ed_pubkey)) { const node_t *node = node_get_by_id((const char*)ec.node_id); const ed25519_public_key_t *node_ed_id = NULL; - if (node && (node_ed_id = node_get_ed25519_id(node))) { + if (node && + node_supports_ed25519_link_authentication(node) && + (node_ed_id = node_get_ed25519_id(node))) { memcpy(ec.ed_pubkey.pubkey, node_ed_id->pubkey, ED25519_PUBKEY_LEN); } } @@ -2450,7 +2452,18 @@ extend_info_from_node(const node_t *node, int for_direct_connect) return NULL; } - const ed25519_public_key_t *ed_pubkey = node_get_ed25519_id(node); + const ed25519_public_key_t *ed_pubkey = NULL; + + /* Don't send the ed25519 pubkey unless the target node actually supports + * authenticating with it. */ + if (node_supports_ed25519_link_authentication(node)) { + log_info(LD_CIRC, "Including Ed25519 ID for %s", node_describe(node)); + ed_pubkey = node_get_ed25519_id(node); + } else if (node_get_ed25519_id(node)) { + log_info(LD_CIRC, "Not including the ed25519 ID for %s, since it won't " + " be able to authenticate it.", + node_describe(node)); + } if (valid_addr && node->ri) return extend_info_new(node->ri->nickname, |