From d72618eb7f152c8f1633294fa30978c7ac0a48f3 Mon Sep 17 00:00:00 2001 From: Daniel Pinto Date: Sat, 6 Jun 2020 11:34:47 +0100 Subject: Remove padding from ntor-onion-key #7869 --- src/feature/relay/router.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/feature/relay/router.c') 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"); -- cgit v1.2.3-54-g00ecf