diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2015-04-21 10:46:40 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-04-22 09:30:16 +0800 |
commit | ad9488be606afa90da985e7023c0afbb03bd32c6 (patch) | |
tree | e1ee151c6b4325a62b3019ad0ef59301230823d5 | |
parent | 67ea60f16b21a872f5563d8343cd0098fb5c7964 (diff) | |
download | linux-crypto-ad9488be606afa90da985e7023c0afbb03bd32c6.tar.gz linux-crypto-ad9488be606afa90da985e7023c0afbb03bd32c6.zip |
crypto: rng - Add multiple algorithm registration interface
This patch adds the helpers that allow the registration and removal
of multiple RNG algorithms.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | crypto/rng.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/crypto/rng.c b/crypto/rng.c index 5e0425a2..e98ce1ca 100644 --- a/crypto/rng.c +++ b/crypto/rng.c @@ -233,5 +233,34 @@ void crypto_unregister_rng(struct rng_alg *alg) } EXPORT_SYMBOL_GPL(crypto_unregister_rng); +int crypto_register_rngs(struct rng_alg *algs, int count) +{ + int i, ret; + + for (i = 0; i < count; i++) { + ret = crypto_register_rng(algs + i); + if (ret) + goto err; + } + + return 0; + +err: + for (--i; i >= 0; --i) + crypto_unregister_rng(algs + i); + + return ret; +} +EXPORT_SYMBOL_GPL(crypto_register_rngs); + +void crypto_unregister_rngs(struct rng_alg *algs, int count) +{ + int i; + + for (i = count - 1; i >= 0; --i) + crypto_unregister_rng(algs + i); +} +EXPORT_SYMBOL_GPL(crypto_unregister_rngs); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Random Number Generator"); |