Commit 97696354 authored by Marco Felsch's avatar Marco Felsch Committed by Herbert Xu

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 3acd9ea9 ("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: default avatarMarco Felsch <m.felsch@pengutronix.de>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 45cb6653
...@@ -285,6 +285,7 @@ static int imx_rngc_probe(struct platform_device *pdev) ...@@ -285,6 +285,7 @@ static int imx_rngc_probe(struct platform_device *pdev)
rngc->rng.init = imx_rngc_init; rngc->rng.init = imx_rngc_init;
rngc->rng.read = imx_rngc_read; rngc->rng.read = imx_rngc_read;
rngc->rng.cleanup = imx_rngc_cleanup; rngc->rng.cleanup = imx_rngc_cleanup;
rngc->rng.quality = 19;
rngc->dev = &pdev->dev; rngc->dev = &pdev->dev;
platform_set_drvdata(pdev, rngc); platform_set_drvdata(pdev, rngc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment