mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
To: jyothi v <jyos.v.s@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: hw rng
Date: Fri, 9 Sep 2011 22:17:21 -0300	[thread overview]
Message-ID: <20110910011720.GA10111@khazad-dum.debian.net> (raw)
In-Reply-To: <CAF5Aa4NMjB6H0g=reJKW2xPUg=M_x5vc5DbdhzvXcnznKvePFw@mail.gmail.com>

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

  reply	other threads:[~2011-09-10  1:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-09 13:15 jyothi v
2011-09-10  1:17 ` Henrique de Moraes Holschuh [this message]
     [not found] <CAF5Aa4Mp9oN-rgSwoXXrV7ymYj0JTMVZhj+emzY9DNoBMEnr=A@mail.gmail.com>
     [not found] ` <CAF5Aa4MfPu2sVTnTh-eeFHScW9ttobVd4_XV6Ygs9asN8yY=bw@mail.gmail.com>
     [not found]   ` <CAF5Aa4O5SmmjJUviGkPCTH3iGm3kh71X7G2o6ZeTUP3q6aX+qQ@mail.gmail.com>
2011-09-09 11:16     ` jyothi v

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110910011720.GA10111@khazad-dum.debian.net \
    --to=hmh@hmh.eng.br \
    --cc=jyos.v.s@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®