xref: /freebsd/contrib/wpa/src/crypto/random.h (revision e8643b01e6312a56d1e44a760fb4e95f0b10b54c)
1 /*
2  * Random number generator
3  * Copyright (c) 2010-2011, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #ifndef RANDOM_H
10 #define RANDOM_H
11 
12 #ifdef CONFIG_NO_RANDOM_POOL
13 #define random_init(e) do { } while (0)
14 #define random_deinit() do { } while (0)
15 #define random_add_randomness(b, l) do { } while (0)
16 #define random_get_bytes(b, l) os_get_random((b), (l))
17 #define random_pool_ready() 1
18 #define random_mark_pool_ready() do { } while (0)
19 #else /* CONFIG_NO_RANDOM_POOL */
20 void random_init(const char *entropy_file);
21 void random_deinit(void);
22 void random_add_randomness(const void *buf, size_t len);
23 int random_get_bytes(void *buf, size_t len);
24 int random_pool_ready(void);
25 void random_mark_pool_ready(void);
26 #endif /* CONFIG_NO_RANDOM_POOL */
27 
28 #endif /* RANDOM_H */
29