It is mentioned in the kernel source in random.c
that get_random_int
is “Similar to urandom but with the goal of minimal entropy pool depletion”. However, where (and how) does get_random_int
interact with the entropy pool?
Now, urandom
actually calls extract_entropy_user
, but I don't see anything similar to that in get_random_int
. It seems that get_random_int
uses its own sources of entropy (unrelated to keyboard, mouse and disk activity):
hash[0] += current->pid + jiffies + get_cycles();
and does not care about (nor update) the state of the entropy available to the system in general?
How does get_random_int
deplete the entropy pool? Where does this get updated? I know I'm missing something or reading the source wrong, because when I execute a program I can see how it depletes the entropy pool just by executing cat on entropy_avail.
I've looked through http://xorl.wordpress.com/2011/01/16/linux-kernel-aslr-implementation/ but it doesn't seem to mention how this works.