audk/MdePkg/Library/BaseRngLib
Pedro Falcato 6ca9334dc8 MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUID
RDRAND has notoriously been broken many times over its lifespan.
Add a smoketest to RDRAND, in order to better sniff out potential
security concerns.

Also add a proper CPUID test in order to support older CPUs which may
not have it; it was previously being tested but then promptly ignored.

Testing algorithm inspired by linux's arch/x86/kernel/cpu/rdrand.c
:x86_init_rdrand() per commit 049f9ae9..

Many thanks to Jason Donenfeld for relicensing his linux RDRAND detection
code to MIT and the public domain.

>On Tue, Nov 22, 2022 at 2:21 PM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
  <..>
>    I (re)wrote that function in Linux. I hereby relicense it as MIT, and
>    also place it into public domain. Do with it what you will now.
>
>    Jason

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4163

Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
2024-09-09 11:45:06 +01:00
..
AArch64 MdePkg/BaseRngLib AARCH64: Remove overzealous ASSERT() 2024-05-24 15:48:52 +00:00
Rand MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUID 2024-09-09 11:45:06 +01:00
BaseRng.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseRngLib.inf MdePkg/Rng: Add GetRngGuid() to RngLib 2023-09-08 09:48:55 +00:00
BaseRngLib.uni MdePkg/BaseRngLib: Add support for ARMv8.5 RNG instructions 2021-05-11 16:26:05 +00:00
BaseRngLibInternals.h MdePkg/Library/BaseRngLib: Fix include guard 2023-09-08 03:29:19 +00:00