From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.224.138 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796225838; b=sy2LnRj5U4YMjtitfJ26S7zgopjLI3DkQ5l8cuvZED1aibRdys9KsV0szU1UvYMOA3fL Qj+vb66gf9a8H5iBBO0AgkCOBXuX3yNg2PSQxzfrL7nYWAYyp21ksQK065CkK+dVmZLBI 0oCOPuKmxk1Tp+19E+a1+HTo3+7VeKZmB1PgT5ZwH1WOtE56CZkxqTxjIAioPPJYMdr0e 3Y/4ExAjxK+/I4boc9cpx5bR4xCFpIxsNm44vK23GbA3VhwvqYZDQTA2ptZgzZ7AJA7D8 05QqLTZt1Nh8OuhHr5jequ3G6qZ4p7eb7rZt4gOYVEDjxmmDpWmYrMutV76AzcTHWyQ== 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=V/OmyLN3j3m3Vwu9glvE/y5hVicSQZu4Uu1ATu72YedKEYROIQRz4yg1sBP8wA51lV6k SE7naB4aBP3p/tRtdVNw3tdJbzN0TRut8uNlsKyFq2tiulqj0iTGnT3sdxFUObiRx9s+Y UfVxbrCpuvnpGw7kSBZUh+E6tv/je8T8kkHbKlAYbbydHdFp0FtupzWlVwZX6NS/hbpsn lm/u+DuET/BJkZRLErdS2wXFdb8ory2bfYXZM0UBviRPVyGLB+Hc1AGax6vctWHjBTkeU yutgEOHNTsqM9GFOvwgZDV8Br9sjdBel9BPz5UcHdxGFNqg/QjpIBmUQcEmq4IQvM5w== 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 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 912A8606A323 for ; Wed, 2 Dec 2026 15:37:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 912A8606A323 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-f10.google.com with SMTP id 00721157ae682-8b2fa622fddso31158657b3.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=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=s5u6Gy/b/+NcJkOybrI7ho/4bigzyAZaMMY6lZSJABiWovx/4BipfIy3QdTjJ6mNqq 3UAHtREI7CPrllyn+In1LGnX7uKEQ6VP+MpLxp8kvTLpHd8Ony/Izd3cJzyPz+wcLIaz dFRQ+/uBgufDCv9To3aAmOasK93rWZgFwijNCxNcJ16ajo1A0vUlugDHUKlmIDcKjQYs ku2/j6BVoQfTS1btXa6fW7BmvDBcoUNONjBS0HsO/xc2GNAG57zi1ihT/iDuTxcMzFxU KNowf8naPw/3NadbzU4S9Mz4VAeyRw1bTsE+1EYjaNI/L/szHMlXux4Bdp+HLfLpJawA y++Q== X-Forwarded-Encrypted: i=1; AL+hErHeUNQREcM1IH4Ju19m8PaIgj8FXKU6eWIeMS2u+4KtIdKSxngq2f7cqYx7JoJomjz55Td/D8CZ4LU=@vger.kernel.org X-Gm-Message-State: APuU4Z+n4XyAVXoZajF1xTxCCcS+d3d3DAHXBoKpPr6YUL8VA13vQ+PG t92FxM8tZq6drX0qS9dtrhJQiUMNun7BYU3F2nSbL7Ws8G8FvOCMyVmh X-Gm-Gg: AZFdTZdshmKUIeaXYBIg6w7wfs01DFXwvaSxRujej11pntpw+Tkz0nHUbXsQUoAs9P+ 18i5CeeeJ9Kc8tzL6TG8AjGXLITmNF53sz9W5kuUTbA4HtZW+rMuDa5JoO1i2BUdQvvaaYhr5Kk KFqRT1frKCJIfNXZJ0146K+HUxytHylfHDWKGTL1622+Knv0X8aZOt6l6SopTYhju4xescGtK3Z ITZ0UNCTtQTGqMMvWvuJ04tPODZRpjgMIZUy5+OdtVXMKnHlkVOsJ0O78hO76ZYM4NptnA6qkRJ XLTAAHad6Z2CT6pLomSOCBT0oyBENbjn83+wsn2W3tN3tDh0qhBkm6JCdFZQQjA2doYQ/eqJnEh e6W2c1GO39laIoX2JnIQy4mAjhvSKZ7m0/7kdh5d5rIuONkVGshfxGqhwn64tkTnJ3Q/WTiP/2k WmEmA0auWd3RDWe9dxIVRSy9TpCc5c+nwbJYzjQC6FLUwHn4ymtQzKv0hVK5YzgsbEbZR6WJWKf M7AINp9wnkbNBfujnhHRqfyDOrk9UOH9unTPzf3RytESPinJFxXaIHHujxVfQXI5W/6QRDZEn/U 8IauCMvA58lcal2A4pQkfo26afrw02fBLQ== 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-doc@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