Thread (7 messages) 7 messages, 4 authors, 2013-08-29

[PATCH] of: Feed entire flattened device tree into the random pool

From: Anton Blanchard <hidden>
Date: 2013-07-25 04:30:45
Also in: linux-devicetree

Hi Michael,
But why not put the initcall in drivers/of/fdt.c, that way it's not
early but it's still common ?
Good idea! How does this look? So long as it happens before
module_init(rand_initialize) we should be good.

Anton
--

We feed the entire DMI table into the random pool to provide
better random data during early boot, so do the same with the
flattened device tree.

Signed-off-by: Anton Blanchard <redacted>
---

v2: move to drivers/of/fdt.c as suggested by Michael Ellerman

Index: b/drivers/of/fdt.c
===================================================================
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -17,6 +17,7 @@
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
+#include <linux/random.h>
 
 #include <asm/setup.h>  /* for COMMAND_LINE_SIZE */
 #ifdef CONFIG_PPC
@@ -714,3 +715,14 @@ void __init unflatten_device_tree(void)
 }
 
 #endif /* CONFIG_OF_EARLY_FLATTREE */
+
+/* Feed entire flattened device tree into the random pool */
+static int __init add_fdt_randomness(void)
+{
+	if (initial_boot_params)
+		add_device_randomness(initial_boot_params,
+				      initial_boot_params->totalsize);
+
+	return 0;
+}
+core_initcall(add_fdt_randomness);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help