hostapd: add a separate config symbol for 802.11n driver support
[openwrt.git] / package / hostapd / patches / 700-use_dev_urandom.patch
1 --- a/src/crypto/random.c
2 +++ b/src/crypto/random.c
3 @@ -202,16 +202,16 @@ int random_pool_ready(void)
4  
5         /*
6          * Try to fetch some more data from the kernel high quality
7 -        * /dev/random. There may not be enough data available at this point,
8 +        * /dev/urandom. There may not be enough data available at this point,
9          * so use non-blocking read to avoid blocking the application
10          * completely.
11          */
12 -       fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
13 +       fd = open("/dev/urandom", O_RDONLY | O_NONBLOCK);
14         if (fd < 0) {
15  #ifndef CONFIG_NO_STDOUT_DEBUG
16                 int error = errno;
17 -               perror("open(/dev/random)");
18 -               wpa_printf(MSG_ERROR, "random: Cannot open /dev/random: %s",
19 +               perror("open(/dev/urandom)");
20 +               wpa_printf(MSG_ERROR, "random: Cannot open /dev/urandom: %s",
21                            strerror(error));
22  #endif /* CONFIG_NO_STDOUT_DEBUG */
23                 return -1;
24 @@ -220,12 +220,12 @@ int random_pool_ready(void)
25         res = read(fd, dummy_key + dummy_key_avail,
26                    sizeof(dummy_key) - dummy_key_avail);
27         if (res < 0) {
28 -               wpa_printf(MSG_ERROR, "random: Cannot read from /dev/random: "
29 +               wpa_printf(MSG_ERROR, "random: Cannot read from /dev/urandom: "
30                            "%s", strerror(errno));
31                 res = 0;
32         }
33         wpa_printf(MSG_DEBUG, "random: Got %u/%u bytes from "
34 -                  "/dev/random", (unsigned) res,
35 +                  "/dev/urandom", (unsigned) res,
36                    (unsigned) (sizeof(dummy_key) - dummy_key_avail));
37         dummy_key_avail += res;
38         close(fd);
39 @@ -234,7 +234,7 @@ int random_pool_ready(void)
40                 return 1;
41  
42         wpa_printf(MSG_INFO, "random: Only %u/%u bytes of strong "
43 -                  "random data available from /dev/random",
44 +                  "random data available from /dev/urandom",
45                    (unsigned) dummy_key_avail, (unsigned) sizeof(dummy_key));
46  
47         if (own_pool_ready >= MIN_READY_MARK ||