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

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



#23061: crypto_rand_double() should produce all possible outputs on platforms with
32-bit int
-------------------------------------------------+-------------------------
 Reporter:  teor                                 |          Owner:  nickm
     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, review-group-22               |
Parent ID:                                       |         Points:  0.1
 Reviewer:                                       |        Sponsor:
                                                 |  SponsorQ
-------------------------------------------------+-------------------------

Comment (by yawning):

 Replying to [comment:21 nickm]:
 > but can we do better?

 On a more serious attempt at giving an answer, as a non-portable "better"
 (that I still think is largely pointless), you can probably use a variant
 of my solution with `long double` and cast to `double`.

 Note that the behavior of such a routine is entirely compiler and
 architecture dependent, and it'll probably be a lot slower when it works.

 If it were up to me, I would fully document the behavior and be done with
 it, under the assumption that anyone doing something that requires a less
 leaky floating point abstraction can either scale their values correctly
 (and use integer math) or write their own sampler.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/23061#comment:29>
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