diff options
author | David Brodski <david@brodski.eu> | 2010-10-12 21:04:57 +0000 |
---|---|---|
committer | David Brodski <david@brodski.eu> | 2010-10-12 21:04:57 +0000 |
commit | 10289c52b1b6f2be52f33746d8855da7fb12d67e (patch) | |
tree | cea68f39e644fcc639d88984cb62664ae7567714 /src/transport | |
parent | c53502b0b956ffc953d459d6b46e6fa6b568c3e0 (diff) | |
download | gnunet-10289c52b1b6f2be52f33746d8855da7fb12d67e.tar.gz gnunet-10289c52b1b6f2be52f33746d8855da7fb12d67e.zip |
changed to better random number generator
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/Makefile.am | 4 | ||||
-rw-r--r-- | 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 | |||
31 | 31 | ||
32 | if HAVE_PCAP | 32 | if HAVE_PCAP |
33 | if LINUX | 33 | if LINUX |
34 | WANBIN = gnunet-transport-wlan-helper | 34 | WANBIN = gnunet-transport-wlan-helper |
35 | WLAN_PLUGIN_LA = libgnunet_plugin_transport_wlan.la | 35 | WLAN_PLUGIN_LA = libgnunet_plugin_transport_wlan.la |
36 | endif | 36 | endif |
37 | endif | 37 | endif |
38 | 38 | ||
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 @@ | |||
33 | #include "plugin_transport.h" | 33 | #include "plugin_transport.h" |
34 | #include "plugin_transport_wlan.h" | 34 | #include "plugin_transport_wlan.h" |
35 | #include "gnunet_common.h" | 35 | #include "gnunet_common.h" |
36 | #include "gnunet_crypto_lib.h" | ||
36 | 37 | ||
37 | #define PROTOCOL_PREFIX "wlan" | 38 | #define PROTOCOL_PREFIX "wlan" |
38 | 39 | ||
@@ -409,12 +410,7 @@ uint16_t getcrc16 (const char *msgbuf, size_t msgbuf_size); | |||
409 | uint32_t | 410 | uint32_t |
410 | get_next_message_id() | 411 | get_next_message_id() |
411 | { | 412 | { |
412 | // FIXME find good random generator | 413 | return GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX); |
413 | if (RAND_MAX < UINT32_MAX){ | ||
414 | return (random() * random()) % UINT32_MAX; | ||
415 | } else { | ||
416 | return random() % UINT32_MAX; | ||
417 | } | ||
418 | } | 414 | } |
419 | 415 | ||
420 | /** | 416 | /** |
@@ -424,8 +420,7 @@ get_next_message_id() | |||
424 | void | 420 | void |
425 | start_next_message_id() | 421 | start_next_message_id() |
426 | { | 422 | { |
427 | //FIXME not good | 423 | //GNUNET_CRYPTO_random_init; |
428 | srand(GNUNET_TIME_absolute_get().value); | ||
429 | } | 424 | } |
430 | 425 | ||
431 | 426 | ||