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=3i6yHiZHK0LG1ANP3F7vAE1kCTIap9QS6ISBtGO68xuy50l0iLOpqQjvaJNJpasvuBC2 KOMGFUDd9cXE+wZL/OmbDQcXmP31cTN6daHqfWdT2PE/QX0RoT8rKXku6dJiQEi9IGjkU fGQzaDi6u5RxYp3sQXGsvM0rq1i7N6M2Fqt9D+2DRX43pzg65q1Oj6ac0aKqy2/upqFFz /dWAFniuqQqhcBcYjLjHsPW19/QEjFMIREXWTu05XS5kEbuJQ1xHglrUbKoJWtYXdlmUB q8N8Gc+LbAPOsLA+9lgFIISse2vB95Dj2MwayYn62D+7V/U/a4p1y72Zb3eMWEqbqIA== 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=X0l+kTodf0t8OMT3zHeP7rtpEUnRGjI5KB5qYoWO+tIgfqU5VhIW6tJPdglQNV7kiKAq HniktDvRMIU6Tqm6obTSpZ8wkhtCGGYZeBP7yj6qCHdIVSPMQaOu6Bd+3KokZdPNcDeug XCOc3ZLa2wbR9DcZjMNZeguWpjp4vwZMn5rqX8w8x8mux1epnF5nF3h4LSMXLa54na4aD r3BLnhrD/Ml9Q/Iu1Sw9OTkKYd+aZPNJxWCtfPOIqQGDG3S/ld7FZM6IJyxCIwDNJNKmq 5/jGA0NMPzkbqqFiUAgdmRewApa5oQHAxYOfwBoJ1FBaeCvUiOiEO9qyTmcS+Y4dLfw== 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 9134C606A327 for ; Wed, 2 Dec 2026 15:37:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9134C606A327 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-8b2fa622fddso31158567b3.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=pJO0Ckhr8UbwyUHHQ6JSPgzkagqV7uUGvphqMa+JgqC80550z7uMMfLFRGNRRaW35D RXppu3BUm+tz7c3upQRyJ4PwQeFvEZsSVFUJryhlxyztVNE6KB00YTbkBM1DoF3/E2R8 GO1FZFiTZn4IvKzB5LFjynlUBzS+fhG2TOqusXFcCHHhxXEBB2TmYwKS3Vz3McbLx73D 683NJfECEWL5rNwZ7dYAnf+HrROz4Nuz+clXBzg5ZsJ6vxdBESzJSJh3ELJ12Rcn/Op+ +l7hRSPuLT6NZbg4+65ZWKZ8hmGfe3cN3qPM0Bz2mpO8v6Iz+b4CkV2GxM8n9D4tQMXP 8hyA== X-Forwarded-Encrypted: i=1; AL+hErFilgn6F4aDh4AKtnBr6ZRTWtrfQZ9vviyP7t/hoLVK+CCZcxUUKHJYdYsRTTx/g+1ucfG1gas=@vger.kernel.org X-Gm-Message-State: APuU4Z8SZJgKoSPqgMASnzuNdz6ls2DraErMpj1bib+2hacEdg2hrE3f WcwKaCq0zRAU7d9XWQlhVOJ9rIZM7Mr861QC48uQaQu2ZRWo7k2KkxDy X-Gm-Gg: AZFdTZcBooc+8kNqwxHq+hpb8Iu8xcy2pEbXnBuqrBHT5jW6U+9hMOZbYp/fauQiDly fK3GUuQ+EaHmTowga7idsjU161SruYUovfNOwxokNyagax3GT4KjXvR+CWal4+vMFX9xL5a9C6u ZzRas2NH4Ec/7ERQeSwAWkKoBVw2MFnem87s9yZmSkN3gDe6xR5FSfyplwmm0cNUrxT5297J4UE xIOtYzcSPilRhGNSDM5teuwqWW4Ju0a7zfJUBIvkf5LlAXDIJCIRC1h3Myn3ttMknbRh+dOHa4U H3+3pTbQRJzCXxsSFeZi/8N4+6ajXa16vHhjkd2d8S0LhcSGDpMVrK1Vhmr4IDmoWoIHS/Np8VF U2tXuT6dnZmwLhJ6DZZnNNnAhLrRq5QZEINlQI98plXWCyluzXVXD3J207O5Qj81WipvNR7woOr X1I+v2BSmIsw+k+7Fw3fTA/MQgegfPCu+suIzfq+o4AcLUW5Z9+TXS1QtKTJdJaSuoeoIVVftg4 gY0j8QuQPF3OPuiTwJgaaQ8k4G8sS5O6jnlExcM6MLh6K9BB2JKW8TQJtro1dChu+1Di/Iza1Yl QG5s04FCHpI5g+vNb33bO/nYKRh58diLTA== 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: netdev@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