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
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
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
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
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, };