authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-06-26 21:03:40-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-06-26 21:05:08-04:00
log8239d3b358878ec4c0662a0dc2ccdc42c0e313c1
tree0c21ee6c79cea1e9c2e89d98f939fdf2b2fb5d35
parenteb8881a538ae57dc9a8752c72516612904003d1d

crypto: recoup storage in `tls.Client.partially_read_buffer`


1 files changed, 7 insertions(+), 0 deletions(-)

lib/std/crypto/tls/Client.zig+7
...@@ -958,6 +958,13 @@ pub fn readvAdvanced(c: *Client, stream: anytype, iovecs: []const std.os.iovec)...@@ -958,6 +958,13 @@ pub fn readvAdvanced(c: *Client, stream: anytype, iovecs: []const std.os.iovec)
958 // The amount of the user's buffer that will be used to give cleartext. The958 // The amount of the user's buffer that will be used to give cleartext. The
959 // beginning of the buffer will be used for such purposes.959 // beginning of the buffer will be used for such purposes.
960 const cleartext_buf_len = free_size - ciphertext_buf_len;960 const cleartext_buf_len = free_size - ciphertext_buf_len;
961
962 // Recoup `partially_read_buffer space`. This is necessary because it is assumed
963 // below that `frag0` is big enough to hold at least one record.
964 limitedOverlapCopy(c.partially_read_buffer[0..c.partial_ciphertext_end], c.partial_ciphertext_idx);
965 c.partial_ciphertext_end -= c.partial_ciphertext_idx;
966 c.partial_ciphertext_idx = 0;
967 c.partial_cleartext_idx = 0;
961 const first_iov = c.partially_read_buffer[c.partial_ciphertext_end..];968 const first_iov = c.partially_read_buffer[c.partial_ciphertext_end..];
962969
963 var ask_iovecs_buf: [2]std.os.iovec = .{970 var ask_iovecs_buf: [2]std.os.iovec = .{