[tor-commits] [tor/master] Use siphash on channel/circuit-id map too

nickm at torproject.org nickm at torproject.org
Wed May 7 00:46:35 UTC 2014


commit 8127f4db30799d96b786509b74f49db4768cf6f1
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon May 5 12:13:33 2014 -0400

    Use siphash on channel/circuit-id map too
    
    Fixes ticket 11750.
---
 changes/bug11750     |    5 +++++
 src/or/circuitlist.c |    9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/changes/bug11750 b/changes/bug11750
new file mode 100644
index 0000000..f779ac8
--- /dev/null
+++ b/changes/bug11750
@@ -0,0 +1,5 @@
+  o Minor features (security):
+    - Apply the secure SipHash-2-4 function to the hash table mapping
+      circuit IDs and channels to circuits. We missed this one when we
+      were converting all the other hash functions to use SipHash back
+      in 0.2.5.3-alpha. Resolves ticket 11750.
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 90fc93f..58fb22d 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -76,7 +76,14 @@ chan_circid_entries_eq_(chan_circid_circuit_map_t *a,
 static INLINE unsigned int
 chan_circid_entry_hash_(chan_circid_circuit_map_t *a)
 {
-  return ((unsigned)a->circ_id) ^ (unsigned)(uintptr_t)(a->chan);
+  struct {
+    void *chan;
+    circid_t circid;
+  } s;
+  memset(&s, 0, sizeof(s));
+  s.chan = a->chan;
+  s.circid = a->circ_id;
+  return (unsigned) siphash24g(&s, sizeof(s));
 }
 
 /** Map from [chan,circid] to circuit. */





More information about the tor-commits mailing list