diff options
author | Nick Mathewson <nickm@torproject.org> | 2024-06-24 14:04:04 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2024-06-24 17:48:55 -0400 |
commit | 07f0a2b964eedd1ced201f2d1d82ec0089fac371 (patch) | |
tree | 85525971ade35b8aaadca8c73f571aa889acc5bd /src/feature/dirparse/microdesc_parse.c | |
parent | f631145cbf2d0a8f1f170e206c38c77edfba8bad (diff) | |
download | tor-07f0a2b964eedd1ced201f2d1d82ec0089fac371.tar.gz tor-07f0a2b964eedd1ced201f2d1d82ec0089fac371.zip |
Make onion-key body optional in microdescs
Also, stop storing onion keys in microdesc_t.
(In prop350, for microdescs, we are making the body optional; the "onion-key"
entry is still mandatory, so that we can tell where microdescs begin.)
Diffstat (limited to 'src/feature/dirparse/microdesc_parse.c')
-rw-r--r-- | src/feature/dirparse/microdesc_parse.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/feature/dirparse/microdesc_parse.c b/src/feature/dirparse/microdesc_parse.c index beb38bda30..eef52f14f3 100644 --- a/src/feature/dirparse/microdesc_parse.c +++ b/src/feature/dirparse/microdesc_parse.c @@ -30,7 +30,7 @@ /** List of tokens recognized in microdescriptors */ // clang-format off static token_rule_t microdesc_token_table[] = { - T1_START("onion-key", K_ONION_KEY, NO_ARGS, NEED_KEY_1024), + T1_START("onion-key", K_ONION_KEY, NO_ARGS, OPT_KEY_1024), T1("ntor-onion-key", K_ONION_KEY_NTOR, GE(1), NO_OBJ ), T0N("id", K_ID, GE(2), NO_OBJ ), T0N("a", K_A, GE(1), NO_OBJ ), @@ -200,14 +200,11 @@ microdesc_parse_fields(microdesc_t *md, } tok = find_by_keyword(tokens, K_ONION_KEY); - if (!crypto_pk_public_exponent_ok(tok->key)) { + if (tok && tok->key && !crypto_pk_public_exponent_ok(tok->key)) { log_warn(LD_DIR, "Relay's onion key had invalid exponent."); goto err; } - md->onion_pkey = tor_memdup(tok->object_body, tok->object_size); - md->onion_pkey_len = tok->object_size; - crypto_pk_free(tok->key); if ((tok = find_opt_by_keyword(tokens, K_ONION_KEY_NTOR))) { curve25519_public_key_t k; |