[tor-bugs] #31589 [Core Tor/Tor]: hs-v3: Simplify decrypt_desc_layer interface

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Sep 2 11:16:05 UTC 2019


#31589: hs-v3: Simplify decrypt_desc_layer interface
---------------------------+-----------------------------------------------
     Reporter:  asn        |      Owner:  (none)
         Type:  defect     |     Status:  new
     Priority:  Medium     |  Milestone:  Tor: unspecified
    Component:  Core       |    Version:
  Tor/Tor                  |
     Severity:  Normal     |   Keywords:  tor-hs easy refactoring tech-debt
Actual Points:             |  Parent ID:
       Points:             |   Reviewer:
      Sponsor:             |
---------------------------+-----------------------------------------------
 Here is how `decrypt_desc_layer` is called:
 {{{
   superencrypted_len = decrypt_desc_layer(desc,
                                  desc->plaintext_data.superencrypted_blob,
 desc->plaintext_data.superencrypted_blob_size,
                                  NULL, 1, &superencrypted_plaintext);
 }}}
 {{{
   encrypted_len = decrypt_desc_layer(desc,
                                  desc->superencrypted_data.encrypted_blob,
 desc->superencrypted_data.encrypted_blob_size,
                                  descriptor_cookie, 0,
 &encrypted_plaintext);
 }}}

 There is no point in passing `desc->superencrypted_data.encrypted_blob`
 and `desc->superencrypted_data.encrypted_blob_size` since we are already
 passing the whole `desc` and `is_superencrypted_layer` which should be
 enough to figure out which fields to use.

 We could either of the following two things:
 - Ditch `desc` as an argument and pass
 `desc->plaintext_data.blinded_pubkey` explicitly.
 - Ditch `encrypted_blob` and `encrypted_blob_size` as arguments and get
 them off desc.

 I prefer the first, but I'm fine with either, since it will make the
 interface cleaner.

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


More information about the tor-bugs mailing list