summaryrefslogtreecommitdiff
path: root/src/or/nodelist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-01-10 09:38:38 -0500
committerNick Mathewson <nickm@torproject.org>2018-01-10 09:38:38 -0500
commit4715d818092e02f2c530b172b351d9a2d11df735 (patch)
treebcffd533089ecfb8ae1fd59a705a72a663660e71 /src/or/nodelist.c
parent2d2a0c4116cdefe1c001a047d09b38bdacc79b3c (diff)
parente7029621db85d5f2f26414531e1b9312677cc00f (diff)
downloadtor-4715d818092e02f2c530b172b351d9a2d11df735.tar.gz
tor-4715d818092e02f2c530b172b351d9a2d11df735.zip
Merge remote-tracking branch 'teor/Bug-23966'
Diffstat (limited to 'src/or/nodelist.c')
-rw-r--r--src/or/nodelist.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 4eafe6d7a7..95fef43020 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -1637,24 +1637,18 @@ microdesc_has_curve25519_onion_key(const microdesc_t *md)
int
node_has_curve25519_onion_key(const node_t *node)
{
- if (!node)
- return 0;
-
- if (node->ri)
- return routerinfo_has_curve25519_onion_key(node->ri);
- else if (node->md)
- return microdesc_has_curve25519_onion_key(node->md);
- else
- return 0;
+ return(node_get_curve25519_onion_key(node)!=NULL);
}
/** Return the curve25519 key of <b>node</b>, or NULL if none. */
const curve25519_public_key_t *
node_get_curve25519_onion_key(const node_t *node)
{
- if (node->ri)
+ if (!node)
+ return NULL;
+ if (routerinfo_has_curve25519_onion_key(node->ri))
return node->ri->onion_curve25519_pkey;
- else if (node->md)
+ else if (microdesc_has_curve25519_onion_key(node->md))
return node->md->onion_curve25519_pkey;
else
return NULL;