iPXE
linux_entropy.h
Go to the documentation of this file.
1 #ifndef _IPXE_LINUX_ENTROPY_H
2 #define _IPXE_LINUX_ENTROPY_H
3 
4 /** @file
5  *
6  * /dev/random-based entropy source
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #ifdef ENTROPY_LINUX
13 #define ENTROPY_PREFIX_linux
14 #else
15 #define ENTROPY_PREFIX_linux __linux_
16 #endif
17 
18 /**
19  * min-entropy per sample
20  *
21  * @ret min_entropy min-entropy of each sample
22  */
23 static inline __always_inline min_entropy_t
25 
26  /* linux_get_noise() reads a single byte from /dev/random,
27  * which is supposed to block until a sufficient amount of
28  * entropy is available. We therefore assume that each sample
29  * contains exactly 8 bits of entropy.
30  */
31  return MIN_ENTROPY ( 8.0 );
32 }
33 
34 #endif /* _IPXE_LINUX_ENTROPY_H */
min_entropy_t min_entropy_per_sample(void)
min-entropy per sample
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define __always_inline
Declare a function to be always inline.
Definition: compiler.h:611
static __always_inline min_entropy_t ENTROPY_INLINE(linux, min_entropy_per_sample)(void)
min-entropy per sample
Definition: linux_entropy.h:24
#define MIN_ENTROPY(bits)
Construct a min-entropy fixed-point value.
Definition: entropy.h:71
unsigned int min_entropy_t
An amount of min-entropy.
Definition: entropy.h:60