summaryrefslogtreecommitdiffstats
path: root/package/hostapd/patches/700-random_pool_add_kernel.patch
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-03-27 10:42:47 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-03-27 10:42:47 +0000
commite827a711a35efacd0220abfe79ab362db5a77db9 (patch)
tree6152a8d66dd59100d19d70d520a282c5235efb70 /package/hostapd/patches/700-random_pool_add_kernel.patch
parentec7be8a5b2db78dadc0d38ff3cfc51be89535fff (diff)
hostapd: update to 20120326
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31080 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/hostapd/patches/700-random_pool_add_kernel.patch')
-rw-r--r--package/hostapd/patches/700-random_pool_add_kernel.patch168
1 files changed, 0 insertions, 168 deletions
diff --git a/package/hostapd/patches/700-random_pool_add_kernel.patch b/package/hostapd/patches/700-random_pool_add_kernel.patch
deleted file mode 100644
index 1a30a0266..000000000
--- a/package/hostapd/patches/700-random_pool_add_kernel.patch
+++ /dev/null
@@ -1,168 +0,0 @@
---- a/src/crypto/random.c
-+++ b/src/crypto/random.c
-@@ -38,6 +38,8 @@
- #include "sha1.h"
- #include "random.h"
-
-+#define RANDOM_STAMPFILE "/var/run/.random_available"
-+
- #define POOL_WORDS 32
- #define POOL_WORDS_MASK (POOL_WORDS - 1)
- #define POOL_TAP1 26
-@@ -48,6 +50,8 @@
- #define EXTRACT_LEN 16
- #define MIN_READY_MARK 2
-
-+#ifndef CONFIG_NO_RANDOM_POOL
-+
- static u32 pool[POOL_WORDS];
- static unsigned int input_rotate = 0;
- static unsigned int pool_pos = 0;
-@@ -128,7 +132,7 @@ static void random_extract(u8 *out)
- }
-
-
--void random_add_randomness(const void *buf, size_t len)
-+static void random_pool_add_randomness(const void *buf, size_t len)
- {
- struct os_time t;
- static unsigned int count = 0;
-@@ -197,16 +201,22 @@ int random_get_bytes(void *buf, size_t l
- int random_pool_ready(void)
- {
- #ifdef __linux__
-+ struct stat st;
- int fd;
- ssize_t res;
-
-+ if (stat(RANDOM_STAMPFILE, &st) == 0)
-+ return 1;
-+
- /*
- * Make sure that there is reasonable entropy available before allowing
- * some key derivation operations to proceed.
- */
-
-- if (dummy_key_avail == sizeof(dummy_key))
-+ if (dummy_key_avail == sizeof(dummy_key)) {
-+ random_mark_pool_ready();
- return 1; /* Already initialized - good to continue */
-+ }
-
- /*
- * Try to fetch some more data from the kernel high quality
-@@ -241,6 +251,7 @@ int random_pool_ready(void)
- if (dummy_key_avail == sizeof(dummy_key)) {
- if (own_pool_ready < MIN_READY_MARK)
- own_pool_ready = MIN_READY_MARK;
-+ random_mark_pool_ready();
- random_write_entropy();
- return 1;
- }
-@@ -253,6 +264,7 @@ int random_pool_ready(void)
- total_collected + 10 * own_pool_ready > MIN_COLLECT_ENTROPY) {
- wpa_printf(MSG_INFO, "random: Allow operation to proceed "
- "based on internal entropy");
-+ random_mark_pool_ready();
- return 1;
- }
-
-@@ -268,10 +280,16 @@ int random_pool_ready(void)
-
- void random_mark_pool_ready(void)
- {
-+ int fd;
-+
- own_pool_ready++;
- wpa_printf(MSG_DEBUG, "random: Mark internal entropy pool to be "
- "ready (count=%u/%u)", own_pool_ready, MIN_READY_MARK);
- random_write_entropy();
-+
-+ fd = open(RANDOM_STAMPFILE, O_CREAT | O_WRONLY | O_EXCL | O_NOFOLLOW, 0600);
-+ if (fd >= 0)
-+ close(fd);
- }
-
-
-@@ -428,3 +446,22 @@ void random_deinit(void)
- os_free(random_entropy_file);
- random_entropy_file = NULL;
- }
-+
-+#endif /* CONFIG_NO_RANDOM_POOL */
-+
-+
-+void random_add_randomness(const void *buf, size_t len)
-+{
-+#ifdef __linux__
-+ int fd;
-+
-+ fd = open("/dev/random", O_RDWR);
-+ if (fd >= 0) {
-+ write(fd, buf, len);
-+ close(fd);
-+ }
-+#endif
-+#ifndef CONFIG_NO_RANDOM_POOL
-+ random_pool_add_randomness(buf, len);
-+#endif
-+}
---- a/wpa_supplicant/Makefile
-+++ b/wpa_supplicant/Makefile
-@@ -1137,9 +1137,8 @@ endif
-
- ifdef CONFIG_NO_RANDOM_POOL
- CFLAGS += -DCONFIG_NO_RANDOM_POOL
--else
--OBJS += ../src/crypto/random.o
- endif
-+OBJS += ../src/crypto/random.o
-
- ifdef CONFIG_CTRL_IFACE
- ifeq ($(CONFIG_CTRL_IFACE), y)
---- a/wpa_supplicant/Android.mk
-+++ b/wpa_supplicant/Android.mk
-@@ -1132,9 +1132,8 @@ endif
-
- ifdef CONFIG_NO_RANDOM_POOL
- L_CFLAGS += -DCONFIG_NO_RANDOM_POOL
--else
--OBJS += src/crypto/random.c
- endif
-+OBJS += src/crypto/random.c
-
- ifdef CONFIG_CTRL_IFACE
- ifeq ($(CONFIG_CTRL_IFACE), y)
---- a/hostapd/Android.mk
-+++ b/hostapd/Android.mk
-@@ -720,11 +720,11 @@ endif
- ifdef CONFIG_NO_RANDOM_POOL
- L_CFLAGS += -DCONFIG_NO_RANDOM_POOL
- else
--OBJS += src/crypto/random.c
--HOBJS += src/crypto/random.c
- HOBJS += $(SHA1OBJS)
- HOBJS += src/crypto/md5.c
- endif
-+OBJS += src/crypto/random.c
-+HOBJS += src/crypto/random.c
-
- ifdef CONFIG_RADIUS_SERVER
- L_CFLAGS += -DRADIUS_SERVER
---- a/hostapd/Makefile
-+++ b/hostapd/Makefile
-@@ -707,12 +707,12 @@ endif
- ifdef CONFIG_NO_RANDOM_POOL
- CFLAGS += -DCONFIG_NO_RANDOM_POOL
- else
--OBJS += ../src/crypto/random.o
--HOBJS += ../src/crypto/random.o
- HOBJS += ../src/utils/eloop.o
- HOBJS += $(SHA1OBJS)
- HOBJS += ../src/crypto/md5.o
- endif
-+OBJS += ../src/crypto/random.o
-+HOBJS += ../src/crypto/random.o
-
- ifdef CONFIG_RADIUS_SERVER
- CFLAGS += -DRADIUS_SERVER