]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
connection_or_set_identity_digest: more defensive programming
authorNick Mathewson <nickm@torproject.org>
Tue, 1 Mar 2022 16:55:40 +0000 (11:55 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 1 Mar 2022 17:02:46 +0000 (12:02 -0500)
We expect ed_id == NULL here to indicate "no ed id", but other parts
of Tor sometimes use an all-0 ed_id.  Here we detect that input and
replace it with what's expected.

src/core/or/connection_or.c

index 069ee1d571a50cbcdfb3f7c206a3712812918c25..b3b5c389d589e4816fbcafe1d9dd1495858d13ce 100644 (file)
@@ -165,6 +165,9 @@ connection_or_set_identity_digest(or_connection_t *conn,
   if (conn->chan)
     chan = TLS_CHAN_TO_BASE(conn->chan);
 
+  if (BUG(ed_id && ed25519_public_key_is_zero(ed_id)))
+    ed_id = NULL;
+
   log_info(LD_HANDSHAKE, "Set identity digest for %s at %p: %s %s.",
            connection_describe(TO_CONN(conn)),
            conn,