From: David Brodski Date: Tue, 12 Oct 2010 21:04:57 +0000 (+0000) Subject: changed to better random number generator X-Git-Tag: initial-import-from-subversion-38251~20066 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=10289c52b1b6f2be52f33746d8855da7fb12d67e;p=oweals%2Fgnunet.git changed to better random number generator --- diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index d0187af8b..102bbb1c4 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -31,8 +31,8 @@ endif if HAVE_PCAP if LINUX -WANBIN = gnunet-transport-wlan-helper -WLAN_PLUGIN_LA = libgnunet_plugin_transport_wlan.la + WANBIN = gnunet-transport-wlan-helper + WLAN_PLUGIN_LA = libgnunet_plugin_transport_wlan.la endif endif diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index a6affd4fd..765d8721d 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c @@ -33,6 +33,7 @@ #include "plugin_transport.h" #include "plugin_transport_wlan.h" #include "gnunet_common.h" +#include "gnunet_crypto_lib.h" #define PROTOCOL_PREFIX "wlan" @@ -409,12 +410,7 @@ uint16_t getcrc16 (const char *msgbuf, size_t msgbuf_size); uint32_t get_next_message_id() { - // FIXME find good random generator - if (RAND_MAX < UINT32_MAX){ - return (random() * random()) % UINT32_MAX; - } else { - return random() % UINT32_MAX; - } + return GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX); } /** @@ -424,8 +420,7 @@ get_next_message_id() void start_next_message_id() { - //FIXME not good - srand(GNUNET_TIME_absolute_get().value); + //GNUNET_CRYPTO_random_init; }