Commit e4bd2bf6 authored by Theodore Ts'o's avatar Theodore Ts'o Committed by Yang Yingliang
Browse files

random: only read from /dev/random after its pool has received 128 bits

mainline inclusion
from mainline-v5.2-rc1
commit eb9d1bf0
category: bugfix
bugzilla: NA
CVE: NA

https://gitee.com/openeuler/kernel/issues/I1CVQ4?from=project-issue


-------------------------------------------------

Immediately after boot, we allow reads from /dev/random before its
entropy pool has been fully initialized.  Fix this so that we don't
allow this until the blocking pool has received 128 bits.

We do this by repurposing the initialized flag in the entropy pool
struct, and use the initialized flag in the blocking pool to indicate
whether it is safe to pull from the blocking pool.

To do this, we needed to rework when we decide to push entropy from the
input pool to the blocking pool, since the initialized flag for the
input pool was used for this purpose.  To simplify things, we no
longer use the initialized flag for that purpose, nor do we use the
entropy_total field any more.

Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent dadc407b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment