[tor-bugs] #23061 [Core Tor/Tor]: crypto_rand_double() should produce all possible outputs on platforms with 32-bit int

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Aug 1 23:51:05 UTC 2017


#23061: crypto_rand_double() should produce all possible outputs on platforms with
32-bit int
-------------------------------------------------+-------------------------
 Reporter:  teor                                 |          Owner:
     Type:  defect                               |         Status:
                                                 |  needs_review
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.3.2.x-final
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.2.2.14-alpha
 Severity:  Normal                               |     Resolution:
 Keywords:  tor-relay, security-low, privcount,  |  Actual Points:  0.5
  031-backport, 030-backport, 029-backport, 028  |
  -backport-maybe, 027-backport-maybe, 026       |
  -backport-maybe                                |
Parent ID:                                       |         Points:  0.1
 Reviewer:                                       |        Sponsor:
                                                 |  SponsorQ
-------------------------------------------------+-------------------------

Comment (by nickm):

 Where applicable, we should use the algorithm from
 http://allendowney.com/research/rand/  .  Zack Weinberg wrote it up in C++
 with
 https://github.com/TheTorProject/stegotorus/blob/master/src/rng.cc#L86 ;
 that may be worth looking at for inspiration.

 Teor says (copying with permission) :
 {{{
 23:34 <+teor> Yes, that code is definitely better. But we'll need the
 following
               tweaks:
 23:35 <+teor> 1. Check if the internal double representation is the one we
               expect, and if not, fall back to the code in my existing
 branch
 23:35 <+teor> (There's no requirement in the C standard that double has a
               particular binary representation)
 23:36 <+teor> 2. Add a unit test that shows that *if* we're using IEEE754
               doubles, then we can get a few values in (0, 1/2**64)
 23:37 <+teor> 3. Fix the crypto_rand() mocking to stop assuming that we
 only
               ask for 64 bits
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/23061#comment:5>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list