🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25864

Re: [PATCH net-next v6 0/6] tls: perform TLS 1.3 KeyUpdate in the kernel

#25864
From: Martin Belanger
Date: Wed, 02 Dec 2026 15:37
73 lines
14747 bytes
Hi Sabrina,

Welcome back, and thank you for the review.


On 12/1/26 07:31, Sabrina Dubroca wrote:
> I think almost all of it could be in net/handshake.

I agree. Here is a proposal along that line. I would like your view
before I post patches.

> Stealing handshake messages under a full TLS implementation's feet
> doesn't seem right.

No new socket options. TLS_TX_TRAFFIC_SECRET, TLS_RX_TRAFFIC_SECRET
and TLS_TX_KEY_UPDATE go away. User space cannot give secrets to kTLS,
so kTLS never takes KeyUpdate away from a TLS library. Libraries keep
the rekey support you added.

This is less than v6 offered. Only kernel consumers (nvme-tcp,
nvmet-tcp, sunrpc) get KeyUpdate in the kernel. User-space TLS
libraries such as GnuTLS and OpenSSL get nothing new from this. They
keep doing KeyUpdate themselves, as today.

KeyUpdate moves to net/handshake. tlshd passes the traffic secrets in
the DONE command. net/handshake keeps them and does all the TLS 1.3
parts: HKDF-Expand-Label, the KeyUpdate message, the update_requested
state, and the choice of the record limit. The consumers (nvme-tcp,
nvmet-tcp, sunrpc) do not change.

kTLS gives three record layer services to net/handshake.
net/handshake registers for them on the socket when the handshake
completes:

1. kTLS shows each received handshake record to net/handshake.
   net/handshake consumes a KeyUpdate. Any other handshake message
   goes to the consumer as today.
2. Before the next data record, kTLS sends a KeyUpdate from
   net/handshake, with the current key. kTLS does this when a reply is
   pending (net/handshake set this flag when it processed the received
   KeyUpdate) or when rec_seq reaches a limit that net/handshake set.
   Both are plain checks in kTLS: there is no call into net/handshake
   for each record.
3. At a record boundary, kTLS installs the next key that net/handshake
   derives, through tls_set_sw_offload(), the same path as your
   rekey. The sequence number restarts at 0.

kTLS has no secrets, no HKDF and no KeyUpdate logic. As in v6, this is
for the software path only.

I have a working prototype. kTLS gets about 210 lines of code, instead
of about 400 in v6. net/handshake gets about 230. I tested NVMe/TCP
host and target with AES-128-GCM and AES-256-GCM, with and without
update_requested, and with a KeyUpdate every 20000 records to make
them frequent. The data read back matched the data written.

Testing: the v6 selftests register the secrets from user space. That
is not possible without the socket options. I plan KUnit tests in
net/handshake, which already has KUnit tests. I have not checked yet
how well KUnit can drive a kTLS socket pair. If you prefer another
way, please tell me.

> If we end up going further with this approach, please CC some crypto
> folks on at least the first patch

I will Cc the lib/crypto maintainers and Herbert Xu.

Chuck, this adds attributes to the DONE command and per-socket state
to net/handshake. Is that acceptable for you?

Thanks,
Martin
Technical Details
Message-ID: <f198d112-d8b1-455c-932a-e191b441a2ec@gmail.com>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375913-linux-kernel-netdev=dewy.ru
References: <20261105-keyupdate-rfc-v6-0-99b695f9eb4f@gmail.com> <au5JP__7P_PzwDUe@krikkit> <7f9b7ab9-9728-42be-a5c1-9e8e62c23ab9@gmail.com> <aw6-EhjhIh5TuHIt@krikkit>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375913-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: Wed, 2 Dec 2026 10:37:16 -0500
Organization: Usenet Network
Message-ID: <f198d112-d8b1-455c-932a-e191b441a2ec@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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2000843"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:7TQTivRj00yi4LGvJt6eyw3n1Tg= sha256:WYRYKz16ic5aVDVNyl9FTwBMzaLwTGu1AsihJ88y6Q4=
	sha1:d49Oc918w7VndbQOW7bBlB7GGFI= sha256:56fFoPZMO2lbGqM4nH8ij53X7fIBhMDNnrODnSfVjic=
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 39C1411769E; Wed,  2 Dec 2026 18:37:37 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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.249,
	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 kXVCXZ0zYcaH;
	Wed,  2 Dec 2026 18:37:34 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-375913-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id ED96F117698; Wed,  2 Dec 2026 18:37:25 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id B540E24F2C; Wed,  2 Dec 2026 15:37:23 +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=1796225839;
	b=LBZQWoQ4AP/cdMnaTeOk5fBs+kpUVf0mNfDWh41DLpaW/NWVwnMhJH9jfobfpBGweg1X
	 q42yHre6kd972FJwnN6C/cLDgQYBprn+DIA+IXmYnDWZv70ktWj/Ae+CsprUCxgwxa982
	 XmiItSK39r8i/WcRSHSdJStebooZGh5RL8ftm4P76Iml3LpPHDakSjDlYfziR88Y9Tq/I
	 2zAAXtCqRlWm4TuKMnOPEdFULJTkkULhV9jYAF088SjDjA/niUQu9jE4TXRkGpAKdTJMn
	 HjzTY/r0p6WjjlkF3gfqoZMzwtrEDPkRDfpqadsl6nOUE5KjwqRUxxYTLGzZAHuTkjw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796225839;
	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=F2wRZy+jfXwd1hOgae58aXsiZQ2tH0hmCreJWg5Q5XI=;
	b=cU68wZxivnOT9EOjIq8yQgqk0Q4FD3nJ/arEc5h+i/r9s7IwcejIyL+wFfD3tLMwK0o5
	 ezf5InJRI+S/fihiN4THQ6pJ0uEa97RUG82sS4mxMmctGC1F4uNhy51dGemFUEw0Vq6gE
	 uU8DL4CDHWk8en1PwfppKpgmr2GrIRC6s4kIsqPKej+el0IYoCKTY9U5ZDiDVJcPi5NxR
	 mVCi/NIMjkErSniMp3d8wqOdKT91fTCYdgpZji454if5iJ34ja9EGjq2lX9dhrLKvEgPY
	 jB/HipdqUGyDWgv/yX0A0Vd5CC66XIjaZBf8UFX6lktFo9ycvwRW7UjXBzFd6Y4Cf+g==
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=pTNGXatv;
	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 BBA2D606A336;
	Wed,  2 Dec 2026 15:37:19 +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=pTNGXatv
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.224.138
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796225838;
	b=3i6yHiZHK0LG1ANP3F7vAE1kCTIap9QS6ISBtGO68xuy50l0iLOpqQjvaJNJpasvuBC2
	 KOMGFUDd9cXE+wZL/OmbDQcXmP31cTN6daHqfWdT2PE/QX0RoT8rKXku6dJiQEi9IGjkU
	 fGQzaDi6u5RxYp3sQXGsvM0rq1i7N6M2Fqt9D+2DRX43pzg65q1Oj6ac0aKqy2/upqFFz
	 /dWAFniuqQqhcBcYjLjHsPW19/QEjFMIREXWTu05XS5kEbuJQ1xHglrUbKoJWtYXdlmUB
	 q8N8Gc+LbAPOsLA+9lgFIISse2vB95Dj2MwayYn62D+7V/U/a4p1y72Zb3eMWEqbqIA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796225838;
	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=F2wRZy+jfXwd1hOgae58aXsiZQ2tH0hmCreJWg5Q5XI=;
	b=X0l+kTodf0t8OMT3zHeP7rtpEUnRGjI5KB5qYoWO+tIgfqU5VhIW6tJPdglQNV7kiKAq
	 HniktDvRMIU6Tqm6obTSpZ8wkhtCGGYZeBP7yj6qCHdIVSPMQaOu6Bd+3KokZdPNcDeug
	 XCOc3ZLa2wbR9DcZjMNZeguWpjp4vwZMn5rqX8w8x8mux1epnF5nF3h4LSMXLa54na4aD
	 r3BLnhrD/Ml9Q/Iu1Sw9OTkKYd+aZPNJxWCtfPOIqQGDG3S/ld7FZM6IJyxCIwDNJNKmq
	 5/jGA0NMPzkbqqFiUAgdmRewApa5oQHAxYOfwBoJ1FBaeCvUiOiEO9qyTmcS+Y4dLfw==
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=pTNGXatv;
	arc=none smtp.remote-ip=74.125.224.138
X-Received: from mail-yx2-f10.google.com (mail-yx2-f10.google.com [74.125.224.138])
	(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 9134C606A327
	for <netdev@vger.kernel.org>; Wed,  2 Dec 2026 15:37:18 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9134C606A327
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-yx2-f10.google.com with SMTP id 00721157ae682-8b2fa622fddso31158567b3.0
        for <netdev@vger.kernel.org>; Wed, 02 Dec 2026 07:37:18 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796225837; x=1796830637; 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=F2wRZy+jfXwd1hOgae58aXsiZQ2tH0hmCreJWg5Q5XI=;
        b=pTNGXatvcK0xrK3FcnyKD2uOHBP4948UbLLyVi6G+OKm8Da3wwiI6/9dfG3aBTkQM6
         VMMzmv84ft73Y8gKzaP13NRKdqu9cYZ+D+KHE3A2yBGrMHL5BeSfXAGflDUKv1nSb9IH
         xDd2Sg0HGxA8RT2C6920WNGMHafKkrOxYJB8FsryM7UmTZKhFaYzABoBEgMJq4EeKZDC
         +aLlMKvSsgcw8VT5f0UKM4Mw90g3QQL/80cy75B8daoaMBLTetAXAc47i/5UI+pD/47m
         dOMH9cx9zGWM1wYctSbpkjrt0ni0WAJgx8khUQp4KteQGnNqqYlQEhUPWc/93FZT8l68
         VtUA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796225837; x=1796830637;
        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=F2wRZy+jfXwd1hOgae58aXsiZQ2tH0hmCreJWg5Q5XI=;
        b=pJO0Ckhr8UbwyUHHQ6JSPgzkagqV7uUGvphqMa+JgqC80550z7uMMfLFRGNRRaW35D
         RXppu3BUm+tz7c3upQRyJ4PwQeFvEZsSVFUJryhlxyztVNE6KB00YTbkBM1DoF3/E2R8
         GO1FZFiTZn4IvKzB5LFjynlUBzS+fhG2TOqusXFcCHHhxXEBB2TmYwKS3Vz3McbLx73D
         683NJfECEWL5rNwZ7dYAnf+HrROz4Nuz+clXBzg5ZsJ6vxdBESzJSJh3ELJ12Rcn/Op+
         +l7hRSPuLT6NZbg4+65ZWKZ8hmGfe3cN3qPM0Bz2mpO8v6Iz+b4CkV2GxM8n9D4tQMXP
         8hyA==
X-Forwarded-Encrypted: i=1; AL+hErFilgn6F4aDh4AKtnBr6ZRTWtrfQZ9vviyP7t/hoLVK+CCZcxUUKHJYdYsRTTx/g+1ucfG1gas=@vger.kernel.org
X-Gm-Message-State: APuU4Z8SZJgKoSPqgMASnzuNdz6ls2DraErMpj1bib+2hacEdg2hrE3f
	WcwKaCq0zRAU7d9XWQlhVOJ9rIZM7Mr861QC48uQaQu2ZRWo7k2KkxDy
X-Gm-Gg: AZFdTZcBooc+8kNqwxHq+hpb8Iu8xcy2pEbXnBuqrBHT5jW6U+9hMOZbYp/fauQiDly
	fK3GUuQ+EaHmTowga7idsjU161SruYUovfNOwxokNyagax3GT4KjXvR+CWal4+vMFX9xL5a9C6u
	ZzRas2NH4Ec/7ERQeSwAWkKoBVw2MFnem87s9yZmSkN3gDe6xR5FSfyplwmm0cNUrxT5297J4UE
	xIOtYzcSPilRhGNSDM5teuwqWW4Ju0a7zfJUBIvkf5LlAXDIJCIRC1h3Myn3ttMknbRh+dOHa4U
	H3+3pTbQRJzCXxsSFeZi/8N4+6ajXa16vHhjkd2d8S0LhcSGDpMVrK1Vhmr4IDmoWoIHS/Np8VF
	U2tXuT6dnZmwLhJ6DZZnNNnAhLrRq5QZEINlQI98plXWCyluzXVXD3J207O5Qj81WipvNR7woOr
	X1I+v2BSmIsw+k+7Fw3fTA/MQgegfPCu+suIzfq+o4AcLUW5Z9+TXS1QtKTJdJaSuoeoIVVftg4
	gY0j8QuQPF3OPuiTwJgaaQ8k4G8sS5O6jnlExcM6MLh6K9BB2JKW8TQJtro1dChu+1Di/Iza1Yl
	QG5s04FCHpI5g+vNb33bO/nYKRh58diLTA==
X-Received: by 2002:a05:690c:9a05:b0:8b4:dc54:1d3a with SMTP id 00721157ae682-8b520329966mr181774257b3.8.1796225837330;
        Wed, 02 Dec 2026 07:37:17 -0800 (PST)
X-Received: from [10.0.0.48] ([71.69.222.122])
        by smtp.gmail.com with ESMTPSA id 00721157ae682-8b5201b8cdbsm156599847b3.1.2026.12.02.07.37.16
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Wed, 02 Dec 2026 07:37:16 -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: <aw6-EhjhIh5TuHIt@krikkit>