diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2015-06-21 19:11:43 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-06-22 15:49:18 +0800 |
commit | 7cecadb7cca83953e7857fe9f7273b705cb8ebe7 (patch) | |
tree | c799593db728356d1c2485e1d21799a2da1f5c89 /include/crypto | |
parent | 21dbd96f2287a49219d35a0e916cf3f2bcaab9d0 (diff) | |
download | op-kernel-dev-7cecadb7cca83953e7857fe9f7273b705cb8ebe7.zip op-kernel-dev-7cecadb7cca83953e7857fe9f7273b705cb8ebe7.tar.gz |
crypto: rng - Do not free default RNG when it becomes unused
Currently we free the default RNG when its use count hits zero.
This was OK when the IV generators would latch onto the RNG at
instance creation time and keep it until the instance is torn
down.
Now that IV generators only keep the RNG reference during init
time this scheme causes the default RNG to come and go at a high
frequencey. This is highly undesirable as we want to keep a single
RNG in use unless the admin wants it to be removed.
This patch changes the scheme so that the system RNG once allocated
is never removed unless a specifically requested.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto')
-rw-r--r-- | include/crypto/internal/rng.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/crypto/internal/rng.h b/include/crypto/internal/rng.h index 263f1a5..a52ef34 100644 --- a/include/crypto/internal/rng.h +++ b/include/crypto/internal/rng.h @@ -22,6 +22,15 @@ void crypto_unregister_rng(struct rng_alg *alg); int crypto_register_rngs(struct rng_alg *algs, int count); void crypto_unregister_rngs(struct rng_alg *algs, int count); +#if defined(CONFIG_CRYPTO_RNG) || defined(CONFIG_CRYPTO_RNG_MODULE) +int crypto_del_default_rng(void); +#else +static inline int crypto_del_default_rng(void) +{ + return 0; +} +#endif + static inline void *crypto_rng_ctx(struct crypto_rng *tfm) { return crypto_tfm_ctx(&tfm->base); |