/dev/random entropy population

Submitted by Anonymous
on August 9, 2007 - 9:34pm

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

/dev/random entropy population

Venky
on
August 15, 2007 - 5:16am

When we specify the SA_SAMPLE_RANDOM as one of the flags in the register_irq function,
then the timing of the interrupts from this device is fed to to the pool as entropy.

-vks

Update

Anonymous
on
August 15, 2007 - 10:55am

Venky,
Thank you for your reply.
After no response here, I decided to post the same question to comp.os.linux.misc.
After seeing this most recent reply I decided to check the news group, and found that someone else has answered the question as well, but covering the underlying system that addresses the seemingly mysterious way the actual device is filled with data and not just the static array in the driver.

And this is another wonderful response:
http://groups.google.com/group/comp.os.linux.misc/browse_thread/thread/c...

-Matt

upd

Venky
on
August 16, 2007 - 10:01pm

Hi Matt,

Yes, that was a really good answer on the Google group. So it calls the required 'read' fuction when
we do some operation on the device.

Rgds,
-vks

drivers/char/random.c:1120 c

Anonymous (not verified)
on
August 15, 2007 - 1:50pm

drivers/char/random.c:1120

const struct file_operations random_fops = {
   .read  = random_read,
   .write = random_write,
   .poll  = random_poll,
   .ioctl = random_ioctl,
};

const struct file_operations urandom_fops = {
   .read  = urandom_read,
   .write = random_write,
   .ioctl = random_ioctl,
};

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.