Fix TLS 1.3 seal logic.
Check against the write encryption state, not the read state.
Change-Id: Ib3d8e02800e37bd089ef02c67a0b7e5dc009b1a5
Reviewed-on: https://boringssl-review.googlesource.com/8330
Reviewed-by: Nick Harper <nharper@chromium.org>
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/ssl/tls_record.c b/ssl/tls_record.c
index e1553e3..f1e866f 100644
--- a/ssl/tls_record.c
+++ b/ssl/tls_record.c
@@ -360,7 +360,7 @@
/* TLS 1.3 hides the actual record type inside the encrypted data. */
if (ssl->s3->have_version &&
ssl3_protocol_version(ssl) >= TLS1_3_VERSION &&
- ssl->s3->aead_read_ctx != NULL) {
+ ssl->s3->aead_write_ctx != NULL) {
size_t padding = SSL3_RT_HEADER_LENGTH + 1;
if (in_len > in_len + padding || max_out < in_len + padding) {