summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/linux
diff options
context:
space:
mode:
authorMichael Brown2012-03-18 18:03:58 +0100
committerMichael Brown2012-03-18 18:06:03 +0100
commit5af9e6219646ace094cfe35caa0125cbff8f38f8 (patch)
tree8b53d125f9e52d85641610b3ddfd99bf1a55b534 /src/include/ipxe/linux
parent[rng] Allow entropy_enable() to return an error (diff)
downloadipxe-5af9e6219646ace094cfe35caa0125cbff8f38f8.tar.gz
ipxe-5af9e6219646ace094cfe35caa0125cbff8f38f8.tar.xz
ipxe-5af9e6219646ace094cfe35caa0125cbff8f38f8.zip
[rng] Add Linux entropy source using /dev/random
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/linux')
-rw-r--r--src/include/ipxe/linux/linux_entropy.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/include/ipxe/linux/linux_entropy.h b/src/include/ipxe/linux/linux_entropy.h
new file mode 100644
index 000000000..bd89bd52f
--- /dev/null
+++ b/src/include/ipxe/linux/linux_entropy.h
@@ -0,0 +1,32 @@
+#ifndef _IPXE_LINUX_ENTROPY_H
+#define _IPXE_LINUX_ENTROPY_H
+
+/** @file
+ *
+ * iPXE entropy API for linux
+ *
+ */
+
+FILE_LICENCE(GPL2_OR_LATER);
+
+#ifdef ENTROPY_LINUX
+#define ENTROPY_PREFIX_linux
+#else
+#define ENTROPY_PREFIX_linux __linux_
+#endif
+
+/**
+ * min-entropy per sample
+ *
+ * @ret min_entropy min-entropy of each sample
+ */
+static inline __always_inline double
+ENTROPY_INLINE ( linux, min_entropy_per_sample ) ( void ) {
+
+ /* We read single bytes from /dev/random and assume that each
+ * contains full entropy.
+ */
+ return 8;
+}
+
+#endif /* _IPXE_LINUX_ENTROPY_H */