summaryrefslogtreecommitdiff
path: root/snac.c
diff options
context:
space:
mode:
authorGravatar default2023-06-05 18:29:25 +0200
committerGravatar default2023-06-05 18:29:25 +0200
commitfafdbbf815ea44ca1813a4ab58547d487f6a3bfb (patch)
tree139aeaf983b3b634f4b3bdfa57bb63876bb2cf68 /snac.c
parentSome prototype tweaks. (diff)
downloadsnac2-fafdbbf815ea44ca1813a4ab58547d487f6a3bfb.tar.gz
snac2-fafdbbf815ea44ca1813a4ab58547d487f6a3bfb.tar.xz
snac2-fafdbbf815ea44ca1813a4ab58547d487f6a3bfb.zip
Replaced usage of random() with xs_rnd_buf().
Diffstat (limited to '')
-rw-r--r--snac.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/snac.c b/snac.c
index 722af62..691c2e2 100644
--- a/snac.c
+++ b/snac.c
@@ -16,6 +16,7 @@
16#include "xs_set.h" 16#include "xs_set.h"
17#include "xs_time.h" 17#include "xs_time.h"
18#include "xs_glob.h" 18#include "xs_glob.h"
19#include "xs_random.h"
19 20
20#include "snac.h" 21#include "snac.h"
21 22
@@ -122,7 +123,9 @@ xs_str *hash_password(const char *uid, const char *passwd, const char *nonce)
122 xs *hash; 123 xs *hash;
123 124
124 if (nonce == NULL) { 125 if (nonce == NULL) {
125 d_nonce = xs_fmt("%08x", random()); 126 unsigned int r;
127 xs_rnd_buf(&r, sizeof(r));
128 d_nonce = xs_fmt("%08x", r);
126 nonce = d_nonce; 129 nonce = d_nonce;
127 } 130 }
128 131