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=yLNCQBd9tlAdUlgJEBFnlTl67EIgYql6ZTFxeUXvueOZW1nOjZfoOse5lzpZl90d6CKg INBvr9T6zy4+B7GcaPOh4wyASNmfOT6sm0pdrv6vkQmFegBtdKqCcT6e1ce/uQ+NGl0XA OjbHjx/bVKhmo1BwuOBl/fNElP5P4qL0HIT3Z8s113Y2iiSbc+0mvTOebcb2SCXJln0Ft 51g15QzEtjSiR9W9YXOTeS/DU7o8eMedt1BgyMC2bIAB0QZ/mPFHqJ6fk5t8dWaUTx6aH bl2lCli6JzA/R7QjYw7/mr1Hul26sTffUPWvRyZ1hIaUSdVTlHzw9mYpv98aveEFLfw== 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=U6XbXkkDPh/Vn0xIFBUWX6U7LBEIKxe2zc4QIgFG00JKgIebRWGl0SG4kxVsJ66PxUxp HdAK5MEOAXhjOB0+5HUDoYiggXEsKSlrzMD68NceGeWP/K494KLF+PgmAB8l0KCXvLFkC IPAobpUD5fqVAd6GN2V8omqH5TqDQOrkD33TytCISj/WbDmxrwcZhkPAxcJ7xf8xyRCm3 X66qSr/+98GKL2+uRQ+cvaWaZx7HQVfAO3wmzCxiVPpaBS+MbqGppeCSjx2Xyw/b8bOe0 5m5gdPD798s1i3sXMPVGjcz8AkWxyhFfgj/bGyOU4suPoiLRAAAezoqm6LHRzHcGiCw== 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 9131E606A325 for ; Wed, 2 Dec 2026 15:37:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9131E606A325 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-8b2fa622fddso31158617b3.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=O2oKmikpsduibeyUSlR0xF6QjDXetbYvXfPTgyrxV5iheD1oIjXN1spPVXCt4qak5E RA3JzO/QxYCyO2qDoPpeh4S9ng5oWlYocCSh2btIujiLAbEgUbji1KjJqvUyEuuFZO4h HelMFH2slwK/GhyierOGtIocNCoOcGIC1acmbdyJ7FzTiWjyGcyXVDvHDJRvm71AxxaL hZSt+82WlcfrwQG2ywaC62UFuzjYCgO9dEAL+tW/iRmwVlTWH909xSzASbiXA25p8j+/ gUjjjgkUjTz5MW0sSwvGCbT5XhQLAwBGAbZ/W03h9L7OZ4ivCyLk0thz3tCe/TGLxKy1 aTGw== X-Forwarded-Encrypted: i=1; AL+hErHA6pXEvYpDUvaCZHhAuTDLINnvinC9SmEte5a1laAvTpyhd14X3fU5vep3VSPPVCtNp2vQux0A9bWsiUY=@vger.kernel.org X-Gm-Message-State: APuU4Z9qV3SMIChFyiheDo6W/k6rJJ3Ss5xpYDDYLpLFwO1fiGLjD6Ae eOt7SCIEeJUgdW0Ei9TpwcnrxbWfzrBuu0pZz0uFs+4i+QgOOpEhOojc X-Gm-Gg: AZFdTZdL4OmhYaORJBkjsLh+39SyB23GYYla2nsrXrZhkFeuenIYFlQzYH3NcqCvNm/ 6YbBFnO98UZ8ebSEjDQUiwJ5M7ipPMOorpfljGZpCVzbkSb7OecdUqh4jtmo47DkUf9fpOYlMO9 bGZia9YAaLCg++t7HzRMZaTAe7zBmyk8x22GYNdWjgsrwfv32cCn0PW6zv4ow/2rK5RQbKVWI4Y cFMD0vRgkrwerxNTz0hY7AJO6Wh1hB4nQjAWL3+FMvexZF2nWEFYj0zReKdpuyAXqfOEmUd+rvc n0Fuksxn7a3RQZc0BI31gnRrgh1CnjMlYRoSX06jWThUQXdUFZmvSp0+JRv80/brjB/Qwba0NuG cPJYbq/a5MEzfnWdNb/0ZG72mB733KXdnSWDHtbQGdi5WQE2V12cekB6TFIlvK3EALXBKaYmDEZ K5evHoZmOLm4tHRHAjJfFPl/2gOoSSpzbKeHv9P6ljKFJTCF+AYoJ90I98nrz95p2dqaA8g7t3v lTThOQ7uJ0nLqRQWu3Vhi/z4XJH+unKrkRKfA/l4S4FWY0iIFMw6UGh5TNQzjsicLgM8bqdi7+b G5mbIcAmihxgxbWmWi6lLm3nvHUsxgrLBw== 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-kernel@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