diff options
| author | Herbert Xu <herbert@gondor.apana.org.au> | 2025-04-12 13:16:43 +0800 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2025-04-16 15:36:24 +0800 |
| commit | f1440a90465bea1993f937ac7add592ce1e4ff44 (patch) | |
| tree | a1000e8fd4220a04b318b7fabc191a2b7fb22818 /crypto/internal.h | |
| parent | 66fecd9d94034b6193636fe3bc01f089439f5413 (diff) | |
crypto: api - Add support for duplicating algorithms before registration
If the bit CRYPTO_ALG_DUP_FIRST is set, an algorithm will be
duplicated by kmemdup before registration. This is inteded for
hardware-based algorithms that may be unplugged at will.
Do not use this if the algorithm data structure is embedded in a
bigger data structure. Perform the duplication in the driver
instead.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/internal.h')
| -rw-r--r-- | crypto/internal.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/internal.h b/crypto/internal.h index 2edefb546ad4..2ed79bf208ca 100644 --- a/crypto/internal.h +++ b/crypto/internal.h @@ -46,6 +46,7 @@ struct crypto_type { unsigned int maskclear; unsigned int maskset; unsigned int tfmsize; + unsigned int algsize; }; enum { @@ -162,10 +163,12 @@ static inline struct crypto_alg *crypto_alg_get(struct crypto_alg *alg) return alg; } +void crypto_destroy_alg(struct crypto_alg *alg); + static inline void crypto_alg_put(struct crypto_alg *alg) { if (refcount_dec_and_test(&alg->cra_refcnt)) - alg->cra_destroy(alg); + crypto_destroy_alg(alg); } static inline int crypto_tmpl_get(struct crypto_template *tmpl) |