boringssl/ssl
David Benjamin 894f48c6b3 Only read 5 bytes (record header length) in sniffing for V2ClientHello.
This guarantees that we never read beyond the first record, even if the
first record is empty. Between removing SSL_set_read_ahead and DTLS
enforcing record boundaries, this means the buffer need never memmove
data.

The memmove isn't really much of a burden and we can probably just put
SSL_set_read_ahead back after the cleanup if desired. But while the
non-existant read_ahead is off, we should avoid reading more than needed.

(Also the current memmove logic is completely wrong for TLS. Checking
align != 0 doesn't make sense. The real reason to memmove is that the
next record may still be full size. So now line 209 of s3_pkt.c should
*actually* be unreachable.)

SSL_R_HTTPS_PROXY_REQUEST detection is now slightly less accurate, but
OpenSSL was already not parsing HTTP completely. We could asynchronously
read the extra 3 bytes once the first 5 match, but that seems
unnecessary. (Shall we just get rid of all these HTTP detectors? The
only consumer of those error codes is some diagnostics logic.)

BUG=468889

Change-Id: Ie3bf148ae7274795e1d048d78282d1d8063278ea
Reviewed-on: https://boringssl-review.googlesource.com/5714
Reviewed-by: Adam Langley <agl@google.com>
2015-08-17 20:58:09 +00:00
..
pqueue Fix some malloc test crashs. 2015-05-21 18:00:10 +00:00
test Slightly simplify V2ClientHello sniffing. 2015-08-17 20:48:06 +00:00
CMakeLists.txt Implement custom extensions. 2015-07-31 01:12:00 +00:00
custom_extensions.c Fix NULL dereference in the case of an unexpected extension from a server. 2015-08-07 18:21:20 +00:00
d1_both.c Remove the func parameter to OPENSSL_PUT_ERROR. 2015-07-16 02:02:37 +00:00
d1_clnt.c Decouple the handshake buffer and digest. 2015-08-07 01:10:33 +00:00
d1_lib.c Decouple the handshake buffer and digest. 2015-08-07 01:10:33 +00:00
d1_meth.c Further tidy up cipher logic. 2015-06-01 22:48:30 +00:00
d1_pkt.c Clean up DTLS1_BITMAP code. 2015-08-05 21:23:05 +00:00
d1_srtp.c Convert the SRTP extension to the new system 2015-07-21 21:44:22 +00:00
d1_srvr.c Decouple the handshake buffer and digest. 2015-08-07 01:10:33 +00:00
internal.h Remove SSL_CTRL_SET_CLIENT_CERT_TYPES. 2015-08-17 19:15:14 +00:00
s3_both.c Switch the handshake buffer from memory BIO to BUF_MEM. 2015-08-07 01:11:42 +00:00
s3_clnt.c Simplify tls1_channel_id_hash. 2015-08-07 01:16:33 +00:00
s3_enc.c Simplify handshake hash handling. 2015-08-07 01:47:21 +00:00
s3_lib.c Use the record-layer buffer for sniffing V2ClientHellos. 2015-08-17 20:56:21 +00:00
s3_meth.c Further tidy up cipher logic. 2015-06-01 22:48:30 +00:00
s3_pkt.c Remove the func parameter to OPENSSL_PUT_ERROR. 2015-07-16 02:02:37 +00:00
s3_srvr.c Only read 5 bytes (record header length) in sniffing for V2ClientHello. 2015-08-17 20:58:09 +00:00
ssl_aead_ctx.c Fold away SSL_CIPHER_ALGORITHM2_VARIABLE_NONCE_INCLUDED_IN_RECORD. 2015-08-07 00:57:37 +00:00
ssl_algs.c Rename ssl_locl.h to internal.h 2015-04-10 22:14:09 +00:00
ssl_asn1.c Remove the func parameter to OPENSSL_PUT_ERROR. 2015-07-16 02:02:37 +00:00
ssl_cert.c Remove SSL_CTRL_SET_CLIENT_CERT_TYPES. 2015-08-17 19:15:14 +00:00
ssl_cipher.c Simplify handshake hash handling. 2015-08-07 01:47:21 +00:00
ssl_lib.c Slightly simplify V2ClientHello sniffing. 2015-08-17 20:48:06 +00:00
ssl_rsa.c Add server-side support for asynchronous signing. 2015-07-31 01:14:29 +00:00
ssl_sess.c Reserve ex_data index zero for app_data. 2015-07-20 16:56:34 +00:00
ssl_stat.c Remove ssl2.h and ssl23.h. 2015-07-01 21:47:01 +00:00
ssl_test.cc Add tests for the padding extension. 2015-07-29 19:20:53 +00:00
ssl_txt.c Remove the func parameter to OPENSSL_PUT_ERROR. 2015-07-16 02:02:37 +00:00
t1_enc.c Simplify handshake hash handling. 2015-08-07 01:47:21 +00:00
t1_lib.c Simplify tls1_channel_id_hash. 2015-08-07 01:16:33 +00:00