diff options
| author | 2023-06-05 18:29:25 +0200 | |
|---|---|---|
| committer | 2023-06-05 18:29:25 +0200 | |
| commit | fafdbbf815ea44ca1813a4ab58547d487f6a3bfb (patch) | |
| tree | 139aeaf983b3b634f4b3bdfa57bb63876bb2cf68 /snac.c | |
| parent | Some prototype tweaks. (diff) | |
| download | snac2-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.c | 5 |
1 files changed, 4 insertions, 1 deletions
| @@ -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 | ||