boringssl/ssl
David Benjamin 060cfb0911 Simplify handshake message size limits.
A handshake message can go up to 2^24 bytes = 16MB which is a little large for
the peer to force us to buffer. Accordingly, we bound the size of a
handshake message.

Rather than have a global limit, the existing logic uses a different limit at
each state in the handshake state machine and, for certificates, allows
configuring the maximum certificate size. This is nice in that we engage larger
limits iff the relevant state is reachable from the handshake. Servers without
client auth get a tighter limit "for free".

However, this doesn't work for DTLS due to out-of-order messages and we use a
simpler scheme for DTLS. This scheme also is tricky on optional messages and
makes the handshake <-> message layer communication complex.

Apart from an ignored 20,000 byte limit on ServerHello, the largest
non-certificate limit is the common 16k limit on ClientHello. So this
complexity wasn't buying us anything. Unify everything on the DTLS scheme
except, so as not to regress bounds on client-auth-less servers, also correctly
check for whether client auth is configured. The value of 16k was chosen based
on this value.

(The 20,000 byte ServerHello limit makes no sense. We can easily bound the
ServerHello because servers may not send extensions we don't implement. But it
gets overshadowed by the certificate anyway.)

Change-Id: I00309b16d809a3c2a1543f99fd29c4163e3add81
Reviewed-on: https://boringssl-review.googlesource.com/7941
Reviewed-by: David Benjamin <davidben@google.com>
2016-05-13 20:06:24 +00:00
..
pqueue Don't cast |OPENSSL_malloc|/|OPENSSL_realloc| result. 2016-02-11 22:07:56 +00:00
test Add a test for SCTs sent on resume. 2016-05-13 13:45:26 +00:00
CMakeLists.txt Implement draft-ietf-tls-curve25519-01 in C. 2015-12-22 21:51:30 +00:00
custom_extensions.c Align the SSL stack on #include style. 2015-09-15 23:32:07 +00:00
d1_both.c Simplify handshake message size limits. 2016-05-13 20:06:24 +00:00
d1_clnt.c Simplify handshake message size limits. 2016-05-13 20:06:24 +00:00
d1_lib.c Adding a method to change the initial DTLS retransmission timer value. 2016-05-11 22:36:26 +00:00
d1_meth.c Pull ChangeCipherSpec into the handshake state machine. 2015-12-16 18:36:57 +00:00
d1_pkt.c Set rwstate consistently. 2016-04-18 20:30:32 +00:00
d1_srtp.c Make kSRTPProfiles static. 2016-05-13 14:12:22 +00:00
d1_srvr.c Don't reset ssl->shutdown in the state machine. 2016-05-06 17:40:17 +00:00
dtls_record.c Move aead_{read,write}_ctx and next_proto_negotiated into ssl->s3. 2016-01-15 21:40:25 +00:00
internal.h Simplify handshake message size limits. 2016-05-13 20:06:24 +00:00
s3_both.c Simplify handshake message size limits. 2016-05-13 20:06:24 +00:00
s3_clnt.c Simplify handshake message size limits. 2016-05-13 20:06:24 +00:00
s3_enc.c Remove some easy obj.h dependencies. 2016-03-31 20:50:33 +00:00
s3_lib.c Remove some easy obj.h dependencies. 2016-03-31 20:50:33 +00:00
s3_meth.c Pull ChangeCipherSpec into the handshake state machine. 2015-12-16 18:36:57 +00:00
s3_pkt.c Set rwstate consistently. 2016-04-18 20:30:32 +00:00
s3_srvr.c Simplify handshake message size limits. 2016-05-13 20:06:24 +00:00
ssl_aead_ctx.c Disable all TLS crypto in fuzzer mode. 2016-03-02 23:39:36 +00:00
ssl_asn1.c Check for overflow when parsing a CBS with d2i_*. 2015-11-16 23:17:42 +00:00
ssl_buffer.c Set rwstate consistently. 2016-04-18 20:30:32 +00:00
ssl_cert.c Ensure we check i2d_X509 return val 2016-04-26 17:12:01 +00:00
ssl_cipher.c Remove a number of unnecessary stdio.h includes. 2016-03-17 18:22:28 +00:00
ssl_ecdh.c Remove some easy obj.h dependencies. 2016-03-31 20:50:33 +00:00
ssl_file.c Banish SSL_add_dir_cert_subjects_to_stack and OPENSSL_DIR_CTX to decrepit. 2016-04-27 18:40:25 +00:00
ssl_lib.c Adding a method to change the initial DTLS retransmission timer value. 2016-05-11 22:36:26 +00:00
ssl_rsa.c Add |SSL_CTX_set_private_key_method| to parallel |SSL_set_private_key_method| 2016-03-07 18:16:58 +00:00
ssl_session.c Add SSL_SESSION_get_master_key. 2016-04-21 21:14:36 +00:00
ssl_stat.c Document alert handling. 2015-10-20 19:03:24 +00:00
ssl_test.cc BIO_new_mem_buf should take const void * 2016-02-24 19:14:19 +00:00
t1_enc.c Remove some easy obj.h dependencies. 2016-03-31 20:50:33 +00:00
t1_lib.c Simplify server_name extension parsing. 2016-04-18 20:33:35 +00:00
tls_record.c Disable all TLS crypto in fuzzer mode. 2016-03-02 23:39:36 +00:00