1 --- a/src/crypto/random.c
2 +++ b/src/crypto/random.c
5 #define MIN_READY_MARK 2
7 +#ifndef CONFIG_NO_RANDOM_POOL
9 static u32 pool[POOL_WORDS];
10 static unsigned int input_rotate = 0;
11 static unsigned int pool_pos = 0;
12 @@ -120,7 +122,7 @@ static void random_extract(u8 *out)
16 -void random_add_randomness(const void *buf, size_t len)
17 +static void random_pool_add_randomness(const void *buf, size_t len)
20 static unsigned int count = 0;
21 @@ -260,3 +262,22 @@ void random_mark_pool_ready(void)
22 wpa_printf(MSG_DEBUG, "random: Mark internal entropy pool to be "
23 "ready (count=%u/%u)", own_pool_ready, MIN_READY_MARK);
26 +#endif /* CONFIG_NO_RANDOM_POOL */
29 +void random_add_randomness(const void *buf, size_t len)
34 + fd = open("/dev/random", O_RDWR);
36 + write(fd, buf, len);
40 +#ifndef CONFIG_NO_RANDOM_POOL
41 + random_pool_add_randomness(buf, len);
44 --- a/hostapd/Makefile
45 +++ b/hostapd/Makefile
46 @@ -698,11 +698,11 @@ endif
47 ifdef CONFIG_NO_RANDOM_POOL
48 CFLAGS += -DCONFIG_NO_RANDOM_POOL
50 -OBJS += ../src/crypto/random.o
51 -HOBJS += ../src/crypto/random.o
53 HOBJS += ../src/crypto/md5.o
55 +OBJS += ../src/crypto/random.o
56 +HOBJS += ../src/crypto/random.o
58 ifdef CONFIG_RADIUS_SERVER
59 CFLAGS += -DRADIUS_SERVER
60 --- a/wpa_supplicant/Makefile
61 +++ b/wpa_supplicant/Makefile
62 @@ -1101,9 +1101,8 @@ endif
64 ifdef CONFIG_NO_RANDOM_POOL
65 CFLAGS += -DCONFIG_NO_RANDOM_POOL
67 -OBJS += ../src/crypto/random.o
69 +OBJS += ../src/crypto/random.o
71 ifdef CONFIG_CTRL_IFACE
72 ifeq ($(CONFIG_CTRL_IFACE), y)
73 --- a/wpa_supplicant/Android.mk
74 +++ b/wpa_supplicant/Android.mk
75 @@ -1102,9 +1102,8 @@ endif
77 ifdef CONFIG_NO_RANDOM_POOL
78 L_CFLAGS += -DCONFIG_NO_RANDOM_POOL
80 -OBJS += src/crypto/random.c
82 +OBJS += src/crypto/random.c
84 ifdef CONFIG_CTRL_IFACE
85 ifeq ($(CONFIG_CTRL_IFACE), y)
86 --- a/hostapd/Android.mk
87 +++ b/hostapd/Android.mk
88 @@ -717,11 +717,11 @@ endif
89 ifdef CONFIG_NO_RANDOM_POOL
90 L_CFLAGS += -DCONFIG_NO_RANDOM_POOL
92 -OBJS += src/crypto/random.c
93 -HOBJS += src/crypto/random.c
95 HOBJS += src/crypto/md5.c
97 +OBJS += src/crypto/random.c
98 +HOBJS += src/crypto/random.c
100 ifdef CONFIG_RADIUS_SERVER
101 L_CFLAGS += -DRADIUS_SERVER
102 --- a/src/crypto/random.h
103 +++ b/src/crypto/random.h
107 #ifdef CONFIG_NO_RANDOM_POOL
108 -#define random_add_randomness(b, l) do { } while (0)
109 #define random_get_bytes(b, l) os_get_random((b), (l))
110 #define random_pool_ready() 1
111 #define random_mark_pool_ready() do { } while (0)
112 #else /* CONFIG_NO_RANDOM_POOL */
113 -void random_add_randomness(const void *buf, size_t len);
114 int random_get_bytes(void *buf, size_t len);
115 int random_pool_ready(void);
116 void random_mark_pool_ready(void);
117 #endif /* CONFIG_NO_RANDOM_POOL */
118 +void random_add_randomness(const void *buf, size_t len);
120 #endif /* RANDOM_H */