crypto: exynos - Reseed PRNG after generating 2^16 random bytes
authorŁukasz Stelmach <l.stelmach@samsung.com>
Tue, 12 Dec 2017 16:36:06 +0000 (17:36 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 22 Dec 2017 08:52:43 +0000 (19:52 +1100)
commit99c9acfe594e07085b11cc9c317c9c9961155ee4
tree7a1451f3e84508e7a3bc22c8d3ff24ec3d70037f
parent3a5a5e5c07e35366f313a5301fe3568349ab8655
crypto: exynos - Reseed PRNG after generating 2^16 random bytes

Reseed PRNG after reading 65 kB of randomness. Although this may reduce
performance, in most cases the loss is not noticeable. Also the time
based threshold for reseeding is changed to one second. Reseeding is
performed whenever either limit is exceeded.

Reseeding of a PRNG does not increase entropy, but it helps preventing
backtracking the internal state of the device from its output sequence,
and hence, prevents potential attacker from predicting numbers to be
generated.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Reviewed-by: Stephan Mueller <smueller@chronox.de>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/exynos-rng.c