Article View: linux.kernel.netdev
Article #27106Re: [PATCH net-next v6 0/6] tls: perform TLS 1.3 KeyUpdate in the kernel
From: Martin Belanger
Date: Fri, 04 Dec 2026 19:44
Date: Fri, 04 Dec 2026 19:44
57 lines
14221 bytes
14221 bytes
On 12/4/26 12:19, Sabrina Dubroca wrote: > I'm struggling to parse this and see what hooks into what. Sorry, here it is in terms of functions. When the handshake completes, net/handshake calls one inline helper from include/net/tls.h: tls_set_handshake_ops(sk, ops, priv, tx_rec_limit); It stores ops, priv and the limit in the tls_context. ops has three callbacks into net/handshake. From then on only kTLS calls; it calls them with the socket locked. RX: tls_check_pending_rekey() already finds received handshake records. If ops are set, it passes the record to ops->rx_record(). net/handshake parses the KeyUpdate and returns flags: "consumed", "install the next RX key", "send a KeyUpdate". For the RX key, kTLS calls ops->next_key() and installs the result with tls_set_sw_offload(), as your user space rekey does. The record does not reach the consumer. TX: in tls_sw_sendmsg_locked(), before a new data record, kTLS checks two values inline: the "send a KeyUpdate" flag from above, and rec_seq >= tx_rec_limit. A normal record costs these two comparisons and no call. If either is true, kTLS calls ops->tx_record() for the KeyUpdate message, sends it as a handshake record with the current key, waits for the encryption, then calls ops->next_key() and installs the next TX key. > I wonder how you still get 200 lines in net/tls Counting C code only (no comments, no blank lines), it is 212 lines. What remains is record layer work that has to run inside kTLS, with tx_lock and the socket lock held: - TX: the KeyUpdate must go out at a record boundary, after the pending data record is closed, and the key switch must follow with no other record in between. This uses tls_sw_sendmsg_locked() and tls_encrypt_async_wait(). - RX: the KeyUpdate record must be taken out of the receive path (recvmsg, read_sock, splice_read) and the RX key installed before the next record is decrypted. - the ops struct, the context fields and the inline setter. net/handshake decides and computes: when to send, the message, HKDF, the next secrets. It cannot do the sending or the key switch itself. Those steps need kTLS's static functions and kTLS's locks. Also, net/handshake is built in and TLS can be a module, so net/handshake can only reach kTLS through inline helpers or callbacks. If code is easier to review, I can post the prototype as an RFC. Martin
Technical Details
Message-ID:
<34853fe3-1c08-4d05-967b-cb43275532a4@gmail.com>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377590-linux-kernel-netdev=dewy.ruReferences:
<20261105-keyupdate-rfc-v6-0-99b695f9eb4f@gmail.com> <au5JP__7P_PzwDUe@krikkit> <7f9b7ab9-9728-42be-a5c1-9e8e62c23ab9@gmail.com> <aw6-EhjhIh5TuHIt@krikkit> <f198d112-d8b1-455c-932a-e191b441a2ec@gmail.com> <axL2DV43klkpbqiY@krikkit>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377590-linux-kernel-netdev=dewy.ru
From: martin.nvme.dev@gmail.com (Martin Belanger)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v6 0/6] tls: perform TLS 1.3 KeyUpdate in the
kernel
Date: Fri, 4 Dec 2026 14:44:44 -0500
Organization: Usenet Network
Message-ID: <34853fe3-1c08-4d05-967b-cb43275532a4@gmail.com>
References: <20261105-keyupdate-rfc-v6-0-99b695f9eb4f@gmail.com>
<au5JP__7P_PzwDUe@krikkit> <7f9b7ab9-9728-42be-a5c1-9e8e62c23ab9@gmail.com>
<aw6-EhjhIh5TuHIt@krikkit> <f198d112-d8b1-455c-932a-e191b441a2ec@gmail.com>
<axL2DV43klkpbqiY@krikkit>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="2847795"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:KDJWeT0/PeEsH6y7qljJOZwMm9A= sha256:4ZeBrsrO5JRWPR4mwHPBy3t7XQVO/iXf4JfsiLnbo4k=
sha1:sifnf5A4xrPv+11eEmEcznNzOJM= sha256:rKCib8HKAbd9UpJ57JiZCY2pGgHkIOOZaH5B5gsXyS4=
Content-Language: en-US
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 5B35F117CBF; Fri, 4 Dec 2026 22:45:07 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.397
X-Spam-Status: No, score=-3.397 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
HEADER_FROM_DIFFERENT_DOMAINS=0.001, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id OUC51YxCfNzS;
Fri, 4 Dec 2026 22:45:04 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377590-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 99AD9117C8B; Fri, 4 Dec 2026 22:44:56 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 3D07C29C0A; Fri, 4 Dec 2026 19:44:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796413493;
b=SoKxEZqY5DmxF+6IaOnFn+Wn8gSgZ6Io4jcQLWnibwV+qbXLNyZ9KrP3ucgIMe07QJfe
CoB1UCrDDUJocg442h5qEM5DU8CtoQN4XHHInbP68dJhD1Hd1pqVQGukVJYnLzKvmFKRf
+lyP2ovSDBxGhfMqme0QQ11LcFWq6J2diKeSvMi2gg4GXnoNIMc5o99elQrbmRK97GQgF
WQp3XTcMz3DE7ohYbqYePJ3U+LJRc4g36XCVJN5nWgJhQEQmVuk4DodmZDWIWtBSSuzIO
bWSowYDiKt1Cly4/Dt/6m/DniA/gatVN+Cofn1yNVZ+IOwffJolvBb4Tb0FiNktVPpQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796413493;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Message-ID:Date:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:User-Agent:Subject:To:Cc:References:
Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=KEkPT6xXVGhR8PxKcN3aBi5ZfiLJiy8HcM5Obg64jE4=;
b=gw1pIexjXo816azxGfBxxpbr6HLolyZcYloqjr6YyXMoK/Sfan5vaYGCekHvOG5J6bzr
02yi8DLQfnPymmeqTwiuBJXgBEBSriu2BgSCflDYf9HNBQR7l4xmBsqysm81XKHvU71J5
v3l5HV46A7k00I+3oCr0rdtJRzcUc7LwPw8xZIiR9wx9vAJBglWFVBoZXFTa47eeRcGl0
h3DeApYbtwQYL90izte8oTQYo6zH53x10EJPqrhCfRkTc+mpfv30iZjv6otXJOtOYsZaS
H/rMHv0XQdqlRc/SuDwkzsd3kETvdW1KbX0H7XE0gdd21VZLNkjS6TyEZGA2EdnOMNg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=IAOR3M1+;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 00868606A330;
Fri, 4 Dec 2026 19:44:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=IAOR3M1+
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.66
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796413487;
b=v8aLG0KE1eHopcsYOJmIybGt8rgrAWlZI1CwBS+K/L30tXamSqzJLWJRkhpYoZZJ1KjC
91vQdSTTAtmLVH4qZLpYTaSzfIhFU/oJgTRX8SQENdZABSOZUmW2KYsnhgDoMU8YXoff5
ome/98esOor1ay2EAE3Wxl06TAepAR5E9OJXGzBU2nG1GbugKpnqTuPkcgXJvixeM51n7
Om3yapbI7ZES5Q2EfBeVkTUg191Xelo3r8gTDjJKLnu+SyxrKPQweOQUoGq2sKdVi2ooz
K0xx4gynG0cJApExRbOkx22oKwECZj/KNVm0k34h8h14WmArThehPvkdUu4rVuowmJw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796413487;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:
Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=KEkPT6xXVGhR8PxKcN3aBi5ZfiLJiy8HcM5Obg64jE4=;
b=Amlo5dSgMJ6PLe6FfCkYJpEFx8EjN13/DzLJetzN5HUAWN0k+oLrf1RkrigWLQgJUVjr
gPOSPuKmCleKHmbLq/nMExcpZnhM8Gy/65+UR5Gi4HoEhHwGIdfTudU7Ig/QwW1PD9jf+
kBva9i3825phXbpJkGmKoD7eAm/zD9qWBpiu6MDR89Ycpf0W/spCZlzNT5xMSh0zNE/ZW
cavwTj0asbMg0D7PMlB3XTTWRFo0HClzcbzxVGJycb5lUEZ9xCEMLIum42W450bwzp3Vc
RK2aluQ7W6ckSkvMq8gt6+bTiqyBsIhTSmwrV3KYSSzlidBySwz7y9hdArXPY9XhF1w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=IAOR3M1+;
arc=none smtp.remote-ip=209.85.219.66
X-Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7632606A32C
for <netdev@vger.kernel.org>; Fri, 4 Dec 2026 19:44:46 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C7632606A32C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-qv1-f66.google.com with SMTP id 6a1803df08f44-91c847584b8so15156506d6.0
for <netdev@vger.kernel.org>; Fri, 04 Dec 2026 11:44:46 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1796413486; x=1797018286; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:user-agent:mime-version
:date:message-id:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=KEkPT6xXVGhR8PxKcN3aBi5ZfiLJiy8HcM5Obg64jE4=;
b=IAOR3M1+2NemHHuEEv1Rqb2WJBEOWZJiUktEsXJKOFf1W0pIMBQeWE7jnTjrrdCkgN
zzW4QPbnuKxNEM6DRRdnZVeXIblTtnYEK1ODOGLTQjMCGDlRXwg3IDwd1pb0fOOOGaiG
TG9K/O9erxnOK/tAMBx1qB+kRoyyCP2KdZe8vGx9te5Cp+cqb7Elzvv9PXTvi8deg9qn
ldc0eun1mUKTyNTF1opswUB22B4OTV3/vyww7RRDMSrJOJSByCjXBnvUEK2+v6mQT69v
mm20W7LIImy0f8PDbUPe+ETA3L6gokbfljxmYUp/ddOjloi8Z7OGnbXp3S0aEDcIL+dG
H3GQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796413486; x=1797018286;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:user-agent:mime-version
:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=KEkPT6xXVGhR8PxKcN3aBi5ZfiLJiy8HcM5Obg64jE4=;
b=UX5B960g0Y8DKDFlf7wm6nGJfbYMQ9bX1Bs0RGV1x0WSDXShIFkN+10fyDNlLC6aHi
9G9xlSKANjWTb/Kj0oRHrG+jAD6OpCe/UE5rNpLIvEHrm1CiaCWVdQZvMWIfb+whXBvd
07psuesAcGA1PtIPxtkln9UvBuzdyBoK43l/g6qZrW7KGAHXm+kiW/kcx2KBMZJaArFb
ZmxY7jBUs0oPs72XJrqx0V1dLRj1NjCLXxXZkW2Gi7vmArCNVHmLK3qdkY6aR8axARl5
LH/4IDECl1Y9csxZtE5Pz48YkQnfZAv2DNjeORbdYO0SbY6C62kfN7FVCLE4Vw23u724
m5ow==
X-Forwarded-Encrypted: i=1; AL+hErFFhebTAIgII2tWheOR6N+QHdJN61CzmVSvf3lWWXBwzmgf4qON2il69xEpFyuUbr6Bn/486yY=@vger.kernel.org
X-Gm-Message-State: AB4q+uHAgvniiKPnLOhAApPkd4wJCGWiCqbHvqDlSvlk4sHP2m28+6iR
7DK6xsrZ4lCIkEV0OgEFV1GICPBU43sVZZ5JxCscoM+Lc+wo1eaOyNRu
X-Gm-Gg: AZFdTZfgFkFP+BrvdeOK5aYcYps86hxGf3o1u3L2n3lKy5ffBkhjkABK4T+hP8jQrCH
KOjTULDDNYcDuIgc0XxxWwplFsroY/4AS7HoOZFG6Y5vedlP2DEQeV3QhVB57Y/jbtU0dV+tmgj
oTQWN1CKJs2lLTeKw5ln4LxiK1egEc8R5hEZ0kqoejdgsoV5tNAIP4WThWB96w/qDqfRePIUQ6D
69Vzbfk/lyLQCOEAeTKcuoyqqyvkCVLubxTAVZtlyN9+OPiC05RMCHiah3LYmSKSkheMwekko9W
IO/FycRGoaCsJece8uukMJGRMTkAfZz+9KDIR0Ls98R7WimgOvGRMjpQJJMmm28aQbIJviBEI9h
mnmSh8eos261TcBilppApMqDz9D3MSQN/AmpskQUBxLXR+7Ahmk6Gg1YwpPaxhWjbYC0FxF9Mpz
g4WtXwBedUOVerH9e/xFRQ8g6kBPkkKERlDv8jcT2VB/3CzZY/79DLdXlZ5iWh8xPSmvm8uuNff
txY1SxyIqD477nPIzn7x4aSkMtwfIzOZsri/TIJN1SIbUqqYcV7hOALx2ll28elYC5pxDMqRtHQ
gL2OtsWdWnwt8xBTQws+aPoHO4Lm5Tx2W1A=
X-Received: by 2002:a05:6214:2a49:b0:921:cac9:9bc4 with SMTP id 6a1803df08f44-921d4d927bfmr113284566d6.4.1796413485796;
Fri, 04 Dec 2026 11:44:45 -0800 (PST)
X-Received: from [10.0.0.48] ([71.69.222.122])
by smtp.gmail.com with ESMTPSA id 6a1803df08f44-921e05934e1sm30568096d6.24.2026.12.04.11.44.44
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 04 Dec 2026 11:44:45 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Cc: John Fastabend <john.fastabend@gmail.com>,
Jakub Kicinski <kuba@kernel.org>, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>, Randy Dunlap
<rdunlap@infradead.org>, Shuah Khan <shuah@kernel.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
Hannes Reinecke <hare@kernel.org>, Chuck Lever <cel@kernel.org>,
kernel-tls-handshake@lists.linux.dev, linux-nvme@lists.infradead.org,
Alistair Francis <alistair.francis@wdc.com>,
Martin Belanger <martin.belanger@dell.com>,
Daniel Pereira <danielmaraboo@gmail.com>
X-In-Reply-To: <axL2DV43klkpbqiY@krikkit>