boringssl/ssl
David Benjamin b8d28cf532 Factor out the buffering and low-level record code.
This begins decoupling the transport from the SSL state machine. The buffering
logic is hidden behind an opaque API. Fields like ssl->packet and
ssl->packet_length are gone.

ssl3_get_record and dtls1_get_record now call low-level tls_open_record and
dtls_open_record functions that unpack a single record independent of who owns
the buffer. Both may be called in-place. This removes ssl->rstate which was
redundant with the buffer length.

Future work will push the buffer up the stack until it is above the handshake.
Then we can expose SSL_open and SSL_seal APIs which act like *_open_record but
return a slightly larger enum due to other events being possible. Likewise the
handshake state machine will be detached from its buffer. The existing
SSL_read, SSL_write, etc., APIs will be implemented on top of SSL_open, etc.,
combined with ssl_read_buffer_* and ssl_write_buffer_*. (Which is why
ssl_read_buffer_extend still tries to abstract between TLS's and DTLS's fairly
different needs.)

The new buffering logic does not support read-ahead (removed previously) since
it lacks a memmove on ssl_read_buffer_discard for TLS, but this could be added
if desired. The old buffering logic wasn't quite right anyway; it tried to
avoid the memmove in some cases and could get stuck too far into the buffer and
not accept records. (The only time the memmove is optional is in DTLS or if
enough of the record header is available to know that the entire next record
would fit in the buffer.)

The new logic also now actually decrypts the ciphertext in-place again, rather
than almost in-place when there's an explicit nonce/IV. (That accidentally
switched in https://boringssl-review.googlesource.com/#/c/4792/; see
3d59e04bce96474099ba76786a2337e99ae14505.)

BUG=468889

Change-Id: I403c1626253c46897f47c7ae93aeab1064b767b2
Reviewed-on: https://boringssl-review.googlesource.com/5715
Reviewed-by: Adam Langley <agl@google.com>
2015-08-28 22:01:02 +00:00
..
pqueue
test Remove Go implementation of non-standard ECDHE_PSK_WITH_AES_128_GCM_SHA256. 2015-08-24 23:35:43 +00:00
CMakeLists.txt Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +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
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 Remove signature algorithm configuration hooks and SSL_ctrl. 2015-08-18 22:13:20 +00:00
d1_pkt.c Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00
d1_srtp.c Convert the SRTP extension to the new system 2015-07-21 21:44:22 +00:00
d1_srvr.c Server-side OCSP stapling support. 2015-08-20 17:55:31 +00:00
dtls_record.c Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00
internal.h Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00
s3_both.c Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00
s3_clnt.c Make key exchange strength available. 2015-08-18 22:09:27 +00:00
s3_enc.c Simplify handshake hash handling. 2015-08-07 01:47:21 +00:00
s3_lib.c Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00
s3_meth.c Remove signature algorithm configuration hooks and SSL_ctrl. 2015-08-18 22:13:20 +00:00
s3_pkt.c Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00
s3_srvr.c Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +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
ssl_asn1.c Make key exchange strength available. 2015-08-18 22:09:27 +00:00
ssl_buffer.c Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00
ssl_cert.c Remove signature algorithm configuration hooks and SSL_ctrl. 2015-08-18 22:13:20 +00:00
ssl_cipher.c Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00
ssl_lib.c Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00
ssl_rsa.c Add server-side support for asynchronous signing. 2015-07-31 01:14:29 +00:00
ssl_sess.c Make key exchange strength available. 2015-08-18 22:09:27 +00:00
ssl_stat.c Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00
ssl_test.cc Make key exchange strength available. 2015-08-18 22:09:27 +00:00
ssl_txt.c
t1_enc.c Simplify handshake hash handling. 2015-08-07 01:47:21 +00:00
t1_lib.c Server-side OCSP stapling support. 2015-08-20 17:55:31 +00:00
tls_record.c Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00