提交 69a0cf9d 编写于 作者: A Arjan van de Ven 提交者: Joseph Qi

boot: give rdrand some credit

Cherry-pick from clear-linux patches:
https://github.com/clearlinux-pkgs/linux-kvm/0104-give-rdrand-some-credit.patch

try to credit rdrand/rdseed with some entropy

In VMs but even modern hardware, we're super starved for entropy, and while we can
and do wear a tin foil hat, it's very hard to argue that
rdrand and rdtsc add zero entropy.
Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: NJiufei Xue <jiufei.xue@linux.alibaba.com>
上级 4a7927ff
...@@ -1796,6 +1796,8 @@ static void init_std_data(struct entropy_store *r) ...@@ -1796,6 +1796,8 @@ static void init_std_data(struct entropy_store *r)
if (!arch_get_random_seed_long(&rv) && if (!arch_get_random_seed_long(&rv) &&
!arch_get_random_long(&rv)) !arch_get_random_long(&rv))
rv = random_get_entropy(); rv = random_get_entropy();
else
credit_entropy_bits(r, 1);
mix_pool_bytes(r, &rv, sizeof(rv)); mix_pool_bytes(r, &rv, sizeof(rv));
} }
mix_pool_bytes(r, utsname(), sizeof(*(utsname()))); mix_pool_bytes(r, utsname(), sizeof(*(utsname())));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册