mbox series

[0/6] crypto: api - Add support for cloning tfms

Message ID ZDefxOq6Ax0JeTRH@gondor.apana.org.au (mailing list archive)
Headers show
Series crypto: api - Add support for cloning tfms | expand

Message

Herbert Xu April 13, 2023, 6:23 a.m. UTC
Over the years, various networking-related users have needed
per-packet keys for hashing (and potentially for ciphers because
hashing can be derived from ciphers, e.g., CMAC).

Currently this is impossible to do with the Crypto API for two
reasons.  Each key is tied to a tfm object, which cannot be
allocated on the network data path (as it requires sleeping).
Secondly, various drivers rely on the fact that setkey is usually
done right after allocating a tfm object and therefore sleep in
their setkey functions.

This series tries to resolve this by making it possible to clone
an existing tfm object, thus making it possible to allocate new
tfms on the data path.

To do so you simply call crypto_clone_ahash/shash on an existing
tfm object.  Afterwards you may call setkey on it as usual.

Cheers,