aboutsummaryrefslogtreecommitdiff
path: root/src/include/ipxe/efi
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2023-02-17 16:56:11 +0000
committerMichael Brown <mcb30@ipxe.org>2023-02-17 21:29:51 +0000
commit9f17d1116d27696ec76c48c5c77df34cba521380 (patch)
tree381ddb4988380ab1c5c4c59bb27ab7aea9bfc081 /src/include/ipxe/efi
parent2733c4763a50b9eb0c206e7430d4d0638451e5e9 (diff)
downloadipxe-9f17d1116d27696ec76c48c5c77df34cba521380.zip
ipxe-9f17d1116d27696ec76c48c5c77df34cba521380.tar.gz
ipxe-9f17d1116d27696ec76c48c5c77df34cba521380.tar.bz2
[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>
Diffstat (limited to 'src/include/ipxe/efi')
-rw-r--r--src/include/ipxe/efi/efi_entropy.h35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/include/ipxe/efi/efi_entropy.h b/src/include/ipxe/efi/efi_entropy.h
deleted file mode 100644
index 5b16fd7..0000000
--- a/src/include/ipxe/efi/efi_entropy.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _IPXE_EFI_ENTROPY_H
-#define _IPXE_EFI_ENTROPY_H
-
-/** @file
- *
- * EFI entropy source
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <stdint.h>
-
-#ifdef ENTROPY_EFI
-#define ENTROPY_PREFIX_efi
-#else
-#define ENTROPY_PREFIX_efi __efi_
-#endif
-
-/**
- * min-entropy per sample
- *
- * @ret min_entropy min-entropy of each sample
- */
-static inline __always_inline min_entropy_t
-ENTROPY_INLINE ( efi, min_entropy_per_sample ) ( void ) {
-
- /* We use essentially the same mechanism as for the BIOS
- * RTC-based entropy source, and so assume the same
- * min-entropy per sample.
- */
- return MIN_ENTROPY ( 1.3 );
-}
-
-#endif /* _IPXE_EFI_ENTROPY_H */