]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[rng] Allow entropy source to be selected at runtime
authorMichael Brown <mcb30@ipxe.org>
Fri, 17 Feb 2023 16:56:11 +0000 (16:56 +0000)
committerMichael Brown <mcb30@ipxe.org>
Fri, 17 Feb 2023 21:29:51 +0000 (21:29 +0000)
commit9f17d1116d27696ec76c48c5c77df34cba521380
tree381ddb4988380ab1c5c4c59bb27ab7aea9bfc081
parent2733c4763a50b9eb0c206e7430d4d0638451e5e9
[rng] Allow entropy source to be selected at runtime

As noted in commit 3c83843 ("[rng] Check for several functioning RTC
interrupts"), experimentation shows that Hyper-V cannot be trusted to
reliably generate RTC interrupts.  (As noted in commit f3ba0fb
("[hyperv] Provide timer based on the 10MHz time reference count
MSR"), Hyper-V appears to suffer from a general problem in reliably
generating any legacy interrupts.)  An alternative entropy source is
therefore required for an image that may be used in a Hyper-V Gen1
virtual machine.

The x86 RDRAND instruction provides a suitable alternative entropy
source, but may not be supported by all CPUs.  We must therefore allow
for multiple entropy sources to be compiled in, with the single active
entropy source selected only at runtime.

Restructure the internal entropy API to allow a working entropy source
to be detected and chosen at runtime.

Enable the RDRAND entropy source for all x86 builds, since it is
likely to be substantially faster than any other source.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
18 files changed:
src/arch/arm/include/bits/entropy.h [deleted file]
src/arch/loong64/include/bits/entropy.h [deleted file]
src/arch/x86/core/rdrand.c
src/arch/x86/include/bits/entropy.h [deleted file]
src/arch/x86/include/ipxe/rdrand.h [deleted file]
src/arch/x86/include/ipxe/rtc_entropy.h [deleted file]
src/arch/x86/interface/pcbios/rtc_entropy.c
src/config/config_entropy.c [moved from src/crypto/null_entropy.c with 67% similarity]
src/config/defaults/efi.h
src/config/defaults/linux.h
src/config/defaults/pcbios.h
src/crypto/entropy.c
src/include/ipxe/efi/efi_entropy.h [deleted file]
src/include/ipxe/entropy.h
src/include/ipxe/linux/linux_entropy.h [deleted file]
src/include/ipxe/null_entropy.h [deleted file]
src/interface/efi/efi_entropy.c
src/interface/linux/linux_entropy.c