I'm trying to see if I can use my raspberry pi's hardware RNG as a source of entropy for /dev/random. Mostly to see if I can get it to work and find yet another use for this nifty little device. Of course I don't really need to increase the entropy for my laptop. A useful application however might be to use it as a source of entropy for servers with VM where entropy creation can be a problem. However it is mostly a hobby project to see if I can get it to work and give something back to the open source community.

What I would like to do is to setup my pi on the (local) network and use ssh to get the randomness transferred to the pool of the server, in this case my laptop. I think I should have no problem to just use a bash script that reads /dev/random from the pi. But how do I connect the /dev/random of the pi to the /dev/random of my laptop. Is there an interface to add a random number generator.

I hope my proposed setup is clear. I hope I can get some comments on this, any feedback is welcome.

  • Related (if not duplicate): Feeding /dev/random entropy pool?, and if that's not what you're looking for, then the question is off-topic since you're asking for OS configurations. – Adnan Oct 15 '13 at 13:47
  • I have looked at that post before asking my question and it did not really contain the answer I was looking for. – Hoogendijk Oct 15 '13 at 14:57
  • Obviously! Because you wanted someone to teach you how to do cat randomfilefromrasp > /dev/random. A question more appropriate for SuperUser. – Adnan Oct 15 '13 at 15:15
  • For servers (including VMs) it is usually better to get a dedicted HWRNG (they start at 40 quids) already) or haveged, which feeds the data to to host and possibly to the VM guests as well. Creating a good HWRNG is difficult. Not impossible but still difficult. – peterph Oct 15 '13 at 21:04

As the Wikipedia page says:

It is also possible to write to /dev/random. This allows any user to mix random data into the pool. Non-random data is harmless, because only a privileged user can issue the ioctl needed to increase the entropy estimate. The current amount of entropy and the size of the Linux kernel entropy pool are available in /proc/sys/kernel/random/, which can be displayed by the command cat /proc/sys/kernel/random/entropy_avail.

So, in your case, if you are really intent on injecting some randomness obtained from the RaspberryPi as a file, then all you need is to write the file into /dev/random with a simple "cat randomfilefromrasp > /dev/random". What would be more complex (and require extra rights) would be to assert that the extra randomness ensures some given value of extra "entropy". But it matters only for the irksome blocking mechanism of /dev/random (this device tends to block when it supposes that it has burnt all its entropy); your extra file still gets added to the mix and will contribute to the actual entropy (i.e. you do get the security benefits, even if the kernel does not notice it).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy