boringssl/ssl
David Benjamin 3120950b1e Size TLS read buffers based on the size requested.
Like the write half, rather than allocating the maximum size needed and
relying on the malloc implementation to pool this sanely, allocate the
size the TLS record-layer code believes it needs.

As currently arranged, this will cause us to alternate from a small
allocation (for the record header) and then an allocation sized to the
record itself. Windows is reportedly bad at pooling large allocations,
so, *if the server sends us smaller records*, this will avoid hitting
the problem cases.

If the server sends us size 16k records, the maximum allowed by ther
protocol, we simply must buffer up to that amount and will continue to
allocate similar sizes as before (although slightly smaller; this CL
also fixes small double-counting we did on the allocation sizes).

Separately, we'll gather some metrics in Chromium to see what common
record sizes are to determine if this optimization is sufficient. This
is intended as an easy optimization we can do now, in advance of ongoing
work to fix the extra layer of buffering between Chromium and BoringSSL
with an in-place decrypt API.

Bug: chromium:524258
Change-Id: I233df29df1212154c49fee4285ccc37be12f81dc
Reviewed-on: https://boringssl-review.googlesource.com/17329
Reviewed-by: Adam Langley <agl@google.com>
2017-06-23 23:08:35 +00:00
..
test Detect WatchGuard's TLS 1.3 interference failure mode. 2017-06-22 19:49:23 +00:00
bio_ssl.c
CMakeLists.txt Convert bio_test to GTest. 2017-03-21 17:39:57 +00:00
custom_extensions.c Support enabling early data on SSL 2017-04-03 20:25:29 +00:00
d1_both.c Trim x509.h includes. 2017-03-07 23:13:49 +00:00
d1_lib.c Don't use long for timestamps. 2017-03-01 21:58:38 +00:00
d1_pkt.c Adding support for sending early data on the client. 2017-06-15 19:34:59 +00:00
d1_srtp.c
dtls_method.c Adding support for receiving early data on the server. 2017-03-26 19:30:27 +00:00
dtls_record.c
handshake_client.c Stash the computed version range in SSL_HANDSHAKE. 2017-06-20 20:13:09 +00:00
handshake_server.c Stash the computed version range in SSL_HANDSHAKE. 2017-06-20 20:13:09 +00:00
internal.h Stash the computed version range in SSL_HANDSHAKE. 2017-06-20 20:13:09 +00:00
s3_both.c Unwind V2ClientHello counters. 2017-06-16 20:24:00 +00:00
s3_lib.c Really remove DHE ciphersuites from TLS. 2017-04-11 23:41:31 +00:00
s3_pkt.c Detect WatchGuard's TLS 1.3 interference failure mode. 2017-06-22 19:49:23 +00:00
ssl_aead_ctx.c Enforce incrementing counter for TLS 1.2 AES-GCM. 2017-05-26 20:06:36 +00:00
ssl_asn1.c Remove the last remnants of key_exchange_info. 2017-04-13 21:23:40 +00:00
ssl_buffer.c Size TLS read buffers based on the size requested. 2017-06-23 23:08:35 +00:00
ssl_cert.c Really remove DHE ciphersuites from TLS. 2017-04-11 23:41:31 +00:00
ssl_cipher.c Support standard RFC cipher suite names alongside OpenSSL ones. 2017-06-22 02:45:37 +00:00
ssl_ecdh.c Fix some malloc failure handling. 2017-06-15 19:38:59 +00:00
ssl_file.c Remove |X509| things from SSL_SESSION. 2017-02-10 19:12:04 +00:00
ssl_lib.c Simplify SSL_get0_next_proto_negotiated. 2017-06-22 00:00:44 +00:00
ssl_privkey_cc.cc Rename ssl_rsa.c to ssl_privkey.c. 2017-02-09 18:45:11 +00:00
ssl_privkey.c Simplify ssl_private_key_* state machine points. 2017-06-20 19:37:05 +00:00
ssl_session.c Adding support for sending early data on the client. 2017-06-15 19:34:59 +00:00
ssl_stat.c Simplify ssl_private_key_* state machine points. 2017-06-20 19:37:05 +00:00
ssl_test.cc Fix record header callback on writes. 2017-06-23 23:01:36 +00:00
ssl_transcript.c Moving transcript and PRF functions to SSL_TRANSCRIPT. 2017-02-10 16:33:42 +00:00
ssl_x509.c Move ssl_verify_alarm_type into ssl_x509.c. 2017-03-07 23:14:16 +00:00
t1_enc.c Enforce incrementing counter for TLS 1.2 AES-GCM. 2017-05-26 20:06:36 +00:00
t1_lib.c Stash the computed version range in SSL_HANDSHAKE. 2017-06-20 20:13:09 +00:00
tls13_both.c Simplify ssl_private_key_* state machine points. 2017-06-20 19:37:05 +00:00
tls13_client.c Simplify ssl_private_key_* state machine points. 2017-06-20 19:37:05 +00:00
tls13_enc.c Enforce incrementing counter for TLS 1.2 AES-GCM. 2017-05-26 20:06:36 +00:00
tls13_server.c Simplify ssl_private_key_* state machine points. 2017-06-20 19:37:05 +00:00
tls_method.c Adding support for receiving early data on the server. 2017-03-26 19:30:27 +00:00
tls_record.c Fix record header callback on writes. 2017-06-23 23:01:36 +00:00