summaryrefslogtreecommitdiffstats
path: root/src/fastd.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-08-01 22:12:56 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-08-01 22:12:56 +0200
commit5f385b0ea01865834214dae79afa557f37f9c275 (patch)
treef5a5dc1a0800d52ef3190c1e0b08b93e0f7e66c0 /src/fastd.h
parentebcf28b9ab43d71179535df61896aa8baa4cdb27 (diff)
downloadfastd-5f385b0ea01865834214dae79afa557f37f9c275.tar
fastd-5f385b0ea01865834214dae79afa557f37f9c275.zip
Use srandom/random instead of rand_r
There's no need to keep our own seed.
Diffstat (limited to 'src/fastd.h')
-rw-r--r--src/fastd.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/fastd.h b/src/fastd.h
index 539dd54..8700be2 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -281,8 +281,6 @@ struct fastd_context {
VECTOR(fastd_peer_eth_addr_t) eth_addrs; /**< Sorted vector of all known ethernet addresses with associated peers and timeouts */
- unsigned int randseed; /**< Random seed for non-cryptographic random numbers */
-
size_t unknown_handshake_pos; /**< Current start position in the ring buffer unknown_handshakes */
fastd_handshake_timeout_t unknown_handshakes[8]; /**< Ring buffer of unknown addresses handshakes have been received from */
@@ -328,7 +326,7 @@ void fastd_random_bytes(void *buffer, size_t len, bool secure);
/** Returns a random number between \a min (inclusively) and \a max (exclusively) */
static inline int fastd_rand(int min, int max) {
- unsigned int r = (unsigned int)rand_r(&ctx.randseed);
+ unsigned int r = (unsigned int)random();
return (r%(max-min) + min);
}