From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26E20C6FD19 for ; Mon, 13 Mar 2023 18:37:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230493AbjCMShb (ORCPT ); Mon, 13 Mar 2023 14:37:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231454AbjCMShQ (ORCPT ); Mon, 13 Mar 2023 14:37:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FC7E86DF6; Mon, 13 Mar 2023 11:36:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3035361468; Mon, 13 Mar 2023 18:35:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26A01C4339B; Mon, 13 Mar 2023 18:35:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678732511; bh=83rGdz49K5sFglwLL3OYaBkD8n6tZwCy7h+0mUdPCW4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=X84fjntKJVXpUrxP7JSq6Nruco0it2mhsgBZwOO0t8DlsRbar0aKwnZRK86Wsy1aM 0nQTa1zTms2lsA4fC8/uULZ2jm6fpo6fcPwB+5KHnL4qr/InI9HRIAXi+JcWAXRW31 mX0OFiFLB4BesSc2I+e6eo3GwLCQq+z345oroNgTN8zT5SJh2+BV5+3UtSUsy2PDiH ZChBP2TG89TfCDlEPMu/IDX7PVSDX7pbKGQJBV4zbt61A9I2v1oGJL1RrxTZke7nah XJB5mN5HwuGQu6qQ5bWi92Uk5Xy46w3Oj3y5K4zvSNqkgqeuVYKtZR8F2o/WsIZ1tj CKvWIQ0K32CsQ== Date: Mon, 13 Mar 2023 11:35:10 -0700 From: Jakub Kicinski To: Sabrina Dubroca Cc: netdev@vger.kernel.org, Vadim Fedorenko , Frantisek Krenzelok , Kuniyuki Iwashima , Apoorv Kothari , Boris Pismenny , John Fastabend , Shuah Khan , linux-kselftest@vger.kernel.org, Gal Pressman , Marcel Holtmann Subject: Re: [PATCH net-next v2 0/5] tls: implement key updates for TLS1.3 Message-ID: <20230313113510.02c107b3@kernel.org> In-Reply-To: References: <20230214210811.448b5ec4@kernel.org> <20230215111020.0c843384@kernel.org> <20230215195748.23a6da87@kernel.org> <20230221191944.4d162ec7@kernel.org> <20230223092945.435b10ea@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org On Mon, 13 Mar 2023 16:41:36 +0100 Sabrina Dubroca wrote: > > > Yes, I was looking into that earlier this week. I think we could reuse > > > a similar mechanism for rekeying. tls_dev_add takes tcp_sk->write_seq, > > > we could have a tls_dev_rekey op passing the new key and new write_seq > > > to the driver. I think we can also reuse the ->eor trick from > > > tls_set_device_offload, and we wouldn't have to look at > > > skb->decrypted. Close and push the current SW record, mark ->eor, pass > > > write_seq to the driver along with the key. Also pretty close to what > > > tls_device_resync_tx does. > > > > That sounds like you'd expose the rekeying logic to the drivers? > > New op, having to track seq#... > > Well, we have to call into the drivers to install the key, whether > that's a new rekey op, or adding an update argument to ->tls_dev_add, > or letting the driver guess that it's a rekey (or ignore that and just > install the key if rekey vs initial key isn't a meaningful > distinction). > > We already feed drivers the seq# with ->tls_dev_add, so passing it for > rekeys as well is not a big change. > > Does that seem problematic? Adding a rekey op seemed more natural to > me than simply using the existing _del + _add ops, but maybe we can > get away with just using those two ops. Theoretically a rekey op is nicer and cleaner. Practically the quality of the driver implementations will vary wildly*, and it's a significant time investment to review all of them. So for non-technical reasons my intuition is that we'd deliver a better overall user experience if we handled the rekey entirely in the core. Wait for old key to no longer be needed, _del + _add, start using the offload again. * One vendor submitted a driver claiming support for TLS 1.3, when TLS 1.3 offload was rejected by the core. So this is the level of testing and diligence we're working with :(