diff options
author | John Baldwin <jhb@FreeBSD.org> | 2022-02-24 10:12:07 -0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-04-06 13:15:27 +0200 |
commit | 85773128d0e80cd8dcc772a6931d385b8cf4acd1 (patch) | |
tree | ea03d88474e6837280b084a245f2637d3cb2e613 /ssl/tls13_enc.c | |
parent | dedb1927751bc9a7ada08cfc4dcc481b8ce1ad81 (diff) |
KTLS: Check for unprocessed receive records in ktls_configure_crypto.
KTLS implementations currently assume that the start of the in-kernel
socket buffer is aligned with the start of a TLS record for the
receive side. The socket option to enable KTLS specifies the TLS
sequence number of this initial record.
When read ahead is enabled, data can be pending in the SSL read buffer
after negotiating session keys. This pending data must be examined to
ensurs that the kernel's socket buffer does not contain a partial TLS
record as well as to determine the correct sequence number of the
first TLS record to be processed by the kernel.
In preparation for enabling receive kernel offload for TLS 1.3, move
the existing logic to handle read ahead from t1_enc.c into ktls.c and
invoke it from ktls_configure_crypto().
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17942)
Diffstat (limited to 'ssl/tls13_enc.c')
-rw-r--r-- | ssl/tls13_enc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ssl/tls13_enc.c b/ssl/tls13_enc.c index a9fcf12e93..32ce92f572 100644 --- a/ssl/tls13_enc.c +++ b/ssl/tls13_enc.c @@ -719,7 +719,8 @@ int tls13_change_cipher_state(SSL *s, int which) /* configure kernel crypto structure */ if (!ktls_configure_crypto(s, cipher, ciph_ctx, RECORD_LAYER_get_write_sequence(&s->rlayer), - &crypto_info, NULL, iv, key, NULL, 0)) + &crypto_info, which & SSL3_CC_WRITE, iv, key, + NULL, 0)) goto skip_ktls; /* ktls works with user provided buffers directly */ |