From 10289c52b1b6f2be52f33746d8855da7fb12d67e Mon Sep 17 00:00:00 2001 From: David Brodski Date: Tue, 12 Oct 2010 21:04:57 +0000 Subject: [PATCH] changed to better random number generator --- src/transport/Makefile.am | 4 ++-- src/transport/plugin_transport_wlan.c | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) 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; } -- 2.25.1