On Monday 18 November 2013 19:29:17 mancha wrote:
> Hauke Mehrtens <hauke <at> hauke-m.de> writes:
> > On 10/17/2013 05:40 PM, chrono wrote:
> > > Ahoi everyone,
> > >
> > > it was requested on IRC that I send my solution to the entropy problem
> > > with the current
> > > kernel (e.g. having 0 available entropy):
> > >
> > > root <at> OpenWrt:/# cat /proc/sys/kernel/random/entropy_avail
> > > 0
> >
> > A similar patch was applied to trunk in r38834.
> >
> > Hauke
>
> I provided this backport patch to #openwrt on freenode last week. I am
> glad it was included in trunk.
>
> Two important clarifications:
>
> 1. The original poster applies his patch to kernel 3.3.8 (it seems) yet
> the interface that makes use of get_cycles() in seeding the random
> pool wasn't introduced until 3.6. The patch on pre-3.6 kernels
> effectively does nothing entropy-wise. Without more comprehensive
> backports, there is no similar simple solution for Attitude.
This seems not entirely accurate, as AA has a backport patch for the generic
3.3.8 kernel to add 'add_device_randomness', see
target/linux/generic/patches-3.3/050-rng_git_backport.patch
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -125,21 +125,26 @@
* The current exported interfaces for gathering environmental noise
* from the devices are:
*
+ * void add_device_randomness(const void *buf, unsigned int size);
* void add_input_randomness(unsigned int type, unsigned int code,
* unsigned int value);
- * void add_interrupt_randomness(int irq);
+ * void add_interrupt_randomness(int irq, int irq_flags);
...
+/*
+ * Add device- or boot-specific data to the input and nonblocking
+ * pools to help initialize them to unique values.
+ *
+ * None of this adds any entropy, it is meant to avoid the
+ * problem of the nonblocking pool having similar initial state
+ * across largely identical devices.
+ */
+void add_device_randomness(const void *buf, unsigned int size)
+{
+ unsigned long time = get_cycles() ^ jiffies;
+
+ mix_pool_bytes(&input_pool, buf, size, NULL);
...
Would there be anything else needed?
> 2. You aren't going to see /proc/sys/kernel/random/entropy_avail
> affected by this patch because the machine/boot specific seeding
> does not credit the entropy count.
>
> --mancha
> _______________________________________________
> openwrt-devel mailing list
> [email protected]
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Tijs
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel