Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Goulet
Tor
Commits
93e7661f
Commit
93e7661f
authored
Oct 15, 2020
by
Nick Mathewson
🎨
Browse files
Add a function to get an ed25519 ID from a routerinfo.
parent
bb249a22
Changes
2
Show whitespace changes
Inline
Side-by-side
src/feature/nodelist/routerinfo.c
View file @
93e7661f
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include
"feature/nodelist/nodelist.h"
#include
"feature/nodelist/nodelist.h"
#include
"feature/nodelist/routerinfo.h"
#include
"feature/nodelist/routerinfo.h"
#include
"feature/nodelist/torcert.h"
#include
"feature/nodelist/node_st.h"
#include
"feature/nodelist/node_st.h"
#include
"feature/nodelist/routerinfo_st.h"
#include
"feature/nodelist/routerinfo_st.h"
...
@@ -75,6 +76,21 @@ router_get_all_orports(const routerinfo_t *ri)
...
@@ -75,6 +76,21 @@ router_get_all_orports(const routerinfo_t *ri)
return
node_get_all_orports
(
&
fake_node
);
return
node_get_all_orports
(
&
fake_node
);
}
}
/** Return the Ed25519 identity key for this routerinfo, or NULL if it
* doesn't have one. */
const
ed25519_public_key_t
*
routerinfo_get_ed25519_id
(
const
routerinfo_t
*
ri
)
{
if
(
BUG
(
!
ri
))
return
NULL
;
const
tor_cert_t
*
cert
=
ri
->
cache_info
.
signing_key_cert
;
if
(
cert
&&
!
ed25519_public_key_is_zero
(
&
cert
->
signing_key
))
return
&
cert
->
signing_key
;
else
return
NULL
;
}
/** Given a router purpose, convert it to a string. Don't call this on
/** Given a router purpose, convert it to a string. Don't call this on
* ROUTER_PURPOSE_UNKNOWN: The whole point of that value is that we don't
* ROUTER_PURPOSE_UNKNOWN: The whole point of that value is that we don't
* know its string representation. */
* know its string representation. */
...
...
src/feature/nodelist/routerinfo.h
View file @
93e7661f
...
@@ -18,6 +18,10 @@ int router_get_orport(const routerinfo_t *router,
...
@@ -18,6 +18,10 @@ int router_get_orport(const routerinfo_t *router,
int
router_has_orport
(
const
routerinfo_t
*
router
,
int
router_has_orport
(
const
routerinfo_t
*
router
,
const
tor_addr_port_t
*
orport
);
const
tor_addr_port_t
*
orport
);
struct
ed25519_public_key_t
;
const
struct
ed25519_public_key_t
*
routerinfo_get_ed25519_id
(
const
routerinfo_t
*
ri
);
smartlist_t
*
router_get_all_orports
(
const
routerinfo_t
*
ri
);
smartlist_t
*
router_get_all_orports
(
const
routerinfo_t
*
ri
);
const
char
*
router_purpose_to_string
(
uint8_t
p
);
const
char
*
router_purpose_to_string
(
uint8_t
p
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment