18 #include <linux/module.h>
20 #include <linux/random.h>
22 #include <linux/slab.h>
23 #include <linux/string.h>
30 static int crypto_default_rng_refcnt;
32 static int rngapi_reset(
struct crypto_rng *tfm,
u8 *seed,
unsigned int slen)
46 err = crypto_rng_alg(tfm)->rng_reset(tfm, seed, slen);
70 rrng.seedsize = alg->cra_rng.seedsize;
92 seq_printf(m,
"seedsize : %u\n", alg->cra_rng.seedsize);
102 .ctxsize = crypto_rng_ctxsize,
103 .init = crypto_init_rng_ops,
104 #ifdef CONFIG_PROC_FS
105 .show = crypto_rng_show,
107 .report = crypto_rng_report,
117 if (!crypto_default_rng) {
118 rng = crypto_alloc_rng(
"stdrng", 0, 0);
123 err = crypto_rng_reset(rng,
NULL, crypto_rng_seedsize(rng));
125 crypto_free_rng(rng);
129 crypto_default_rng = rng;
132 crypto_default_rng_refcnt++;
145 if (!--crypto_default_rng_refcnt) {
146 crypto_free_rng(crypto_default_rng);
147 crypto_default_rng =
NULL;