2

I'm in the process of designing and building a quantum random number generator for high security applications (and potentially data centres). As part of this, I would like to feed the random numbers generated by my device into /dev/random/ so that the end-users don't need to modify their applications to use a new RN source. They would just be able to plug it in and improve the entropy in `/dev/random/'.

Obviously, I'll have to write a device driver to deal with getting the random data from my device over USB or PCI-E (haven't decided which interface I'll use yet). However, I have no idea how I'd be able to go about adding this random data to the entropy pool available to /dev/random/ any ideas?

The other option (I would think) would be to replace /dev/random/ with my device driver and ensure that it has all of the necessary behaviours but that doesn't seem like a good idea...

2

replace /dev/random with my device driver

That's extremely difficult to pull off as you'd also have to replicate all current and future interfaces, or you'd break a lot of things. Maybe take a look at the source code to get an impression of it (output and input interfaces documented in length in a sourcecode comment).

I'll have to write a device driver

It depends. For example there are "random generators" that just pretend to be USB keyboards and send random data (or passwords, encryption keys, one time pads, ...) through that channel so no dedicated device driver necessary, instead it's just piggy-backed onto existing drivers.

In general the system entropy can be influenced from user space, see systemd-random-seed.service or the RNDADDENTROPY ioctl that haveged and other such tools use.

With all of these methods, however, the kernel is still in control of the data returned by the /dev/[u]random devices. You can't predict it. If you want it to literally use the random data you yourself produced, you'll have to read it from your device directly without going through the kernels random device.

  • Thanks, this is extremely helpful! I'll have to assess how well the kernel mixes different entropy sources together to determine whether or not it's better to use my device solely or to combine it with the classical sources used by the kernel. – Persistence Oct 4 '19 at 12:09
  • There's a lot of subtle issures regarding randomness. Even if you had a device that produced better random data that the kernel, simply the fact that you are transmitting it over a channel that might be listened into, could make it worse than the kernel. You just have to accept that you are not in control of the end result. – frostschutz Oct 4 '19 at 12:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.