[tor-bugs] #7801 [Tor]: Our one use of tor_weak_random() is subtly wrong
Tor Bug Tracker & Wiki
blackhole at torproject.org
Fri Dec 28 02:00:36 UTC 2012
#7801: Our one use of tor_weak_random() is subtly wrong
-----------------------+----------------------------------------------------
Reporter: nickm | Owner:
Type: defect | Status: needs_review
Priority: minor | Milestone: Tor: 0.2.4.x-final
Component: Tor | Version:
Keywords: tor-relay | Parent:
Points: | Actualpoints:
-----------------------+----------------------------------------------------
Comment(by nickm):
I'd assume it was performance.
Doing a 4-byte RAND_bytes() is about 100-200X slower than random() on my
laptop, and probably similarly different elsewhere. That's enough to turn
the "pick a random element of the list of streams" algorithm (for 1000
streams) from a negligable 8 microsec to a hefty 800 microsec --
comparable to an entire onion handshake.
That said, it would probably be faster still just to count the streams,
then do ''one'' call to a rng function.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7801#comment:19>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list