UPSTREAM: random: add a config option to trust the CPU's hwrng

This gives the user building their own kernel (or a Linux
distribution) the option of deciding whether or not to trust the CPU's
hardware random number generator (e.g., RDRAND for x86 CPU's) as being
correctly implemented and not having a back door introduced (perhaps
courtesy of a Nation State's law enforcement or intelligence
agencies).

This will prevent getrandom(2) from blocking, if there is a
willingness to trust the CPU manufacturer.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 39a8883a2b989d1d21bd8dd99f5557f0c5e89694)
Signed-off-by: Xuewei Zhang <xueweiz@google.com>
TEST=Manually verify this solve the entropy starvation on lakitu.
BUG=b:111450486

Change-Id: I6c8bb82a3b1b20abfa5257987536309f8382842f
Reviewed-on: https://chromium-review.googlesource.com/1184001
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Cindy Bayless <cindyb@google.com>
Commit-Queue: Xuewei Zhang <xueweiz@google.com>
Tested-by: Xuewei Zhang <xueweiz@google.com>
2 files changed