[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #7801 [Tor]: Our one use of tor_weak_random() is subtly wrong



#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
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs