From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDE54606A322 for ; Wed, 2 Dec 2026 15:37:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=3XSmxdJ2; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ykozt0Vu DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=F2wRZy+jfXwd1hOgae58aXsiZQ2tH0hmCreJWg5Q5XI=; b=3XSmxdJ2XJuRTY 4R876DxfNSgXBHPV7al57Fizd+8HI9tOi8wPFXOLHdgDZJ9HZcal6z5KUcTMWMjXwoDbAqnKHZzsH HhGAS1IL76fKmM2XXQ5Shx1qq+nixqrL3eWGKbAvRR4RgadfIPRVtUCNQcodfbLCWMRaCVgqajr5a pcldfB6DoZBOVQ+tSRGdbUDCzwxQOSltQSFFM/F4d4FfJpIVq6iwTxNZ2FGOURmptiJUY/6Q7i8mh gwap0e0+v7jMSlL1+HvUB5qGPc+oaQJwfVBUQwUL2r4RMq4GuSt5HHKv5ZENoU+tyPEMfiCxRairA DbXZwTTY15AI5wJzrp0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYmOZ-0000000C01d-3qa4; Wed, 02 Dec 2026 15:37:23 +0000 Received: from mail-yx2-x07.google.com ([2607:f8b0:4864:41::7]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYmOX-0000000C00t-3Pxt for linux-nvme@lists.infradead.org; Wed, 02 Dec 2026 15:37:22 +0000 Received: by mail-yx2-x07.google.com with SMTP id 00721157ae682-8b2fa622fddso31158597b3.0 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=lists.infradead.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=ykozt0VuBkRMjqYHOZvBFtbCUE8jq6FoLtWNc3cHpiYOo7Yf0WZNE/FiQkeetOWpYu MG73B/Y8UNJikLt4AqyLMRHpsm5fzYHMkiy+crh4iD5v+KYIiMcL2eI1VwvfSF+eCZwW vyLurLhy8ic7Otxr0qgvek8wmSSpkiHSCUKhHKUi7nl7E41QXtiilw4+fu4whlSWoTDy TZxTuhFB6MJxZKvYmFxs05eERFCR2uQfbHsyl3hhQNFC+ekG/r/UM2yzXE/MBfmK0k94 LNxSWWq+E1gaPOiHwMYmP71Ew/udcm+XYpvANqsq+/9ZCA1lapnvfzfS+P8lLe2Q/Glj APFA== 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+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fotYYCc+kcclV8N7NTH+VT/Jo+kUn1WdJKXBcopzBW6UNT4pPQ0yvr3SbzDihvp8p8lx5813W ILg+MDxpWJaHPsNwf5oSe1xK9HWN6cdY8DSZeaBn2EjLGPz+ScGx9jRXtVisVn68O+bRuOzNBe5 L6IYcolqYkMSUlA/Ef+Atvgi+C/h7PjK+Q== 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-Archived-By: 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261202_073721_901503_92505207 X-CRM114-Status: GOOD ( 18.42 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" X-Spam-Status: No, score=-4.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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