openssl/ssl/record
Maxim Mikityanskiy cd715b7e7f Add support for KTLS zerocopy sendfile on Linux
TLS device offload allows to perform zerocopy sendfile transmissions.
FreeBSD provides this feature by default, and Linux 5.19 introduced it
as an opt-in. Zerocopy improves the TX rate significantly, but has a
side effect: if the underlying file is changed while being transmitted,
and a TCP retransmission happens, the receiver may get a TLS record
containing both new and old data, which leads to an authentication
failure and termination of connection. This effect is the reason Linux
makes a copy on sendfile by default.

This commit adds support for TLS zerocopy sendfile on Linux disabled by
default to avoid any unlikely backward compatibility issues on Linux,
although sacrificing consistency in OpenSSL's behavior on Linux and
FreeBSD. A new option called KTLSTxZerocopySendfile is added to enable
the new zerocopy behavior on Linux. This option should be used when the
the application guarantees that the file is not modified during
transmission, or it doesn't care about breaking the connection.

The related documentation is also added in this commit. The unit test
added doesn't test the actual functionality (it would require specific
hardware and a non-local peer), but solely checks that it's possible to
set the new option flag.

Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Boris Pismenny <borisp@nvidia.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18650)
2022-11-24 13:19:37 +01:00
..
methods Add support for KTLS zerocopy sendfile on Linux 2022-11-24 13:19:37 +01:00
build.info Move declarations out of record.h and record_local.h 2022-11-14 07:51:17 +00:00
rec_layer_d1.c Resolve a TODO in ssl3_dispatch_alert 2022-11-14 10:14:41 +01:00
rec_layer_s3.c Resolve a TODO in ssl3_dispatch_alert 2022-11-14 10:14:41 +01:00
record_local.h Move declarations out of record.h and record_local.h 2022-11-14 07:51:17 +00:00
record.h Move declarations out of record.h and record_local.h 2022-11-14 07:51:17 +00:00
recordmethod.h Remove some unused OSSL_RECORD_METHOD functions 2022-10-27 10:52:52 +01:00