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=QYzbrYy7Q+X2Kt6V0w99PFyTG4VvrbLKQWNFw/M42nM/2Af6tMxwItNMJYZfDR8jECZB 9MMOPByKXqFRSbBXq/Uy0J8SpaokQhDSGFIjk0LJvEco1CeTo9Af6zR/rnj/Fdy1V5LzN 3ffJuXxw9Wz5wO4ZK710vqK72XAr8K5w4r9SUbCuckMjnPu/mdWRaStHcol350vtkzG5w ncN//jlu5mhXMHmHu9/YqPXEm5r5HfKVLNZTtqGGKOUoYnWKfaGCxZndbTh6kMO5Xzjgy uHI8z1P5yR72hmAKrCtLc6FQcmPqzrZRz8rwc9ivDhZ3ax2mQaFCY+kdUT2mDE/7ojg== 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=pJQZbs7cfZ6W9VnIRQbkUSqS0sMDWsvpOr6/xFR70DUrl5GlTMwx2yRJNaeIibSJacfJ NS6D2Dpay+4khJVq0yBLjOq1GFtSHpFJRk35tIWoKXZuP79A7mGgtSXzCHNVwBOVUbHQT KuzuOd42rZlv/ddLNz/egcAReEdXrsU2mwQwR9H9o4Rvh9cmlW9yI2et29SOGOtjpinHp NFJFk8ZLsS5QKtBVNC0PIajtBjnsj5bTXbaKv30yVOeuNNSD33W4CnHK+sxGPOM1zLZWw u31Z+sRBj4m/u5r75PNKoguM5ROvaTJdge0VpE5VIXm81pwRu/NAOb/3wbqvxe+gH5w== 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=f0oyoVEZ; 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 5AF06606A68E; 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=f0oyoVEZ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EB4E1F00897; 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=1796237506; bh=0mrhe0SOkE0bphZxHTKDvRoNo1u/DxEvhGT6fmCHumQ=; h=Date:From:To:Cc:In-Reply-To:References:Subject; b=f0oyoVEZ8jG53OuZ5LNkyezwTfxkTNGgZ2VgS0kYpDxuzKKVx+58FOm6LFx1HLdCC mS7PkJ6Nsi8jhCyfBIBlP3RA5SLvY9LGXM+3F8MQNgFq/EcJn7AEbX/6Y08WyJLgb1 CsGk/uLB7Jfa5I7mdve7e18zQgD2bUS1wJfQJeH4jFJ3YR4PNaiU2rLyeM7VTWfxFs y4PSY+lhtK2jlZGAuiETQOMi6QyOssrqX4mYwijU97MCr7PTjGYhmOJQa9kspneq7H 5VM5ovxS+rklpR0F+ZPJENJKE4vORgB4SLh5eoUNtA8/7hRLXOjnGcDOh/RKHq+SQC c0o5KtJKqmIlQ== 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: netdev@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