3 ms·
Last time i checked, /dev/random was receiving entropy from * The kernel command line string at boot. * Every time there is an input event (mouse, keyboard, .
by CodeArtisan 5y ago
Last time i checked, /dev/random was receiving entropy from
* The kernel command line string at boot.
* Every time there is an input event (mouse, keyboard, ...).
* Every time there is a disk event.
* By retrieving the cpu cycles counter (RDTSC on x86) from random interrupts.
* Hardware RNGs(RDRAND on x86).
* From latent entropy every time a process is created.
Latent entropy is a 64 bits unsigned that has its state modified every time a procedure with the attribute latent_entropy is executed. The latent_entropy attribute is implemented by a GCC plugin and adds random operations on the latent_entropy seed to a procedure. For example
void foo(bool a) __attribute__((latent_entropy))
{
if (a)
bar();
else
baz();
}
become
void foo(bool a) __attribute__((latent_entropy))
{
if (a)
{
latent_entropy OP NUMBER;
bar();
}
else
{
latent_entropy OP NUMBER;
baz();
}
}
where OP (*= += -= ^= ...) and NUMBER are randomly generated at compilation time.
Many kernel procedures handling interrupts have the latent_entropy attribute.
more information at https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/scripts/gcc-plugins/latent_entropy_plugin.c https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...