[tor-bugs] #27112 [Core Tor/Stem]: Decouple payload processing from pop/unpack + tune abstraction layers

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Aug 13 03:32:02 UTC 2018


#27112: Decouple payload processing from pop/unpack + tune abstraction layers
---------------------------+------------------------------
 Reporter:  dmr            |          Owner:  dmr
     Type:  enhancement    |         Status:  needs_review
 Priority:  Medium         |      Milestone:
Component:  Core Tor/Stem  |        Version:
 Severity:  Normal         |     Resolution:
 Keywords:  client         |  Actual Points:
Parent ID:                 |         Points:
 Reviewer:  atagar         |        Sponsor:
---------------------------+------------------------------

Comment (by dmr):

 For the review, I thought it might help to indicate where I plan to go in
 the near future.

 Another method I want to define at the Cell level is `check_digest()` to
 be used for decryption, to correspond with the algorithm specified in
 section 6.1 //([[https://gitweb.torproject.org/torspec.git/tree/tor-
 spec.txt?id=2d33e5f2e95f068d783673865c08cf6d33c36614#n1548|spec
 reference]])//.

 I further want to define `encrypt()` and `decrypt()` methods at the Cell
 level, to make everything much more streamlined. While technically
 misnomers, these would each do the auxiliary functionality, too.

 So...
 In addition to actual encryption, `encrypt()` would:
 * apply the digest (see existing `apply_digest()`)
 * return a RawRelayCell

 And...
 In addition to actual decryption, `decrypt()` would:
 * check 'recognized'
 * check the digest (via NYI `check_digest()`)
 * return a RawRelayCell if still encrypted, or an unencrypted/unpacked
 RELAY Cell if fully decrypted/recognized

 (The above is an oversimplification, but I hope it helps illustrate my
 thoughts.)

 My commits are also a bit forward-looking for a few other things. You can
 see some early structure to make it possible to:
 * centralize ORPort reads/sends (demux/mux)
 * implement RelayCell subclasses (e.g. parsing/packing of decrypted body)
 * handle RELAY_EARLY similarly with a lot of code reuse after a mild bit
 of refactoring

 It's all still in a bit of flux, and I don't seem to be able to fully
 decouple my commits into entirely 1 specific goal - overall they're
 working toward a collective vision.

 === Next-steps summary:
 1. implement Cell `check_digest()`
 2. implement Cell `encrypt()`
 3. implement Cell `decrypt()`
 4/5(TBD - **and in different tickets**):
 * centralize ORPort reads/sends (demux/mux)
 * implement RelayCell subclasses (e.g. parsing/packing of decrypted body)

 Right now I'm leaning towards RelayCell subclasses for `4`.

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


More information about the tor-bugs mailing list