boringssl/include/openssl
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
..
aead.h Add EVP_AEAD_CTX_zero. 2015-08-24 23:37:58 +00:00
aes.h Fix documentation typo. 2015-07-01 21:33:29 +00:00
arm_arch.h Move arm_arch.h and fix up lots of include paths. 2015-08-26 01:57:59 +00:00
asn1_mac.h Prune away (almost) all of asn1_mac.h 2015-04-08 20:42:57 +00:00
asn1.h Drop DEFINE_STACK_OF. 2015-08-05 21:30:08 +00:00
asn1t.h Remove last references to named locks. 2015-05-20 19:18:30 +00:00
base64.h Various documentation fixes. 2015-01-14 21:50:50 +00:00
base.h base.h: add typedefs from x509.h, and sort them. 2015-08-03 21:25:22 +00:00
bio.h Drop DEFINE_STACK_OF. 2015-08-05 21:30:08 +00:00
blowfish.h Add decrepit, initially containing CAST and Blowfish. 2015-04-06 16:58:45 -07:00
bn.h Re-add |BN_bn2mpi| and |BN_mpi2bn| from OpenSSL at fd682e4c. 2015-08-18 23:49:31 +00:00
buf.h Get rid of err function codes. 2015-07-16 02:02:08 +00:00
buffer.h Add buffer.h for compatibility. 2015-05-12 00:09:57 +00:00
bytestring.h Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00
cast.h Add decrepit, initially containing CAST and Blowfish. 2015-04-06 16:58:45 -07:00
chacha.h Fix shared library build. 2015-07-10 18:59:49 +00:00
cipher.h Re-add |EVP_des_ede|, which is ECB. 2015-08-20 21:33:21 +00:00
cmac.h Add support for CMAC (RFC 4493). 2015-05-07 21:13:41 +00:00
conf.h Get rid of err function codes. 2015-07-16 02:02:08 +00:00
cpu.h Replace cpuid assembly with C code. 2015-07-20 18:59:44 +00:00
crypto.h Include thread.h from crypto.h, like OpenSSL. 2015-08-05 21:25:23 +00:00
des.h Clean up the DES_key_schedule logic. 2015-08-07 01:55:59 +00:00
dh.h Fix pub_key comment in dh.h. 2015-08-17 20:32:51 +00:00
digest.h Get rid of err function codes. 2015-07-16 02:02:08 +00:00
dsa.h Get rid of err function codes. 2015-07-16 02:02:08 +00:00
dtls1.h Opaquify DTLS structs. 2015-05-08 18:02:02 +00:00
ec_key.h Fix o2i_ECPublicKey documentation. 2015-07-20 20:39:43 +00:00
ec.h Get rid of err function codes. 2015-07-16 02:02:08 +00:00
ecdh.h Get rid of err function codes. 2015-07-16 02:02:08 +00:00
ecdsa.h Get rid of err function codes. 2015-07-16 02:02:08 +00:00
engine.h Convert reference counts in crypto/ 2015-05-20 19:15:26 +00:00
err.h ERR_LIB_USER should be the last error. 2015-07-16 02:03:03 +00:00
evp.h Revert "pound-define EVP_R_BAD_DECRYPT CIPHER_R_BAD_DECRYPT." 2015-08-05 12:16:11 -07:00
ex_data.h Correct various documentation typos 2015-06-10 22:06:01 +00:00
hkdf.h Get rid of err function codes. 2015-07-16 02:02:08 +00:00
hmac.h Remove HMAC_CTX_set_flags. 2015-06-02 01:07:07 +00:00
lhash_macros.h Remove hash table lookups from ex_data. 2015-04-15 23:59:35 +00:00
lhash.h Fix some typos in license headers. 2015-07-29 19:23:51 +00:00
md4.h Fix some typos in license headers. 2015-07-29 19:23:51 +00:00
md5.h Fix some typos in license headers. 2015-07-29 19:23:51 +00:00
mem.h Fix some typos in license headers. 2015-07-29 19:23:51 +00:00
modes.h Add visibility rules. 2014-07-31 22:03:11 +00:00
obj_mac.h Remove fake RLE compression OID. 2015-05-27 21:49:39 +00:00
obj.h Get rid of err function codes. 2015-07-16 02:02:08 +00:00
objects.h Move public headers to include/openssl/ 2014-07-14 22:42:18 +00:00
opensslfeatures.h Remove remaining remnants of RIPEMD-160 support. 2015-03-17 21:03:42 +00:00
opensslv.h Get version-related functions from crypto.h rather than ssl.h. 2015-05-20 22:58:14 +00:00
ossl_typ.h Move public headers to include/openssl/ 2014-07-14 22:42:18 +00:00
pem.h Get rid of err function codes. 2015-07-16 02:02:08 +00:00
pkcs7.h Move public headers to include/openssl/ 2014-07-14 22:42:18 +00:00
pkcs8.h pkcs8.c: Add PBES2 to list of password-based encryption methods. 2015-08-28 20:33:33 +00:00
pkcs12.h Move public headers to include/openssl/ 2014-07-14 22:42:18 +00:00
poly1305.h Fix shared library build. 2015-07-10 18:59:49 +00:00
pqueue.h Export pqueue functions. 2014-09-03 21:38:19 +00:00
rand.h Make methods of |RAND_SSLEay| do reasonable things. 2015-07-23 17:58:51 +00:00
rc4.h Fix up whitespace in headers for doc.go. 2015-04-08 17:32:55 -07:00
rsa.h Make |RSA_PSS_PARAMS| public. 2015-08-07 02:14:56 +00:00
safestack.h Rename safe_stack.h to safestack.h. 2015-02-20 23:33:48 +00:00
sha.h Low-level hash 'final' functions cannot fail. 2015-06-01 22:14:01 +00:00
srtp.h Store SRTP_PROTECTION_PROFILES as const. 2015-01-14 22:10:08 +00:00
ssl3.h Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00
ssl.h Factor out the buffering and low-level record code. 2015-08-28 22:01:02 +00:00
stack_macros.h Implement custom extensions. 2015-07-31 01:12:00 +00:00
stack.h Drop DEFINE_STACK_OF. 2015-08-05 21:30:08 +00:00
thread.h Readd CRYPTO_{LOCK|UNLOCK|READ|WRITE}. 2015-05-27 15:48:29 -07:00
time_support.h Eliminate unnecessary includes from low-level crypto modules. 2015-04-13 20:49:18 +00:00
tls1.h Remove DHE_RSA_WITH_CHACHA20_POLY1305. 2015-08-24 23:35:25 +00:00
type_check.h Try to fix MSVC and __STDC_VERSION__ again. 2015-05-20 13:42:12 -07:00
x509_vfy.h Remove remaining calls to the old lock functions. 2015-05-20 19:18:13 +00:00
x509.h Don't define typedefs twice. 2015-08-05 05:35:23 +00:00
x509v3.h Get rid of err function codes. 2015-07-16 02:02:08 +00:00