]> git.ipfire.org Git - thirdparty/hostap.git/blob - src/crypto/random.h
random: Add support for maintaining internal entropy store over restarts
[thirdparty/hostap.git] / src / crypto / random.h
1 /*
2 * Random number generator
3 * Copyright (c) 2010-2011, Jouni Malinen <j@w1.fi>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * See README and COPYING for more details.
13 */
14
15 #ifndef RANDOM_H
16 #define RANDOM_H
17
18 #ifdef CONFIG_NO_RANDOM_POOL
19 #define random_init(e) do { } while (0)
20 #define random_deinit() do { } while (0)
21 #define random_add_randomness(b, l) do { } while (0)
22 #define random_get_bytes(b, l) os_get_random((b), (l))
23 #define random_pool_ready() 1
24 #define random_mark_pool_ready() do { } while (0)
25 #else /* CONFIG_NO_RANDOM_POOL */
26 void random_init(const char *entropy_file);
27 void random_deinit(void);
28 void random_add_randomness(const void *buf, size_t len);
29 int random_get_bytes(void *buf, size_t len);
30 int random_pool_ready(void);
31 void random_mark_pool_ready(void);
32 #endif /* CONFIG_NO_RANDOM_POOL */
33
34 #endif /* RANDOM_H */