mirror of
https://github.com/ipxe/ipxe
synced 2025-12-25 17:12:40 +03:00
[efi] Add EFI entropy source
Originally-implemented-by: Jarrod Johnson <jbjohnso@us.ibm.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
35
src/include/ipxe/efi/efi_entropy.h
Normal file
35
src/include/ipxe/efi/efi_entropy.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#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 double
|
||||
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 1.3;
|
||||
}
|
||||
|
||||
#endif /* _IPXE_EFI_ENTROPY_H */
|
||||
@@ -54,6 +54,7 @@ typedef uint8_t entropy_sample_t;
|
||||
|
||||
/* Include all architecture-independent entropy API headers */
|
||||
#include <ipxe/null_entropy.h>
|
||||
#include <ipxe/efi/efi_entropy.h>
|
||||
#include <ipxe/linux/linux_entropy.h>
|
||||
|
||||
/* Include all architecture-dependent entropy API headers */
|
||||
|
||||
Reference in New Issue
Block a user