aboutsummaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/linux
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2018-03-20 20:42:39 +0200
committerMichael Brown <mcb30@ipxe.org>2018-03-20 20:56:01 +0200
commit0d35411f88dd37dda755d52b4549337f8299c698 (patch)
tree9129fb0cee236f97af83024b5910cb2cb2b83b08 /src/include/ipxe/linux
parentd5d4bf8870ccb68b3b897d2ee88079dc06e9dd48 (diff)
downloadipxe-0d35411f88dd37dda755d52b4549337f8299c698.tar.gz
[rng] Use fixed-point calculations for min-entropy quantities
We currently perform various min-entropy calculations using build-time floating-point arithmetic. No floating-point code ends up in the final binary, since the results are eventually converted to integers and asserted to be compile-time constants. Though this mechanism is undoubtedly cute, it inhibits us from using "-mno-sse" to prevent the use of SSE registers by the compiler. Fix by using fixed-point arithmetic instead. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/linux')
-rw-r--r--src/include/ipxe/linux/linux_entropy.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/ipxe/linux/linux_entropy.h b/src/include/ipxe/linux/linux_entropy.h
index afef6fe19..ea8c1f16c 100644
--- a/src/include/ipxe/linux/linux_entropy.h
+++ b/src/include/ipxe/linux/linux_entropy.h
@@ -20,7 +20,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
* @ret min_entropy min-entropy of each sample
*/
-static inline __always_inline double
+static inline __always_inline min_entropy_t
ENTROPY_INLINE ( linux, min_entropy_per_sample ) ( void ) {
/* linux_get_noise() reads a single byte from /dev/random,
@@ -28,7 +28,7 @@ ENTROPY_INLINE ( linux, min_entropy_per_sample ) ( void ) {
* entropy is available. We therefore assume that each sample
* contains exactly 8 bits of entropy.
*/
- return 8.0;
+ return MIN_ENTROPY ( 8.0 );
}
#endif /* _IPXE_LINUX_ENTROPY_H */