]> git.baikalelectronics.ru Git - kernel.git/commit
hwrng: imx-rngc - add quality to use it as kernel entropy pool
authorMarco Felsch <m.felsch@pengutronix.de>
Mon, 31 Aug 2020 14:00:42 +0000 (16:00 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 11 Sep 2020 04:39:14 +0000 (14:39 +1000)
commit8b421623f0431e6daa133a15a684f64b97ad52e4
treebc2aae99bbb37c5bcb2970067f4f44b7f8dce44f
parent1eb4cb04a06e47fe7ff354052ba21f45eac4aa58
hwrng: imx-rngc - add quality to use it as kernel entropy pool

The RNGB can generate 2^20 words (1 word == 4 byte) of 'random' data
after the seed pool was initialized. The pool needs to be reseeded if
more words are required. The reseeding is done automatically since
commit 769732aeaeba ("hwrng: imx-rngc - use automatic seeding").

We can't retrieve the TRNG values directly so we need a other way to get
the quality level. We know that the PRNG uses 20.000 entropy samples
from the TRNG to generate 2^20 words (1MiB) and the quality level is
defined as (in bits of entropy per 1024 bits of input). So the quality
level can be calculated by:

   20.000 * 1024
   ------------- = ~ 19.5
        2^20

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/imx-rngc.c