aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2022-03-01 11:55:40 -0500
committerNick Mathewson <nickm@torproject.org>2022-03-01 12:02:46 -0500
commit93625da29ed603dad14305ef767c61ca6e4ad5e1 (patch)
treecc6c824b53c0d3d45c8faccf5ad41447fc7ad7c6
parenta79046f40a515473ece5eb74aa72f82511571fe0 (diff)
downloadtor-93625da29ed603dad14305ef767c61ca6e4ad5e1.tar.gz
tor-93625da29ed603dad14305ef767c61ca6e4ad5e1.zip
connection_or_set_identity_digest: more defensive programming
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.
-rw-r--r--src/core/or/connection_or.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/or/connection_or.c b/src/core/or/connection_or.c
index 069ee1d571..b3b5c389d5 100644
--- a/src/core/or/connection_or.c
+++ b/src/core/or/connection_or.c
@@ -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,