summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorprovos <>1997-03-27 01:09:38 +0000
committerprovos <>1997-03-27 01:09:38 +0000
commit6f3ee1e5b369288dc54840db896dd69ae1c3d294 (patch)
tree2e0a7331bdade46954f8d72e298be715321215e2 /src/lib
parentc6d8f4861d383c904c999fe2208208f858a6ded7 (diff)
downloadopenbsd-6f3ee1e5b369288dc54840db896dd69ae1c3d294.tar.gz
openbsd-6f3ee1e5b369288dc54840db896dd69ae1c3d294.tar.bz2
openbsd-6f3ee1e5b369288dc54840db896dd69ae1c3d294.zip
yet another random() converted to arc4random()
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libc/crypt/bcrypt.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/libc/crypt/bcrypt.c b/src/lib/libc/crypt/bcrypt.c
index 364555b5da..d47100cec8 100644
--- a/src/lib/libc/crypt/bcrypt.c
+++ b/src/lib/libc/crypt/bcrypt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bcrypt.c,v 1.3 1997/02/16 20:58:15 provos Exp $ */ 1/* $OpenBSD: bcrypt.c,v 1.4 1997/03/27 01:09:38 provos Exp $ */
2/* 2/*
3 * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> 3 * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
4 * All rights reserved. 4 * All rights reserved.
@@ -49,7 +49,6 @@
49#endif 49#endif
50 50
51#include <stdlib.h> 51#include <stdlib.h>
52#include <time.h>
53#include <sys/types.h> 52#include <sys/types.h>
54#include <string.h> 53#include <string.h>
55#include <pwd.h> 54#include <pwd.h>
@@ -161,10 +160,10 @@ bcrypt_gensalt(log_rounds)
161 u_int8_t csalt[BCRYPT_MAXSALT]; 160 u_int8_t csalt[BCRYPT_MAXSALT];
162 u_int16_t i; 161 u_int16_t i;
163 u_int32_t seed = 0; 162 u_int32_t seed = 0;
164 (void) srandom((int) time((time_t *) NULL)); 163
165 for (i = 0; i < BCRYPT_MAXSALT; i++) { 164 for (i = 0; i < BCRYPT_MAXSALT; i++) {
166 if (i % 4 == 0) 165 if (i % 4 == 0)
167 seed = random(); 166 seed = arc4random();
168 csalt[i] = seed & 0xff; 167 csalt[i] = seed & 0xff;
169 seed = seed >> 8; 168 seed = seed >> 8;
170 } 169 }