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

[tor-commits] [tor/master] Introduce node_get_curve25519_onion_key()



commit 0ee50a414cb970a4ce192075c6414dbfbdb0b0db
Author: Neel Chauhan <neel@xxxxxxxxx>
Date:   Wed Nov 8 18:33:30 2017 -0500

    Introduce node_get_curve25519_onion_key()
---
 src/or/nodelist.c | 12 ++++++++++++
 src/or/nodelist.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index f2e979be8..bcd5fa6b8 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -1633,6 +1633,18 @@ node_has_curve25519_onion_key(const node_t *node)
     return 0;
 }
 
+/** Return the curve25519 key of <b>node</b>, or NULL if none. */
+curve25519_public_key_t *
+node_get_curve25519_onion_key(const node_t *node)
+{
+  if (node->ri)
+    return node->ri->onion_curve25519_pkey;
+  else if (node->md)
+    return node->md->onion_curve25519_pkey;
+  else
+    return NULL;
+}
+
 /** Refresh the country code of <b>ri</b>.  This function MUST be called on
  * each router when the GeoIP database is reloaded, and on all new routers. */
 void
diff --git a/src/or/nodelist.h b/src/or/nodelist.h
index 754990ac8..0ff5ecca0 100644
--- a/src/or/nodelist.h
+++ b/src/or/nodelist.h
@@ -85,6 +85,7 @@ int node_get_prim_dirport(const node_t *node, tor_addr_port_t *ap_out);
 void node_get_pref_dirport(const node_t *node, tor_addr_port_t *ap_out);
 void node_get_pref_ipv6_dirport(const node_t *node, tor_addr_port_t *ap_out);
 int node_has_curve25519_onion_key(const node_t *node);
+curve25519_public_key_t *node_get_curve25519_onion_key(const node_t *node);
 
 MOCK_DECL(smartlist_t *, nodelist_get_list, (void));
 



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