aboutsummaryrefslogtreecommitdiff
path: root/src/challenge.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2018-12-26 11:46:11 +0100
committerToni Uhlig <matzeton@googlemail.com>2018-12-26 11:46:11 +0100
commit4b33cf8cee7b048ebccfe83b27ce00e8bdd70a50 (patch)
treef2bc3f3c79a34054255db24853ea7d616ba1037e /src/challenge.c
parent2c7c3b62df2661b3276253fb3d8d624d81c398a2 (diff)
replaced rand() with more "secure" random() // CID 301767
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/challenge.c')
-rw-r--r--src/challenge.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/challenge.c b/src/challenge.c
index 24a13f7..4f69298 100644
--- a/src/challenge.c
+++ b/src/challenge.c
@@ -50,6 +50,7 @@
#include "challenge.h"
#include "options.h"
#include "md5.h"
+#include "utils.h"
/* generate_challenge: Generates a random challenge, incorporating the current
* local timestamp to avoid replay attacks.
@@ -62,9 +63,9 @@ challenge_t* generate_challenge(void) {
c = (challenge_t *) calloc(1, sizeof(challenge_t));
gettimeofday(&tt, 0);
c->sec = tt.tv_sec;
- c->usec_rnd = tt.tv_usec + rand();
+ c->usec_rnd = tt.tv_usec + pt_random();
for (i=0;i<6;i++)
- c->random[i] = rand();
+ c->random[i] = pt_random();
return c;
}