diff options
author | David Benjamin <davidben@chromium.org> | 2015-03-03 22:20:26 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-05-21 20:59:15 +0300 |
commit | 31a07798a54289614d71f71ca591b9ed0de0b955 (patch) | |
tree | 579bd9c055cca95f2df379b1c980c3e687a54a01 /ssl/d1_both.c | |
parent | 69d07d9cf433a8cb3bf1947fcce4ce835faadb3b (diff) |
Factor SSL_AEAD_CTX into a dedicated type.
tls1_enc is now SSL_AEAD_CTX_{open,seal}. This starts tidying up a bit
of the record-layer logic. This removes rr->input, as encrypting and
decrypting records no longer refers to various globals. It also removes
wrec altogether. SSL3_RECORD is now only used to maintain state about
the current incoming record. Outgoing records go straight to the write
buffer.
This also removes the outgoing alignment memcpy and simply calls
SSL_AEAD_CTX_seal with the parameters as appropriate. From bssl speed
tests, this seems to be faster on non-ARM and a bit of a wash on ARM.
Later it may be worth recasting these open/seal functions to write into
a CBB (tweaked so it can be malloc-averse), but for now they take an
out/out_len/max_out trio like their EVP_AEAD counterparts.
BUG=468889
Change-Id: Ie9266a818cc053f695d35ef611fd74c5d4def6c3
Reviewed-on: https://boringssl-review.googlesource.com/4792
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'ssl/d1_both.c')
-rw-r--r-- | ssl/d1_both.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/ssl/d1_both.c b/ssl/d1_both.c index 662f518f..f6442fd6 100644 --- a/ssl/d1_both.c +++ b/ssl/d1_both.c @@ -263,7 +263,6 @@ int dtls1_do_write(SSL *s, int type) { int ret; int curr_mtu; unsigned int len, frag_off; - size_t max_overhead = 0; /* AHA! Figure out the MTU, and stick to the right size */ if (s->d1->mtu < dtls1_min_mtu() && @@ -286,12 +285,7 @@ int dtls1_do_write(SSL *s, int type) { } /* Determine the maximum overhead of the current cipher. */ - if (s->aead_write_ctx != NULL) { - max_overhead = EVP_AEAD_max_overhead(s->aead_write_ctx->ctx.aead); - if (s->aead_write_ctx->variable_nonce_included_in_record) { - max_overhead += s->aead_write_ctx->variable_nonce_len; - } - } + size_t max_overhead = SSL_AEAD_CTX_max_overhead(s->aead_write_ctx); frag_off = 0; while (s->init_num) { |