random: Read /dev/random in the background with eloop read socket

This makes it more likely to be able to fetch the 20 octet seed from
/dev/random in cases where other programs may also be competing for
this.
This commit is contained in:
Jouni Malinen 2011-03-22 23:15:00 +02:00
parent c4bb881743
commit d47fa330b8
4 changed files with 91 additions and 2 deletions

View file

@ -1,6 +1,6 @@
/*
* Random number generator
* Copyright (c) 2010, Jouni Malinen <j@w1.fi>
* Copyright (c) 2010-2011, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@ -16,11 +16,15 @@
#define RANDOM_H
#ifdef CONFIG_NO_RANDOM_POOL
#define random_init() do { } while (0)
#define random_deinit() do { } while (0)
#define random_add_randomness(b, l) do { } while (0)
#define random_get_bytes(b, l) os_get_random((b), (l))
#define random_pool_ready() 1
#define random_mark_pool_ready() do { } while (0)
#else /* CONFIG_NO_RANDOM_POOL */
void random_init(void);
void random_deinit(void);
void random_add_randomness(const void *buf, size_t len);
int random_get_bytes(void *buf, size_t len);
int random_pool_ready(void);