From c5b5bd910507520f7974a156a1de9d187f23bc2f Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 8 Jan 2017 15:28:37 -0800 Subject: New ISAAC pRNG. This replaces other local hacks for random data. Platforms must seed the pRNGs by offering an nni_plat_seed_prng() routine. Implementations for POSIX using various options (including the /dev/urandom device) are supplied. --- src/protocol/reqrep/req.c | 2 +- src/protocol/survey/survey.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src/protocol') diff --git a/src/protocol/reqrep/req.c b/src/protocol/reqrep/req.c index 3c3bba9c..5b9671f8 100644 --- a/src/protocol/reqrep/req.c +++ b/src/protocol/reqrep/req.c @@ -58,7 +58,7 @@ nni_req_sock_init(void **reqp, nni_sock *sock) return (rv); } // this is "semi random" start for request IDs. - req->nextid = (nni_clock() >> 32) ^ (nni_clock() & 0xffffffff); + req->nextid = nni_random(); req->retry = NNI_SECOND * 60; req->sock = sock; req->reqmsg = NULL; diff --git a/src/protocol/survey/survey.c b/src/protocol/survey/survey.c index cb600dc3..9def9292 100644 --- a/src/protocol/survey/survey.c +++ b/src/protocol/survey/survey.c @@ -54,8 +54,7 @@ nni_surv_sock_init(void **sp, nni_sock *nsock) return (rv); } NNI_LIST_INIT(&psock->pipes, nni_surv_pipe, node); - // this is "semi random" start for request IDs. - psock->nextid = (nni_clock() >> 32) ^ (nni_clock() & 0xffffffff); + psock->nextid = nni_random(); psock->nsock = nsock; psock->raw = 0; psock->survtime = NNI_SECOND * 60; -- cgit v1.2.3-70-g09d2