audk/MdePkg/Library
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
..
BaseArmTrngLibNull MdePkg/ArmTrngLib: Add NULL instance of Arm TRNG Library 2022-11-06 16:32:28 +00:00
BaseCacheMaintenanceLib MdePkg: Utilize Cache Management Operations Implementation For RISC-V 2023-12-19 12:48:14 +00:00
BaseCacheMaintenanceLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseCpuLib BaseTools: Replaced GenFw with ImageTool and MicroTool. 2024-07-22 13:45:44 +03:00
BaseCpuLibNull MdePkg/Library/BaseCpuLibNull: Add missing X86 specific services 2024-01-27 19:40:15 +00:00
BaseDebugLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseDebugLibSerialPort MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseDebugPrintErrorLevelLib MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
BaseExtractGuidedSectionLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseFdtLib Fixed compilation of all packages tracked by CI after rebasing upon edk2-stable202311. 2024-07-22 13:51:38 +03:00
BaseIoLibIntrinsic MdePkg/Library/BaseIoLibIntrinsic: Fix TD MMIO read type cast 2024-01-20 04:35:43 +00:00
BaseLib MdePkg/BaseLib: Fix AARCH64 compilation error 2024-05-15 01:13:18 +00:00
BaseMemoryLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseMemoryLibMmx MdePkg: Replace Opcode with the corresponding instructions. 2022-03-01 01:45:47 +00:00
BaseMemoryLibOptDxe MdePkg/BaseMemoryLibOptDxe AARCH64: Make asm files BTI compatible 2023-03-30 11:05:22 +00:00
BaseMemoryLibOptPei MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseMemoryLibRepStr MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseMemoryLibSse2 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseOrderedCollectionRedBlackTreeLib MdePkg: Update code to be more C11 compliant by using __func__ 2023-03-17 17:55:48 +00:00
BaseOverflowLib MdePkg: Added BaseOverflowLib library. 2024-07-22 13:47:17 +03:00
BasePcdLibNull MdePkg/BasePcdLibNull: Remove ASSERT from LibPcdGetSize, LibPcdGetExSize 2024-07-22 12:45:14 +03:00
BasePciCf8Lib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePciExpressLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePciLibCf8 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePciLibPciExpress MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePciSegmentInfoLibNull MdePkg/PciSegmentInfoLib: Add missing EFIAPI to GetPciSegmentInfo() 2020-06-24 05:46:27 +00:00
BasePciSegmentLibPci MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePeCoffExtraActionLibNull MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
BasePeCoffGetEntryPointLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePeCoffLib SecurePE: Replaced old PE loader with Secure one. 2024-07-22 13:42:14 +03:00
BasePeCoffLib2 SecurePE: Defined new PcdImageProtectionPolicy. 2024-07-22 13:49:00 +03:00
BasePerformanceLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePostCodeLibDebug MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePostCodeLibPort80 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePrintLib MdePkg: Add new status codes to PrintLib 2023-08-07 22:56:02 +00:00
BaseReportStatusCodeLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseRiscVSbiLib MdePkg: BaseRiscVSbiLib: make more useful to consumers 2023-05-17 23:47:20 +00:00
BaseRngLib MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUID 2024-09-09 11:45:06 +01:00
BaseRngLibNull MdePkg/Rng: Add GetRngGuid() to RngLib 2023-09-08 09:48:55 +00:00
BaseRngLibTimerLib MdePkg/Rng: Add GetRngGuid() to RngLib 2023-09-08 09:48:55 +00:00
BaseS3BootScriptLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseS3IoLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseS3PciLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseS3PciSegmentLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseS3SmbusLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseS3StallLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseSafeIntLib MdePkg/BaseSafeIntLib: Add LoongArch64 architecture for BaseSafeIntLib. 2022-10-14 02:16:33 +00:00
BaseSerialPortLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseSerialPortLibRiscVSbiLib MdePkg: add SBI-based SerialPortLib for RISC-V 2023-05-17 23:47:20 +00:00
BaseSmbusLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseStackCheckLib BaseStackCheckLib: Fix STACK FAULT message 2023-12-06 17:10:45 +00:00
BaseSynchronizationLib BaseSynchronizationLib: Fix LoongArch64 synchronization functions 2023-05-05 13:10:09 +00:00
BaseTimerLibNullTemplate MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseUeImageLib UE: Support UE generation and consumption. 2024-07-22 13:49:00 +03:00
BaseUefiDecompressLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseUefiImageExtraActionLibNull SecurePE: Replaced old PE loader with Secure one. 2024-07-22 13:42:14 +03:00
BaseUefiImageLib SecurePE: Defined new PcdImageProtectionPolicy. 2024-07-22 13:49:00 +03:00
CcProbeLibNull MdePkg: Add CcProbeLibNull 2022-04-19 01:26:08 +00:00
DxeCoreEntryPoint MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeCoreHobLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeExtractGuidedSectionLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeHobLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeHstiLib MdePkg: Update the comments of GetInformation function 2024-04-15 21:30:48 +08:00
DxeIoLibCpuIo2 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxePcdLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeRngLib MdePkg/DxeRngLib: Add missing GUID declaration in inf 2023-10-04 15:53:01 +00:00
DxeRuntimeDebugLibSerialPort MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeRuntimePciExpressLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeServicesLib Drop support for the TE format 2024-07-22 13:47:18 +03:00
DxeServicesTableLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeSmbusLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
JedecJep106Lib MdePkg: Add new JedecJep106Lib to fetch JEDEC JEP106 manufacturer 2023-04-12 14:29:54 +00:00
MipiSysTLib MdePkg: Add MipiSysTLib library 2023-05-11 07:26:38 +00:00
MmServicesTableLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
MmUnblockMemoryLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PciSegmentLibSegmentInfo MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiCoreEntryPoint MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiDxePostCodeLibReportStatusCode MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiExtractGuidedSectionLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiHobLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiIoLibCpuIo MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiMemoryAllocationLib MdePkg/MemoryAllocationLib: Add Allocate(Aligned)CodePages 2024-07-22 13:47:18 +03:00
PeiMemoryLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiPcdLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiPciLibPciCfg2 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiPciSegmentLibPciCfg2 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiResourcePublicationLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiServicesLib SecurePE: Replaced old PE loader with Secure one. 2024-07-22 13:42:14 +03:00
PeiServicesTablePointerLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiServicesTablePointerLibIdt MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiServicesTablePointerLibKs0 MdePkg: Add a new library named PeiServicesTablePointerLibKs0 2024-02-06 23:51:47 +08:00
PeiSmbusLibSmbus2Ppi MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeimEntryPoint MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
RegisterFilterLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SecPeiDxeTimerLibCpu MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmiHandlerProfileLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmCpuRendezvousLibNull MdePkg: Remove "assert" from SmmCpuRendevousLibNull.c 2022-06-13 01:37:16 +00:00
SmmIoLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmIoLibSmmCpuIo2 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmMemLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmMemoryAllocationLib MdePkg/MemoryAllocationLib: Add Allocate(Aligned)CodePages 2024-07-22 13:47:18 +03:00
SmmPciExpressLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmPciLibPciRootBridgeIo MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmPeriodicSmiLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmServicesTableLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
StandaloneMmDriverEntryPoint MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
StandaloneMmServicesTableLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
TdxLib MdePkg/Library/TdxLib: Remove unnecessary comparison 2023-09-08 14:21:04 +00:00
TraceHubDebugSysTLibNull MdePkg: Add NULL library of TraceHubDebugSysTLib 2023-05-11 07:26:38 +00:00
UefiApplicationEntryPoint MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiBootServicesTableLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiDebugLibConOut MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiDebugLibDebugPortProtocol MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiDebugLibStdErr MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiDevicePathLib MdePkg/UefiDevicePathLib: Fix AcpiEx print logic 2023-10-19 15:20:02 +00:00
UefiDevicePathLibDevicePathProtocol MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiDriverEntryPoint MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiFileHandleLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiLib MdePkg: Added Call for AfterReadyToBoot Event 2023-02-15 12:34:20 +00:00
UefiMemoryAllocationLib MdePkg/MemoryAllocationLib: Add Allocate(Aligned)CodePages 2024-07-22 13:47:18 +03:00
UefiMemoryLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiPciLibPciRootBridgeIo MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiPciSegmentLibPciRootBridgeIo MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiRuntimeLib MdePkg: Add EFI_UNSUPPORTED return for some Runtime Service functions 2024-02-09 22:16:32 +00:00
UefiRuntimeServicesTableLib MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
UefiScsiLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiUsbLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00