module_init(rand_initialize);
rand_initialize()
init_std_data(&input_pool);
init_std_data(&blocking_pool);
init_std_data(&nonblocking_pool);
struct poolinfo {
int poolwords;
int tap1, tap2, tap3, tap4, tap5;
} poolinfo_table[] = {
{128, 103, 76, 51, 25, 1},
{32, 26, 20, 14, 7, 1}
};
struct entropy_store {
struct poolinfo *poolinfo;
__u32 *pool;
const char *name;
struct entropy_store *pull;
int limit;
spinlock_t lock;
unsigned add_ptr;
int entropy_count;
int input_rotate;
___u8 last_data[EXTRACT_SIZE = 10];
};
__u32 input_pool_data[INPUT_POOL_WORDS = 128];
__u32 blocking_pool_data[OUTPUT_POOL_WORDS = 32];
__u32 nonblocking_pool_data[OUTPUT_POOL_WORDS = 32];
struct entropy_store input_pool = {
.poolinfo = &poolinfo_table[0],
.name = "input",
limit = 1,
.pool = input_pool_data
}
blocking_pool = {
.poolinfo = &poolinfo_table[1],
.pull = input_pool,
.limit = 1,
.pool = blocking_pool_data
}
nonblocking_pool = {
.poolinfo = &poolinfo_table[1],
.pull = input_pool,
.pool = nonblocking_pool_data
}
init_std_data(struct entropy_store *r)
r->entropy_count = 0;
now = ktime_get_real();
mix_pool_bytes(r, &now);
mix_pool_bytes(r, utsname());
mix_pool_bytes => mix_pool_bytes_extract(r, data, datalen)
get_random_bytes(void *buf, int nbytes)
extract_entropy(&nonblocking_pool, buf, nbytes, min = 0, reserved = 0);
random_read()
while (nbytes) {
extract_entropy_user(&blocking_pool, buf, n);
if (n == 0) {
wait_event_interruptible(random_read_wait);
}
}
urandom_read()
extract_entropy_user(&nonblocking_pool, buf, n);
proc_do_uuid()
generate_random_uuid();