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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

Thanks,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux