[RFC v2 0/1] net/tls: add support for limiting the max record size

Wilfred Mallawa posted 1 patch 1 month, 3 weeks ago
Documentation/netlink/specs/handshake.yaml |  3 +++
include/net/tls.h                          |  2 ++
include/uapi/linux/handshake.h             |  1 +
net/handshake/genl.c                       |  5 ++--
net/handshake/tlshd.c                      | 29 +++++++++++++++++++++-
net/tls/tls_sw.c                           |  6 ++++-
6 files changed, 42 insertions(+), 4 deletions(-)
[RFC v2 0/1] net/tls: add support for limiting the max record size
Posted by Wilfred Mallawa 1 month, 3 weeks ago
From: Wilfred Mallawa <wilfred.mallawa@wdc.com>

During a handshake, an endpoint may specify a maximum record size limit.
Currently, the kernel defaults to TLS_MAX_PAYLOAD_SIZE (16KB) for the
maximum record size. Meaning that, outgoing records from the kernel
can exceed the negotiated size during a handshake. In such a case,
the TLS endpoint must send a fatal "record_overflow" alert [1], and
thus the record is discarded.

Upcoming Western Digital NVMe-TCP hardware controllers implement TLS
support. For these devices, supporting TLS record size negotiation is
necessary because the maximum TLS record size supported by the controller
is less than the default 16KB currently used by the kernel.

This patch adds support for retrieving the negotiated record size limit
during a handshake, and enforcing it at the TLS layer such that outgoing
records are no larger than the size negotiated. This patch depends on
the respective userspace support in tlshd [2] and GnuTLS [3]. GnuTLS
patches have been merged.

[1] https://www.rfc-editor.org/rfc/rfc8449
[2] https://github.com/oracle/ktls-utils/pull/112
[3] https://gitlab.com/gnutls/gnutls/-/merge_requests/2005

Wilfred Mallawa (1):
  net/tls: allow limiting maximum record size

 Documentation/netlink/specs/handshake.yaml |  3 +++
 include/net/tls.h                          |  2 ++
 include/uapi/linux/handshake.h             |  1 +
 net/handshake/genl.c                       |  5 ++--
 net/handshake/tlshd.c                      | 29 +++++++++++++++++++++-
 net/tls/tls_sw.c                           |  6 ++++-
 6 files changed, 42 insertions(+), 4 deletions(-)

-- 
2.50.1