Uploaded June 2025 | Updated November 2026, 2 hours ago
Fundamentals of Operating Systems Course
https://oscourse.win
ktls is brilliant.
TLS encryption/decryption often happens in userland. While TCP lives in the kernel.
With ktls, userland can hand the keys to the kernel and the kernel does crypto.
When calling write, the kernel encrypts the packet and send it to the NIC.
When calling read, the kernel decrypts the packet and handed it to the userspace.
This mode still taxes the host’s CPU of course, so there is another mode where the kernel offloads the crypto to the NIC device! Host CPU becomes free.
Incoming packets to the NIC are decrypted in device before they are DMAed to the kernel. outgoing packets are encrypted before they leave the NIC to the network.
ktls still need handshake to happen in userspace. There is also enabling zerocopy in some cases (now that kernel has context)
Deserves a video. So much good stuff.
0:00 Intro
2:00 Userspace SSL Libraries
3:00 ktls
6:00 Kernel Encrypts/Decrypts (TLS_SW)
8:20 NIC offload mode (TLS_HW)
10:15 NIC does it all (TLS_HW_RECORD)
12:00 Write TX Example
13:50 Read RX Example
17:00 Zero copy (sendfile)
docs.kernel.org/networking/tls-offload.html
NodeJS Internals and Architecture
https://node.win
Backend Troubleshooting Course
performance.husseinnasser.com
Fundamentals of Backend Engineering
https://backend.win
Fundamentals of Networking for Effective Backends udemy course (link redirects to udemy with coupon)
network.husseinnasser.com
Fundamentals of Database Engineering udemy course (link redirects to udemy with coupon)
database.husseinnasser.com
Follow me on Medium
medium.com/@hnasr/membership
Introduction to NGINX (link redirects to udemy with coupon)
nginx.husseinnasser.com
Python on the Backend (link redirects to udemy with coupon)
python.husseinnasser.com
Become a Member on YouTube
youtube.com/channel/UC_ML5xP23TOWKUcc-oAE_Eg/join
Buy me a coffee if you liked this
buymeacoffee.com/hnasr
Arabic Software Engineering Channel
youtube.com/channel/UChWZsjdoRvZ0T9QWZOD6UpA
🔥 Members Only Content
youtube.com/playlist?list=UUMO_ML5xP23TOWKUcc-oAE_Eg
🏭 Backend Engineering Videos in Order
backend.husseinnasser.com
💾 Database Engineering Videos
youtube.com/playlist?list=PLQnljOFTspQXjD0HOzN7P2tgzu7scWpl2
🎙️Listen to the Backend Engineering Podcast
husseinnasser.com/podcast
Gears and tools used on the Channel (affiliates)
🖼️ Slides and Thumbnail Design
Canva
partner.canva.com/c/2766475/647168/10068
Stay Awesome,
Hussein
Fundamentals of Operating Systems Course
https://oscourse.win
ktls is brilliant.
TLS encryption/decryption often happens in userland. While TCP lives in the kernel.
With ktls, userland can hand the keys to the kernel and the kernel does crypto.
When calling write, the kernel encrypts the packet and send it to the NIC.
When calling read, the kernel decrypts the packet and handed it to the userspace.
This mode still taxes the host’s CPU of course, so there is another mode where the kernel offloads the crypto to the NIC device! Host CPU becomes free.
Incoming packets to the NIC are decrypted in device before they are DMAed to the kernel. outgoing packets are encrypted before they leave the NIC to the network.
ktls still need handshake to happen in userspace. There is also enabling zerocopy in some cases (now that kernel has context)
Deserves a video. So much good stuff.
0:00 Intro
2:00 Userspace SSL Libraries
3:00 ktls
6:00 Kernel Encrypts/Decrypts (TLS_SW)
8:20 NIC offload mode (TLS_HW)
10:15 NIC does it all (TLS_HW_RECORD)
12:00 Write TX Example
13:50 Read RX Example
17:00 Zero copy (sendfile)
docs.kernel.org/networking/tls-offload.html
NodeJS Internals and Architecture
https://node.win
Backend Troubleshooting Course
performance.husseinnasser.com
Fundamentals of Backend Engineering
https://backend.win
Fundamentals of Networking for Effective Backends udemy course (link redirects to udemy with coupon)
network.husseinnasser.com
Fundamentals of Database Engineering udemy course (link redirects to udemy with coupon)
database.husseinnasser.com
Follow me on Medium
medium.com/@hnasr/membership
Introduction to NGINX (link redirects to udemy with coupon)
nginx.husseinnasser.com
Python on the Backend (link redirects to udemy with coupon)
python.husseinnasser.com
Become a Member on YouTube
youtube.com/channel/UC_ML5xP23TOWKUcc-oAE_Eg/join
Buy me a coffee if you liked this
buymeacoffee.com/hnasr
Arabic Software Engineering Channel
youtube.com/channel/UChWZsjdoRvZ0T9QWZOD6UpA
🔥 Members Only Content
youtube.com/playlist?list=UUMO_ML5xP23TOWKUcc-oAE_Eg
🏭 Backend Engineering Videos in Order
backend.husseinnasser.com
💾 Database Engineering Videos
youtube.com/playlist?list=PLQnljOFTspQXjD0HOzN7P2tgzu7scWpl2
🎙️Listen to the Backend Engineering Podcast
husseinnasser.com/podcast
Gears and tools used on the Channel (affiliates)
🖼️ Slides and Thumbnail Design
Canva
partner.canva.com/c/2766475/647168/10068
Stay Awesome,
Hussein










