Thread (38 messages) 38 messages, 5 authors, 2023-05-19

Re: [PATCH] crypto: shash - Allow cloning on algorithms with no init_tfm

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2023-05-19 09:39:16
Also in: linux-crypto, lkml

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@kernel.org>
Thanks,
-- 
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help