[PATCH] hwrng: imx-rngc - add quality to use it as kernel entropy pool

Herbert Xu herbert at gondor.apana.org.au
Fri Sep 11 02:57:38 EDT 2020


On Mon, Aug 31, 2020 at 04:00:42PM +0200, Marco Felsch wrote:
> The RM describes the RNGB as follow:
> 8<----------------------------------------------------------------
> The RNGB uses the True Random Number Generator (TRNG) and a
> Pseudo-Random Number Generator (PRNG) to achieve a true randomness and
> cryptographic strength.
> 8<----------------------------------------------------------------
> 
> The RNGB has 3 operation modes: self-test, seed-generation and the final
> 'random number generation' mode. Before we can retrieve random numbers
> from the RNGB we need to generate the seed pool:
> 8<----------------------------------------------------------------
> During the seed generation, the RNGB adds the entropy generated in the
> TRNG to the 256-bit XKEY register. The PRNG algorithm executes 20.000
> entropy samples from the TRNG to create an initial seed for the random
> number generation.
> 8<----------------------------------------------------------------
> 
> 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 3acd9ea9331c ("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 at pengutronix.de>
> ---
>  drivers/char/hw_random/imx-rngc.c | 1 +
>  1 file changed, 1 insertion(+)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert at gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



More information about the linux-arm-kernel mailing list