From f3f6ecef48b019fe18fac371b64c3f3466ef3388 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 12 May 2008 02:14:01 +0000 Subject: r19690@catbus: nickm | 2008-05-11 22:13:31 -0400 Implement a proposal to let a directory authority migrate its identity key without ceasing to sign consensuses. svn:r14584 --- src/or/routerparse.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/or/routerparse.c') diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 016b938ae9..f140d5d5fe 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -79,6 +79,7 @@ typedef enum { K_CONSENSUS_DIGEST, K_CONSENSUS_METHODS, K_CONSENSUS_METHOD, + K_LEGACY_DIR_KEY, A_PURPOSE, _A_UNKNOWN, @@ -365,6 +366,7 @@ static token_rule_t networkstatus_token_table[] = { T0N("opt", K_OPT, CONCAT_ARGS, OBJ_OK ), T1( "contact", K_CONTACT, CONCAT_ARGS, NO_OBJ ), T1( "dir-source", K_DIR_SOURCE, GE(6), NO_OBJ ), + T01("legacy-dir-key", K_LEGACY_DIR_KEY, GE(1), NO_OBJ ), T1( "known-flags", K_KNOWN_FLAGS, CONCAT_ARGS, NO_OBJ ), T01("client-versions", K_CLIENT_VERSIONS, CONCAT_ARGS, NO_OBJ ), T01("server-versions", K_SERVER_VERSIONS, CONCAT_ARGS, NO_OBJ ), @@ -2282,6 +2284,23 @@ networkstatus_parse_vote_from_string(const char *s, const char **eos_out, goto err; } + if (is_vote && + (tok = find_first_by_keyword(tokens, K_LEGACY_DIR_KEY))) { + int bad = 1; + if (strlen(tok->args[0]) == HEX_DIGEST_LEN) { + networkstatus_voter_info_t *voter = smartlist_get(ns->voters, 0); + if (base16_decode(voter->legacy_id_digest, DIGEST_LEN, + tok->args[0], HEX_DIGEST_LEN)<0) + bad = 1; + else + bad = 0; + } + if (bad) { + log_warn(LD_DIR, "Invalid legacy key digest %s on vote.", + escaped(tok->args[0])); + } + } + /* Parse routerstatus lines. */ rs_tokens = smartlist_create(); rs_area = memarea_new(512); -- cgit v1.2.3-54-g00ecf