diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-10-15 10:22:49 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-10-15 10:29:01 -0400 |
commit | 5718f38c85a4c1e44465488d458980cac6226a1d (patch) | |
tree | 4efdd2ee0cb0d8cd2f31a95289bd6afabe3b0d10 /src/test/test_nodelist.c | |
parent | 93e7661feff77c642d7c6f38023e8ab3de0d0269 (diff) | |
download | tor-5718f38c85a4c1e44465488d458980cac6226a1d.tar.gz tor-5718f38c85a4c1e44465488d458980cac6226a1d.zip |
Add ed25519 identities to relay descriptions.
(Or at least, to all those relay descriptions that derive from
format_node_description()).
Closes #22668.
Diffstat (limited to 'src/test/test_nodelist.c')
-rw-r--r-- | src/test/test_nodelist.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/test/test_nodelist.c b/src/test/test_nodelist.c index c165eebb63..96fb5a65ad 100644 --- a/src/test/test_nodelist.c +++ b/src/test/test_nodelist.c @@ -11,6 +11,7 @@ #include "core/or/or.h" #include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_format.h" #include "feature/nodelist/describe.h" #include "feature/nodelist/networkstatus.h" #include "feature/nodelist/nodefamily.h" @@ -657,6 +658,7 @@ test_nodelist_format_node_description(void *arg) tor_addr_t mock_null_ip; tor_addr_t mock_ipv4; tor_addr_t mock_ipv6; + ed25519_public_key_t ed_id; char ndesc[NODE_DESC_BUF_LEN]; const char *rv = NULL; @@ -685,6 +687,7 @@ test_nodelist_format_node_description(void *arg) mock_digest, NULL, NULL, + NULL, NULL); tt_ptr_op(rv, OP_EQ, ndesc); tt_str_op(ndesc, OP_EQ, "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); @@ -692,6 +695,7 @@ test_nodelist_format_node_description(void *arg) /* format node description should use ~ because named is deprecated */ rv = format_node_description(ndesc, mock_digest, + NULL, mock_nickname, NULL, NULL); @@ -702,6 +706,7 @@ test_nodelist_format_node_description(void *arg) /* Try a null IP address, rather than NULL */ rv = format_node_description(ndesc, mock_digest, + NULL, mock_nickname, NULL, &mock_null_ip); @@ -713,6 +718,7 @@ test_nodelist_format_node_description(void *arg) rv = format_node_description(ndesc, mock_digest, NULL, + NULL, &mock_ipv4, NULL); tt_ptr_op(rv, OP_EQ, ndesc); @@ -721,6 +727,7 @@ test_nodelist_format_node_description(void *arg) rv = format_node_description(ndesc, mock_digest, + NULL, mock_nickname, NULL, &mock_ipv6); @@ -731,6 +738,7 @@ test_nodelist_format_node_description(void *arg) rv = format_node_description(ndesc, mock_digest, + NULL, mock_nickname, &mock_ipv4, &mock_ipv6); @@ -739,11 +747,26 @@ test_nodelist_format_node_description(void *arg) "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA~TestOR7890123456789 at " "111.222.233.244 and [1111:2222:3333:4444:5555:6666:7777:8888]"); + /* Try some ed25519 keys. */ + int n = ed25519_public_from_base64(&ed_id, + "+wBP6WVZzqKK+eTdwU7Hhb80xEm40FSZDBMNozTJpDE"); + tt_int_op(n,OP_EQ,0); + rv = format_node_description(ndesc, + mock_digest, + &ed_id, + mock_nickname, + &mock_ipv4, + &mock_ipv6); + tt_str_op(ndesc, OP_EQ, + "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA~TestOR7890123456789 " + "[+wBP6WVZzqKK+eTdwU7Hhb80xEm40FSZDBMNozTJpDE] at " + "111.222.233.244 and [1111:2222:3333:4444:5555:6666:7777:8888]"); + /* test NULL handling */ - rv = format_node_description(NULL, NULL, NULL, NULL, NULL); + rv = format_node_description(NULL, NULL, NULL, NULL, NULL, NULL); tt_str_op(rv, OP_EQ, "<NULL BUFFER>"); - rv = format_node_description(ndesc, NULL, NULL, NULL, NULL); + rv = format_node_description(ndesc, NULL, NULL, NULL, NULL, NULL); tt_ptr_op(rv, OP_EQ, ndesc); tt_str_op(rv, OP_EQ, "<NULL ID DIGEST>"); |