From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.224.132 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796225838; b=nEEQmSf3WXBFy+wmWqwVXQlzZoaE0vhvD6kvPfXs4y2yyAZKvWWXeqMxqjegAdqIP3vC k9YI+hAhBAlHyT2z5ds92gmyH7ncUXvVXp7fgR5arkY0OKWSW7nD3Jy5+KdMhsaOaolDL 5dbtOYoQIvwhvPH2Rn5ApRQLvpDkxhQzRuwVoPIqdFQcJ8cp9qTfqlJLRiWmFC25ZmS11 KBhmTcYdHNyQVlvA8xpYlYBQW4Jx7m3YifJpyZBEU52xwO323nS37q0TZmlG8DcxxUAfv hedDaHmTeZQKfLA/ozajnjRFI1cwd2vkcth/TwBgYwU+YXyu0462oQSO+5L7oR6fcLQ== 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=l+rNRU/z9XiEbG1Wsjneb8BARo7vCIMBPgzbgWGO06Qe4Q11AU0mfi+KjlLaPB6BG73U 6wcHeQbQJiZzyFEljNxvmZ9sQbfskxDpLrylFxosfArWStIwoTTHLIJbS0qZhG+eJhOHC ZU6BzRMRiPw2++f61nfy11YuKNUHpcb9XIW+MZxSjC0yDr9Tu9u/aC/iYtrNaBhtRVzEX 4dgFsBmohLtdARIutVNgUHWcrSSc6BjQs0dUosAkHO9d0w6EOAdWcB8HjUACbF/Vbb0FO 8HHXpoEOm9d4iTXLF+TRvdtwlxgIBWiMBeviMGPRHp+AAM+ZWwfg64JtD3ReSIDHH/Q== 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.132 Received: from mail-yx2-f4.google.com (mail-yx2-f4.google.com [74.125.224.132]) (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 7E574606A322 for ; Wed, 2 Dec 2026 15:37:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7E574606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com 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 Received: by mail-yx2-f4.google.com with SMTP id 00721157ae682-8b4d009162bso32959437b3.1 for ; Wed, 02 Dec 2026 07:37:18 -0800 (PST) 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=OoU850iginGYAbkTW7lPaLriZi8CZq0/m+sY+Itz0bk0RVGaEufrtPs/hB35rZqklI dMi7Nn0UqDtnPkeNSzV/xsluxPtw2g0js0AcRqPcm4yIXiu1mzufqAfr8/NqW0tsVsNR VPzsoQX7ZXJK9yBHnqdn7WOcsV4059UVX9aikvF+Zd8QRQATWYYx2nBO4fQgP7CoAWDg w+Pf6CZtlm2ZiKYieL38Ua5QRp9LMdpKvB95Zug6k5lIVOqHSXEqLa81How+sMZfLcSa L6vUnvaAr7BiyheEPrDIhFpBaFainmTz1rI31NlIhMPISHRRjWon0LNQaXjknyzKybxI RBpQ== X-Forwarded-Encrypted: i=1; AL+hErF+r5ZEWjlTTdMJAOjnM/2A7/JOZiXz2wvdXge6U4K7gAYCu6KYDHrY6zUj824qLAd7R0lLETi6ut0CjVgVbeE=@vger.kernel.org X-Gm-Message-State: APuU4Z9u5SxLmF1dTbNwF1dClg2ESo5OjmMhgKES+RGyXYc2GnhZzsb+ cOlrvQqE3p1trSyoLydz/AI2lI27mW7yek8TZ5JvHswQgO7yC+zaV4pr X-Gm-Gg: AZFdTZdwVElkiSdfxOlB5yxDMlk+RVKOrY31803C+MoZe2c6vRiKFUilA81f+0uarGf ntYJoZSt0BZXUqN+Aj1NbNU7er5qR9/88aGqnOBZSFgo7CRYMcJw/tdTLiU5ghS6yMppFF+Xe3A 0LZeMQAznSXQBPU0izHB9RxQCQUkNVyJwv10Wt0EIkhcrq9z0fKLqFvBJ5cn8Hz64/ZZFoWmTXw nT2HUfcNb5C4hmI+Lt2krVD/xdLMC/Jklrv2p9tLsGhLqmNdGakv4pVaADOmAp50AjXvRveRiuv hV3SP9DaffYriYh8eyfu83yz3CXVvGHEK87OS7E5LTZ/zZwRmmFRhxWm9TD3FkhCWwoYday34mC QUGZec66bgNRLFWplMPOSB0+P5bw59hgqrl4TCSoLZBu+8iUZJuKqvq4SnRCwB0NRUamxY/iwrJ q9pwmc7Oe0wACqQ14kp/m2d43kcRMCBTEPSDiavU8br3NAnmbzuiYMprWC8IRDvmPNGp9IrER1L l01rupS1zYti7sMx8IefOiJ1LXby/WTvvBIdlW/eykumn0DIhLNOY5RnepPkX7XhzudXaQZjwD3 BOqUGA4QUiStKPLtEyTxXHMoUvDLcpcG8Q== 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) 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) Message-ID: Date: Wed, 2 Dec 2026 10:37:16 -0500 X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v6 0/6] tls: perform TLS 1.3 KeyUpdate in the kernel To: 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 , Chuck Lever , kernel-tls-handshake@lists.linux.dev, linux-nvme@lists.infradead.org, Alistair Francis , Martin Belanger , Daniel Pereira References: <20261105-keyupdate-rfc-v6-0-99b695f9eb4f@gmail.com> <7f9b7ab9-9728-42be-a5c1-9e8e62c23ab9@gmail.com> Content-Language: en-US From: Martin Belanger In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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