aboutsummaryrefslogtreecommitdiff
path: root/src/or/nodelist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-11-10 12:24:07 -0500
committerNick Mathewson <nickm@torproject.org>2016-12-08 16:47:58 -0500
commit7daf15217240acefaf2ef802b6d89e04f4e51cae (patch)
tree8be8786446066323340cf4ae4d7d194f164c14aa /src/or/nodelist.c
parent2cdd24ddd69a3cde2deae3eb69c24ae179d83834 (diff)
downloadtor-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/nodelist.c')
-rw-r--r--src/or/nodelist.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 9486224379..1f993e4595 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -49,6 +49,7 @@
#include "networkstatus.h"
#include "nodelist.h"
#include "policies.h"
+#include "protover.h"
#include "rendservice.h"
#include "router.h"
#include "routerlist.h"
@@ -670,6 +671,30 @@ node_get_ed25519_id(const node_t *node)
return NULL;
}
+
+/** Return true iff <b>node</b> supports authenticating itself
+ * by ed25519 ID during the link handshake in a way that we can understand
+ * when we probe it. */
+int
+node_supports_ed25519_link_authentication(const node_t *node)
+{
+ /* XXXX Oh hm. What if some day in the future there are link handshake
+ * versions that aren't 3 but which are ed25519 */
+ if (! node_get_ed25519_id(node))
+ return 0;
+ if (node->ri) {
+ const char *protos = node->ri->protocol_list;
+ if (protos == NULL)
+ return 0;
+ return protocol_list_supports_protocol(protos, PRT_LINKAUTH, 3);
+ }
+ if (node->rs) {
+ return node->rs->supports_ed25519_link_handshake;
+ }
+ tor_assert_nonfatal_unreached_once();
+ return 0;
+}
+
/** Return the RSA ID key's SHA1 digest for the provided node. */
const uint8_t *
node_get_rsa_id_digest(const node_t *node)