Re: [PATCH 1/2] random: Add support for architectural random hooks

From: Bryan Donlan
Date: Sat Jul 30 2011 - 23:18:06 EST


On Sat, Jul 30, 2011 at 22:42, Henrique de Moraes Holschuh
<hmh@xxxxxxxxxx> wrote:
> On Sat, 30 Jul 2011, Bryan Donlan wrote:
>> In any case though, what about my suggestion - don't mess with urandom
>> at all, and let udev replace the /dev/urandom device node with one
>> directed to a fast hwrng device if one is detected? This has zero
>
> Now, THAT would be unsafe, and a nasty way to go about it.

I don't see why it's unsafe. It's leaving the policy decision of what
RNG to use up to userspace, without needing to introduce any new API
or parameter to do so. As long as the replacement device exposes the
same interface as /dev/urandom, no problem, right? Userspace programs
shouldn't notice the difference unless they stat() /dev/urandom and
look at the device numbers.

I do realize it's a bit unorthodox to replace what has, traditionally,
been a fixed device node with a configurable symlink, but there's no
technical reason (as far as I can see) why it shouldn't work.

> If you really don't want to touch /dev/.random, make it simple: either
> export the embedded RNG as high-bandwidth /dev/hwrandom and let
> userspace postprocess it and reroute it back to /dev/random as needed,
> or do the same with a kernel thread.

This approach is identical to mine as far as the kernel is concerned :)
You'd set up a daemon to pump entropy into /dev/random. Users who want
/dev/urandom to be even faster/more secure(?) can further symlink
/dev/urandom to /dev/hwrandom. But there's no need to change
/dev/urandom's implementation in the kernel to redirect it to the
hwrng when userspace can do that just as well on its own, is my point.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/