1. Apr 11, 2022
    • Jakub Kicinski's avatar
      tls: rx: don't report text length from the bowels of decrypt · 9bdf75cc
      Jakub Kicinski authored
      
      
      We plumb pointer to chunk all the way to the decryption method.
      It's set to the length of the text when decrypt_skb_update()
      returns.
      
      I think the code is written this way because original TLS
      implementation passed &chunk to zerocopy_from_iter() and this
      was carried forward as the code gotten more complex, without
      any refactoring.
      
      The fix for peek() introduced a new variable - to_decrypt
      which for all practical purposes is what chunk is going to
      get set to. Spare ourselves the pointer passing, use to_decrypt.
      
      Use this opportunity to clean things up a little further.
      
      Note that chunk / to_decrypt was mostly needed for the async
      path, since the sync path would access rxm->full_len (decryption
      transforms full_len from record size to text size). Use the
      right source of truth more explicitly.
      
      We have three cases:
       - async - it's TLS 1.2 only, so chunk == to_decrypt, but we
                 need the min() because to_decrypt is a whole record
      	   and we don't want to underflow len. Note that we can't
      	   handle partial record by falling back to sync as it
      	   would introduce reordering against records in flight.
       - zc - again, TLS 1.2 only for now, so chunk == to_decrypt,
              we don't do zc if len < to_decrypt, no need to check again.
       - normal - it already handles chunk > len, we can factor out the
                  assignment to rxm->full_len and share it with zc.
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9bdf75cc
    • Jakub Kicinski's avatar
      tls: rx: drop unnecessary arguments from tls_setup_from_iter() · d4bd88e6
      Jakub Kicinski authored
      
      
      sk is unused, remove it to make it clear the function
      doesn't poke at the socket.
      
      size_used is always 0 on input and @length on success.
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d4bd88e6
  2. Apr 09, 2022
  3. Apr 08, 2022