From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796237506; b=uRxvCgpcLCbZrY8Lwj4sJ4fSjzQuO3TdvmWoWAS+xmQvqeqbbPmmhGwYPlkNg5m/VQtf 0DSCvMVXIgJD6ImHBDzwDCgKsSqEvLpn8q+s4bDzavKnzf5iCOGvoR3OxgUG5cIczeoEC LoF9HFAmizl6Wt9W2lQ/1rMEifAZiZXLpUtTMWm+EzbtJC4I1uV0m6bdHcAB/5GDz1Wj5 gZ9Imcnxf5XB4BN242+iITAlXlp1t1bzE3vtfZ/y1r/yMphRiWoqjt0ns7CKebWcrWmuf PFfvHH6vfyHoaZe97p9tefDI0duLFzg0iPeYbz8XyqaiQPEE5D4yfKmklaj21mwJDgg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796237506; h=Received:DKIM-Signature:Received:Received:X-ME-Sender: X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:Received:X-Mailer: MIME-Version:X-ThreadId:Date:From:To:Cc:Message-Id:In-Reply-To: References:Subject:Content-Type:Content-Transfer-Encoding; bh=0mrhe0SOkE0bphZxHTKDvRoNo1u/DxEvhGT6fmCHumQ=; b=mIkxqAltnackZvKTfzgQiBVKHbNJBBZhEqjr6SpsHDLEXgodOdNBqu2p6toVWKkIl81v sJPhZLl/2y48yzkb6fuvk8aQeWKibD2v9Jt/P8XT78PXq5KX3M+7ABWe0mA0BSZoLAroG 20EJM1830w8zlrJtORYQi5P6bV2W18VyzrxmE9YzvkM2KorRGbtnBBOycr0LuW8+xyDLD j6xNhsX1SFwDOCyNJMpHRgQOcD29UyKhYTixj/o/D4E3Gfw90aLrxlmOb4b/jetKKHLah XXjNwSfTmhicmkUx/uPnCRvcqxaY2KNEjUwpA+Idr7h7wLcKMz/mI20Yo1jadI8w6Fw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="QoGWb3/8"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51F1A606A33C; Wed, 2 Dec 2026 18:51:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QoGWb3/8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6372E1F00893; Wed, 2 Dec 2026 18:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796237505; bh=0mrhe0SOkE0bphZxHTKDvRoNo1u/DxEvhGT6fmCHumQ=; h=Date:From:To:Cc:In-Reply-To:References:Subject; b=QoGWb3/8reECkyco3wnvOS82p8A+RUTwmnbiePqztqWCJecs/MTmP/yDsK3i/OaZq dC20rgm86Jg6UaYsdd4kata/LgIg73kPz9zrAxIFvvEzmMWZkWmQ9j5C0xXR38VDM2 sdPduLN02kgTZ96FXKfp9CkYdHXOsDWQwXY3iiikx169U8AH3b4xVkeALXNsV4Voun /ZZFQ2xHdTfD0eWB5oKtqK4xu0hbJtt7iFLB4zDF8KPultR1nxFogGBKOeRpGWHf/k v4NMcZOUo/hktblUwVNtve2rsJJecHGkHj7t9+L5h0q9bBHQvJW0Jqycd9ch7ojdEd gBikq6/4+i6rw== Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfauth.phl.internal (Postfix) with ESMTP id 9CB7FF40068; Wed, 2 Dec 2026 13:51:44 -0500 (EST) Received: from phl-imap-15 ([10.202.2.104]) by phl-compute-10.internal (MEProxy); Wed, 02 Dec 2026 13:51:44 -0500 X-ME-Sender: X-ME-Proxy-Cause: dmFkZTGcq+RibXV6vKgIpqAO9KOol8ABC12W+1Nt2kFVxsZn6U8w9qSffYBGcmOmkTFXl2 PBvz4Vxe1v5+slQjgnVkIy/skrTab8KM/LwEq8ddlXCiNRBgizq8+4Ho8Tt7ulYXcadfqt Y6wI88lczAPFS1NPXd8sWzKMW1DRwgMPkhbwL5axbdROcDd6NDZTHsaySgDGeuC+CkpQJT TjMgEpd+e9EuZeY2njJtaMEzvBQ4pV0w5KY27DZvfJUFH6L7Ae9EGjANaebKgZy1E+bHAk 40RWv/WQvbKI9H3AwCJybZNAvi4Cpf8nO3KigBdQmt+/CsYUxri/qstnlj/NcaAsV8XuoE 7RBR7cQfZSOqr3Zb9lp6xz2oWI0eE2qt1b9gSfSzHoZFCQpVOiPgUV46aQLqC0XJ1ybRbM W7k5sH0+kjqUFIEnA0kUeBTWGWwqmg5TcW7oM1axBWI8trfHJijDrrInoQ/xgbmFpqkSeL k5U0/wgI2JIY4n4dtT4PS6GEDn95KY2gtCGNyoDYvd576r3PZAywuBOHFQ9ERI8nswRf3U 2IBqi5voCr+Jx1DUtlqkOBR0cl/1whnBJYimKz3JT8TxQ0j/Vt33ieKPB4jsh68gQdmMW4 V+wztKEcfvPknS0YMT8FooifnycG53MiUNGcrV649RaY8hNXCojNpT+A9UjQ X-ME-Proxy: Feedback-ID: ifa6e4810:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 7174C780070; Wed, 2 Dec 2026 13:51:44 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-ThreadId: A1Jadd-yofGo Date: Wed, 02 Dec 2026 13:51:24 -0500 From: "Chuck Lever" To: "Martin Belanger" , "Sabrina Dubroca" Cc: "John Fastabend" , "Jakub Kicinski" , "David S. Miller" , "Eric Dumazet" , "Paolo Abeni" , "Simon Horman" , "Jonathan Corbet" , "Shuah Khan" , "Randy Dunlap" , "Shuah Khan" , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, "Hannes Reinecke" , kernel-tls-handshake@lists.linux.dev, linux-nvme@lists.infradead.org, "Alistair Francis" , "Martin Belanger" , "Daniel Pereira" Message-Id: <9afa5b2f-e3b4-42cc-9486-605547d8f0d9@app.fastmail.com> In-Reply-To: References: <20261105-keyupdate-rfc-v6-0-99b695f9eb4f@gmail.com> <7f9b7ab9-9728-42be-a5c1-9e8e62c23ab9@gmail.com> Subject: Re: [PATCH net-next v6 0/6] tls: perform TLS 1.3 KeyUpdate in the kernel Content-Type: text/plain Content-Transfer-Encoding: 7bit On Wed, Dec 2, 2026, at 10:37 AM, Martin Belanger wrote: > 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. Do you have a long-term plan for KeyUpdate for hardware offload? That's where we expect to win back some performance for NVMe and NFS when using full encryption. (I realize that kTLS's TLSv1.3 implementation does not yet support hardware offload). > 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? Not adding new socket options IMO is helpful, as that kind of kABI change can be difficult to coordinate. The netlink handshake protocol is fairly flexible about the addition of new attributes. The only concern is about dealing with mismatched tlshd and kernel versions with regard to KeyUpdate support. That typically involves just a little bit of extra complexity to sort. -- Chuck Lever