aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay
diff options
context:
space:
mode:
authorDaniel Pinto <danielpinto52@gmail.com>2020-06-06 11:34:47 +0100
committerNick Mathewson <nickm@torproject.org>2020-07-23 08:25:22 -0400
commitd72618eb7f152c8f1633294fa30978c7ac0a48f3 (patch)
treea8ed65e80420b8a7e254bcde56634f70051e95f4 /src/feature/relay
parent27315de590da24fe55353332c29a3a4454ee7da2 (diff)
downloadtor-d72618eb7f152c8f1633294fa30978c7ac0a48f3.tar.gz
tor-d72618eb7f152c8f1633294fa30978c7ac0a48f3.zip
Remove padding from ntor-onion-key #7869
Diffstat (limited to 'src/feature/relay')
-rw-r--r--src/feature/relay/router.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 34d8163c36..ffaf7c3cc5 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -2854,11 +2854,9 @@ router_dump_router_to_string(routerinfo_t *router,
}
if (router->onion_curve25519_pkey) {
- char kbuf[128];
- base64_encode(kbuf, sizeof(kbuf),
- (const char *)router->onion_curve25519_pkey->public_key,
- CURVE25519_PUBKEY_LEN, BASE64_ENCODE_MULTILINE);
- smartlist_add_asprintf(chunks, "ntor-onion-key %s", kbuf);
+ char kbuf[CURVE25519_BASE64_PADDED_LEN + 1];
+ curve25519_public_to_base64(kbuf, router->onion_curve25519_pkey, false);
+ smartlist_add_asprintf(chunks, "ntor-onion-key %s\n", kbuf);
} else {
/* Authorities will start rejecting relays without ntor keys in 0.2.9 */
log_err(LD_BUG, "A relay must have an ntor onion key");