Skip to content

Commit

Permalink
std.crypto.tls.Client: rework the read function
Browse files Browse the repository at this point in the history
Here's what I landed on for the TLS client. It's 16896 bytes
(max_ciphertext_record_len is 16640). I believe this is the theoretical
minimum size, give or take a few bytes.

These constraints are satisfied:
 * a call to the readvAdvanced() function makes at most one call to the
   underlying readv function
 * iovecs are provided by the API, and used by the implementation for
   underlying readv() calls to the socket
 * the theoretical minimum number of memcpy() calls are issued in all
   circumstances
 * decryption is only performed once for any given TLS record
 * large read buffers are fully exploited

This is accomplished by using the partial read buffer to storing both
cleartext and ciphertext.
  • Loading branch information
andrewrk committed Dec 29, 2022
1 parent ad1832f commit 0dc85f9
Show file tree
Hide file tree
Showing 2 changed files with 341 additions and 113 deletions.
Loading

0 comments on commit 0dc85f9

Please sign in to comment.