diff options
author | Nick Mathewson <nickm@torproject.org> | 2024-06-24 14:30:32 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2024-06-26 11:42:36 -0400 |
commit | 4cdf56a17376a09612d741054efd11a3016d578c (patch) | |
tree | c89791a416d425191d9da387e98bf8f0d6ce6497 /src/feature/relay | |
parent | cbbfb812a8eca6587ea2af12693d5c2357146f57 (diff) | |
download | tor-4cdf56a17376a09612d741054efd11a3016d578c.tar.gz tor-4cdf56a17376a09612d741054efd11a3016d578c.zip |
Rename "onion_pkey" fields in routerinfo_t, and make them optional.
(Renaming them has forced me to look at every place where they are used, so I
can make sure that they are really optional now.)
Diffstat (limited to 'src/feature/relay')
-rw-r--r-- | src/feature/relay/router.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c index 1ed9630e09..1a29b54494 100644 --- a/src/feature/relay/router.c +++ b/src/feature/relay/router.c @@ -2139,8 +2139,8 @@ router_build_fresh_unsigned_routerinfo,(routerinfo_t **ri_out)) directory_permits_begindir_requests(options); ri->cache_info.published_on = time(NULL); /* get_onion_key() must invoke from main thread */ - router_set_rsa_onion_pkey(get_onion_key(), &ri->onion_pkey, - &ri->onion_pkey_len); + router_set_rsa_onion_pkey(get_onion_key(), &ri->tap_onion_pkey, + &ri->tap_onion_pkey_len); ri->onion_curve25519_pkey = tor_memdup(&get_current_curve25519_keypair()->pubkey, @@ -2777,7 +2777,7 @@ router_dump_router_to_string(routerinfo_t *router, char published[ISO_TIME_LEN+1]; char fingerprint[FINGERPRINT_LEN+1]; char *extra_info_line = NULL; - size_t onion_pkeylen, identity_pkeylen; + size_t onion_pkeylen=0, identity_pkeylen; char *family_line = NULL; char *extra_or_address = NULL; const or_options_t *options = get_options(); @@ -2835,12 +2835,14 @@ router_dump_router_to_string(routerinfo_t *router, } /* PEM-encode the onion key */ - rsa_pubkey = router_get_rsa_onion_pkey(router->onion_pkey, - router->onion_pkey_len); - if (crypto_pk_write_public_key_to_string(rsa_pubkey, - &onion_pkey,&onion_pkeylen)<0) { - log_warn(LD_BUG,"write onion_pkey to string failed!"); - goto err; + rsa_pubkey = router_get_rsa_onion_pkey(router->tap_onion_pkey, + router->tap_onion_pkey_len); + if (rsa_pubkey) { + if (crypto_pk_write_public_key_to_string(rsa_pubkey, + &onion_pkey,&onion_pkeylen)<0) { + log_warn(LD_BUG,"write onion_pkey to string failed!"); + goto err; + } } /* PEM-encode the identity key */ @@ -2851,7 +2853,7 @@ router_dump_router_to_string(routerinfo_t *router, } /* Cross-certify with RSA key */ - if (tap_key && router->cache_info.signing_key_cert && + if (tap_key && rsa_pubkey && router->cache_info.signing_key_cert && router->cache_info.signing_key_cert->signing_key_included) { char buf[256]; int tap_cc_len = 0; @@ -2976,7 +2978,7 @@ router_dump_router_to_string(routerinfo_t *router, "uptime %ld\n" "bandwidth %d %d %d\n" "%s%s" - "onion-key\n%s" + "%s%s" "signing-key\n%s" "%s%s" "%s%s%s", @@ -2997,7 +2999,8 @@ router_dump_router_to_string(routerinfo_t *router, extra_info_line ? extra_info_line : "", (options->DownloadExtraInfo || options->V3AuthoritativeDir) ? "caches-extra-info\n" : "", - onion_pkey, identity_pkey, + onion_pkey?"onion-key\n":"", onion_pkey?onion_pkey:"", + identity_pkey, rsa_tap_cc_line ? rsa_tap_cc_line : "", ntor_cc_line ? ntor_cc_line : "", family_line, |