[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZGdC9MDomBGRpccP@gondor.apana.org.au>
Date: Fri, 19 May 2023 17:35:48 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Ard Biesheuvel <ardb@...nel.org>
Cc: Dmitry Safonov <dima@...sta.com>,
Linux Crypto Mailing List <linux-crypto@...r.kernel.org>,
linux-kernel@...r.kernel.org, David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Andy Lutomirski <luto@...capital.net>,
Bob Gilligan <gilligan@...sta.com>,
Dan Carpenter <error27@...il.com>,
David Laight <David.Laight@...lab.com>,
Dmitry Safonov <0x7f454c46@...il.com>,
Eric Biggers <ebiggers@...nel.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Francesco Ruggeri <fruggeri05@...il.com>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Ivan Delalande <colona@...sta.com>,
Leonard Crestez <cdleonard@...il.com>,
Salam Noureddine <noureddine@...sta.com>, netdev@...r.kernel.org
Subject: Re: [PATCH] crypto: shash - Allow cloning on algorithms with no
init_tfm
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 <ardb@...nel.org>
Thanks,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists