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 253F3C77B7A for ; Fri, 19 May 2023 09:39:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231670AbjESJjO (ORCPT ); Fri, 19 May 2023 05:39:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230461AbjESJiu (ORCPT ); Fri, 19 May 2023 05:38:50 -0400 Received: from 167-179-156-38.a7b39c.syd.nbn.aussiebb.net (167-179-156-38.a7b39c.syd.nbn.aussiebb.net [167.179.156.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E135F210D; Fri, 19 May 2023 02:37:34 -0700 (PDT) Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1pzwWa-00ApJo-MZ; Fri, 19 May 2023 17:35:49 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Fri, 19 May 2023 17:35:48 +0800 Date: Fri, 19 May 2023 17:35:48 +0800 From: Herbert Xu To: Ard Biesheuvel Cc: Dmitry Safonov , Linux Crypto Mailing List , linux-kernel@vger.kernel.org, David Ahern , Eric Dumazet , Paolo Abeni , Jakub Kicinski , "David S. Miller" , Andy Lutomirski , Bob Gilligan , Dan Carpenter , David Laight , Dmitry Safonov <0x7f454c46@gmail.com>, Eric Biggers , "Eric W. Biederman" , Francesco Ruggeri , Hideaki YOSHIFUJI , Ivan Delalande , Leonard Crestez , Salam Noureddine , netdev@vger.kernel.org Subject: Re: [PATCH] crypto: shash - Allow cloning on algorithms with no init_tfm Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 19, 2023 at 11:31:30AM +0200, Ard Biesheuvel wrote: > > OK. So IIUC, cloning a keyless hash just shares the TFM and bumps the > refcount, but here we must actually allocate a new TFM referring to > the same algo, and this new TFM needs its key to be set before use, as > it doesn't inherit it from the clonee, right? And this works in the > same way as cloning an instance of the generic HMAC template, as this > will just clone the inner shash too, and will also leave the key > unset. Yes that's pretty much it. Cloning a tfm is basically exactly the same as allocating a tfm, except that instead of going through the init_tfm code-path it executes clone_tfm instead (thus allowing any internal data structures to either be shared or allocated with GFP_ATOMIC). The key will be unset just like a freshly allocated tfm. > If so, > > Acked-by: Ard Biesheuvel Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt