[tor-bugs] #28636 [Core Tor/Tor]: Address WTF-PAD comments by Nick (2018-11-27 over IRC)

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Dec 5 12:06:05 UTC 2018


#28636: Address WTF-PAD comments by Nick (2018-11-27 over IRC)
-------------------------------------------------+-------------------------
 Reporter:  asn                                  |          Owner:  (none)
     Type:  defect                               |         Status:  new
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.4.0.x-final
Component:  Core Tor/Tor                         |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  wtf-pad, tor-relay, tor-cell,        |  Actual Points:
  padding                                        |
Parent ID:  #28632                               |         Points:
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by asn):

 Some logs from Riastradh on how to fix the probdistr stuff:
 {{{
  21:49 < Riastradh> nickm: You rightly identified that the intended way to
 get at functions like uniform_sample is via the dist_ops!  See bin_cdfs
 and bin_samples in test_prob_distr.c for an
                     example of how to use them generically -- these (and
 the test_psi_dist_sample function) were why I built that abstraction.
  21:50 < Riastradh> nickm: I did not build wrapper functions because I
 just needed it for the tests and I didn't want to spend any more time than
 necessary architecting an abstraction without
                     knowing whether it would bear fruit beyond its
 erstwhile solitary use case.
  21:52 < Riastradh> nickm: If you want to make broader use than the switch
 in circpad_distribution_sample, I would encourage a dist_sample(dist) {
 return dist->ops->sample(dist); } function, and
                     dist_cdf(dist, x) { return dist->ops->cdf(dist, x); },
 &c.
  21:58 < Riastradh> nickm: And if you did this, I would encorage hiding
 the member functions uniform_sample, uniform_cdf, &c., in prob_distr.c.
 Indeed, you could do that right now in
                     circpad_distribution_sample with no adverse effects.
  22:01 < Riastradh> nickm: As for potential circularities between crypto
 and math, it would be reasonable to separate the purely computational
 functions in prob_distr.c from the struct dist
                     abstraction which uses crypto_rand_*; one could go in
 math and the other could go in crypto or something downstream of both math
 and crypto.
  22:01 < Riastradh> nickm: I didn't do that splitting up because I'm not
 familiar with the large-scale organization of the code base so I didn't
 want to commit to particular organizational
                     suggestions that would turn out to be moot.
  22:03 < Riastradh> nickm: If you want to split up prob_distr.c, nothing
 _above_ `Public API for probability distributions' depends on anything
 below it, so that's the easy point.
                     (sample_geometric should maybe go above that instead
 of below it.)
 }}}

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


More information about the tor-bugs mailing list