mirror of
https://github.com/torvalds/linux.git
synced 2025-11-30 23:16:01 +07:00
crypto: rng - Ensure set_ent is always present
Ensure that set_ent is always set since only drbg provides it.
Fixes: 77ebdabe8d ("crypto: af_alg - add extra parameters for DRBG interface")
Reported-by: Yiqi Sun <sunyiqixm@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@@ -168,6 +168,11 @@ out:
|
||||
EXPORT_SYMBOL_GPL(crypto_del_default_rng);
|
||||
#endif
|
||||
|
||||
static void rng_default_set_ent(struct crypto_rng *tfm, const u8 *data,
|
||||
unsigned int len)
|
||||
{
|
||||
}
|
||||
|
||||
int crypto_register_rng(struct rng_alg *alg)
|
||||
{
|
||||
struct crypto_alg *base = &alg->base;
|
||||
@@ -179,6 +184,9 @@ int crypto_register_rng(struct rng_alg *alg)
|
||||
base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK;
|
||||
base->cra_flags |= CRYPTO_ALG_TYPE_RNG;
|
||||
|
||||
if (!alg->set_ent)
|
||||
alg->set_ent = rng_default_set_ent;
|
||||
|
||||
return crypto_register_alg(base);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_register_rng);
|
||||
|
||||
Reference in New Issue
Block a user