Re: hw rng

From: Henrique de Moraes Holschuh
Date: Fri Sep 09 2011 - 21:17:29 EST


On Fri, 09 Sep 2011, jyothi v wrote:
> Linux provides hardware random registry.
> I would like to know how is it useful.

You use something like this:
http://packages.debian.org/search?keywords=rng-tools

to deal with the entropy from the TRNG (/dev/hw_random) and feed it back to
the kernel, so that it becomes available to the rest of the system (the
kernel itself, and any normal randomness users that get it from /dev/random
and /dev/urandom).

Some hardware RNGs don't use /dev/hw_random, and require specific userspace
drivers instead of rng-tools.

> Is there any RNG system calls/APIs for generating random numbers at
> Linux user space?

There are some book-keeping ioctl() for /dev/random, which stuff like
rng-tools needs to use to feed entropy back to the kernel and to gauge the
amount of entropy the kernel has.

But to _read_ random data, you just do direct reads from /dev/random or
/dev/urandom.

> If I need random data at user space application, what should I do?

Read it from /dev/urandom if your userspace application would rather receive
the output of a kernel-shielded CRNG when system entropy is low instead of
blocking. Otherwise, read it from /dev/random, which will block when system
entropy is too low to service the read request.

And get something like this if you will need too much high-quality random
data, or will need high-quality random data from a system that doesn't have
much keyboard and disk activity: http://www.entropykey.co.uk/

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
--
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/