提交 506bf0c0 编写于 作者: K Keith Packard 提交者: Herbert Xu

hwrng: core - allow perfect entropy from hardware devices

Hardware random number quality is measured from 0 (no entropy) to 1024
(perfect entropy). Allow hardware devices to assert the full range by
truncating the device-provided value at 1024 instead of 1023.
Signed-off-by: NKeith Packard <keithp@keithp.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 7094e8ea
......@@ -179,7 +179,8 @@ static int hwrng_init(struct hwrng *rng)
add_early_randomness(rng);
current_quality = rng->quality ? : default_quality;
current_quality &= 1023;
if (current_quality > 1024)
current_quality = 1024;
if (current_quality == 0 && hwrng_fill)
kthread_stop(hwrng_fill);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册