Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

/dev/random entropy population

4 views
Skip to first unread message

Matt

unread,
Aug 12, 2007, 3:52:07 PM8/12/07
to
I have been exploring the kernel's random driver located in drivers/
char/random.c
I was trying to find out where data actually populates /dev/random
and /dev/urandom devices. It appears that random.c is actually
populating static
integer arrays and not the devices. The public interface to random.c
seems to only manipulate those static arrays and not the devices.
Where is data actually dumped into /dev/random?

Thanks

-Matt

Igmar Palsenberg

unread,
Aug 15, 2007, 3:50:24 AM8/15/07
to

It isn't actually dumped. /dev/random and /dev/urandom have major number
1, which means that they are part of the MEM_MAJOR device. That is
registered in chr_dev_init() in driver/char/mem.c

Opening a device with major number 1 results in a call to memory_open()
, which is a case statement, which references a struct, and then calls
the open function in that struct. That struct is either random_fops or
urandom_fops, which are both in drivers/char/random.c.

An operation on that devices calls on of the functions referenced in
that struct (random_read(), urandom_read()).

Igmar

Matt

unread,
Aug 15, 2007, 10:13:54 PM8/15/07
to
On Aug 15, 3:50 am, Igmar Palsenberg <ig...@palsenberg.local> wrote:
> Matt wrote:
> > I have been exploring the kernel's random driver located in drivers/
> > char/random.c
> > I was trying to find out where data actually populates /dev/random
> > and /dev/urandom devices. It appears that random.c is actually
> > populating static
> > integer arrays and not the devices. The public interface to random.c
> > seems to only manipulate those static arrays and not the devices.
> > Where is data actually dumped into /dev/random?
>
> It isn't actually dumped. /dev/randomand /dev/urandom have major number

> 1, which means that they are part of the MEM_MAJOR device. That is
> registered in chr_dev_init() in driver/char/mem.c
>
> Opening a device with major number 1 results in a call to memory_open()
> , which is a case statement, which references a struct, and then calls
> the open function in that struct. That struct is either random_fops or
> urandom_fops, which are both in drivers/char/random.c.
>
> An operation on that devices calls on of the functions referenced in
> that struct (random_read(), urandom_read()).

Igmar,
Thank you very much. That is the reply I was looking for.

-Matt

0 new messages