This feature is supported on ConnectX-6 Dx crypto cards only.
Transport Layer Security (TLS) is a widely-deployed protocol used for securing TCP connections on the Internet. TLS is also a required feature for HTTP/2, the latest web standard. Kernel implementation of TLS (kTLS) provides new opportunities for offloading the protocol into the hardware.
TLS data-path offload allows the NIC to accelerate encryption, decryption and authentication of AES-GCM. TLS offload handles data as it goes through the device without storing any data, but only updating context. If the packet cannot be encrypted/decrypted by the device, then a software fallback handles the packet.
Establishing a kTLS Connection
To avoid unnecessary complexity in the kernel, the TLS handshake is kept in the user space. A full TLS connection using the socket is done using the following scheme.
accept()on a standard TCP file descriptor.
- Use a user space TLS library to complete a handshake.
- Create a new KTLS socket file descriptor.
- Extract the TLS Initialization Vectors (IVs), session keys, and sequence IDs from the TLS library. Use the
setsockoptfunction on the kTLS file descriptor (FD) to pass them to the kernel.
- Use standard
splice()system calls on the KTLS FD.
Drivers can offer Tx and Rx packet encryption/decryption offload from the kernel into the NIC hardware. Upon receipt of a non-data TLS message (a control message), the kTLS socket returns an error, and the message is left on the original TCP socket instead. The kTLS socket is automatically unattached. Transfer of control back to the original encrypted FD is done by calling
getsockopt to receive the current sequence numbers, and inserting them into the TLS library.
- Make sure FreeBSD-13-current is installed and its kernel sources are newer than r362272. Run
Add the needed options to the kernel's configuration file.
Configuring kTLS Offloads
To enable kTLS Tx offload, run:
To disable kTLS Tx offload, run:
To build kTLS support in the userspace:
Install OpenSSL from /usr/ports/security/openssl.
Ensure the kTLS option is enabled - this option is not enabled by default.
Install a special version of iperf with SSL support.
Start iperf SSL enabled server.
Start iperf SSL enabled client.
Verify that TLS offloading is active by checking the following statistics.