source: branches/backfire/package/hostapd/patches/700-random_pool_add_kernel.patch @ 26370

Last change on this file since 26370 was 26370, checked in by nbd, 5 years ago

backport mac80211, hostapd, iw, crda from trunk as of r26369

File size: 2.9 KB
  • src/crypto/random.c

    a b  
    4747#define EXTRACT_LEN 16 
    4848#define MIN_READY_MARK 2 
    4949 
     50#ifndef CONFIG_NO_RANDOM_POOL 
     51 
    5052static u32 pool[POOL_WORDS]; 
    5153static unsigned int input_rotate = 0; 
    5254static unsigned int pool_pos = 0; 
    static void random_extract(u8 *out) 
    120122} 
    121123 
    122124 
    123 void random_add_randomness(const void *buf, size_t len) 
     125static void random_pool_add_randomness(const void *buf, size_t len) 
    124126{ 
    125127        struct os_time t; 
    126128        static unsigned int count = 0; 
    void random_mark_pool_ready(void) 
    260262        wpa_printf(MSG_DEBUG, "random: Mark internal entropy pool to be " 
    261263                   "ready (count=%u/%u)", own_pool_ready, MIN_READY_MARK); 
    262264} 
     265 
     266#endif /* CONFIG_NO_RANDOM_POOL */ 
     267 
     268 
     269void random_add_randomness(const void *buf, size_t len) 
     270{ 
     271#ifdef __linux__ 
     272        int fd; 
     273 
     274        fd = open("/dev/random", O_RDWR); 
     275        if (fd >= 0) { 
     276                write(fd, buf, len); 
     277                close(fd); 
     278        } 
     279#endif 
     280#ifndef CONFIG_NO_RANDOM_POOL 
     281        random_pool_add_randomness(buf, len); 
     282#endif 
     283} 
  • hostapd/Makefile

    a b endif 
    698698ifdef CONFIG_NO_RANDOM_POOL 
    699699CFLAGS += -DCONFIG_NO_RANDOM_POOL 
    700700else 
    701 OBJS += ../src/crypto/random.o 
    702 HOBJS += ../src/crypto/random.o 
    703701HOBJS += $(SHA1OBJS) 
    704702HOBJS += ../src/crypto/md5.o 
    705703endif 
     704OBJS += ../src/crypto/random.o 
     705HOBJS += ../src/crypto/random.o 
    706706 
    707707ifdef CONFIG_RADIUS_SERVER 
    708708CFLAGS += -DRADIUS_SERVER 
  • wpa_supplicant/Makefile

    a b endif 
    11011101 
    11021102ifdef CONFIG_NO_RANDOM_POOL 
    11031103CFLAGS += -DCONFIG_NO_RANDOM_POOL 
    1104 else 
    1105 OBJS += ../src/crypto/random.o 
    11061104endif 
     1105OBJS += ../src/crypto/random.o 
    11071106 
    11081107ifdef CONFIG_CTRL_IFACE 
    11091108ifeq ($(CONFIG_CTRL_IFACE), y) 
  • wpa_supplicant/Android.mk

    a b endif 
    11021102 
    11031103ifdef CONFIG_NO_RANDOM_POOL 
    11041104L_CFLAGS += -DCONFIG_NO_RANDOM_POOL 
    1105 else 
    1106 OBJS += src/crypto/random.c 
    11071105endif 
     1106OBJS += src/crypto/random.c 
    11081107 
    11091108ifdef CONFIG_CTRL_IFACE 
    11101109ifeq ($(CONFIG_CTRL_IFACE), y) 
  • hostapd/Android.mk

    a b endif 
    717717ifdef CONFIG_NO_RANDOM_POOL 
    718718L_CFLAGS += -DCONFIG_NO_RANDOM_POOL 
    719719else 
    720 OBJS += src/crypto/random.c 
    721 HOBJS += src/crypto/random.c 
    722720HOBJS += $(SHA1OBJS) 
    723721HOBJS += src/crypto/md5.c 
    724722endif 
     723OBJS += src/crypto/random.c 
     724HOBJS += src/crypto/random.c 
    725725 
    726726ifdef CONFIG_RADIUS_SERVER 
    727727L_CFLAGS += -DRADIUS_SERVER 
  • src/crypto/random.h

    a b  
    1616#define RANDOM_H 
    1717 
    1818#ifdef CONFIG_NO_RANDOM_POOL 
    19 #define random_add_randomness(b, l) do { } while (0) 
    2019#define random_get_bytes(b, l) os_get_random((b), (l)) 
    2120#define random_pool_ready() 1 
    2221#define random_mark_pool_ready() do { } while (0) 
    2322#else /* CONFIG_NO_RANDOM_POOL */ 
    24 void random_add_randomness(const void *buf, size_t len); 
    2523int random_get_bytes(void *buf, size_t len); 
    2624int random_pool_ready(void); 
    2725void random_mark_pool_ready(void); 
    2826#endif /* CONFIG_NO_RANDOM_POOL */ 
     27void random_add_randomness(const void *buf, size_t len); 
    2928 
    3029#endif /* RANDOM_H */ 
Note: See TracBrowser for help on using the repository browser.