|
NAMEktls —
kernel Transport Layer Security
SYNOPSISoptions KERN_TLS
DESCRIPTIONThektls facility allows the kernel to perform Transport
Layer Security (TLS) framing on TCP sockets. With
ktls , the initial handshake for a socket using TLS is
performed in userland. Once the session keys are negotiated, they are provided
to the kernel via the TCP_TXTLS_ENABLE and
TCP_RXTLS_ENABLE socket options. Both socket options
accept a struct tls_enable structure as their argument.
The members of this structure describe the cipher suite used for the TLS
session and provide the session keys used for the respective direction.
Modesktls can operate in different modes. A given socket may
use different modes for transmit and receive, or a socket may only offload a
single direction. The available modes are:
TransmitOnce TLS transmit is enabled by a successful set of theTCP_TXTLS_ENABLE socket option, all data written on
the socket is stored in TLS records and encrypted. Most data is transmitted in
application layer TLS records, and the kernel chooses how to partition data
among TLS records. Individual TLS records with a fixed length and record type
can be sent by
sendmsg(2)
with the TLS record type set in a TLS_SET_RECORD_TYPE
control message. The payload of this control message is a single byte holding
the desired TLS record type. This can be used to send TLS records with a type
other than application data (for example, handshake messages) or to send
application data records with specific contents (for example, empty
fragments).
TLS transmit requires the use of unmapped mbufs. Unmapped mbufs are not enabled by default, but can be enabled by setting the kern.ipc.mb_use_ext_pgs sysctl node to 1. The current TLS transmit mode of a socket can be queried via the
ReceiveOnce TLS receive is enabled by a successful set of theTCP_RXTLS_ENABLE socket option, all data read from the
socket is returned as decrypted TLS records. Each received TLS record must be
read from the socket using
recvmsg(2).
Each received TLS record will contain a TLS_GET_RECORD
control message along with the decrypted payload. The control message contains
a struct tls_get_record which includes fields from the
TLS record header. If an invalid or corrupted TLS record is received,
recvmsg(2)
will fail with one of the following errors:
The current TLS receive mode of a socket can be queried via the
Sysctl Nodesktls uses several sysctl nodes under the
kern.ipc.tls node. A few of them are described below:
BackendsThe base system includes a software backend for theTCP_TLS_MODE_SW mode which uses
crypto(9)
to encrypt and decrypt TLS records. This backend can be enabled by loading the
ktls_ocf.ko kernel module.
The
cxgbe(4)
and
mlx5en(4)
drivers include support for the The
cxgbe(4)
driver includes support for the Supported LibrariesOpenSSL 3.0 and later include support forktls . The
security/openssl-devel port may also be built with
support for ktls by enabling the
KTLS option. OpenSSL in the base system includes KTLS
support when built with WITH_OPENSSL_KTLS .
Applications using a supported library should generally work with
IMPLEMENTATION NOTESktls assumes the presence of a direct map of physical
memory when performing software encryption and decryption. As a result, it is
only supported on architectures with a direct map.
SEE ALSOcxgbe(4), mlx5en(4), tcp(4), src.conf(5), ifconfig(8), sysctl(8), crypto(9)HISTORYKernel TLS first appeared in FreeBSD 13.0.
Visit the GSP FreeBSD Man Page Interface. |