diff options
author | 2012-09-04 22:16:17 +0000 | |
---|---|---|
committer | 2012-09-04 22:16:17 +0000 | |
commit | 769d2f2ff4475ee2e0d90efb82838ae7ea1a2c25 (patch) | |
tree | a6f3ae589f5337007e3a95519d4d8e4d92f39fae /lib/libc/crypt/bcrypt.c | |
parent | Implement pci_min_powerstate(). (diff) | |
download | wireguard-openbsd-769d2f2ff4475ee2e0d90efb82838ae7ea1a2c25.tar.xz wireguard-openbsd-769d2f2ff4475ee2e0d90efb82838ae7ea1a2c25.zip |
arc4random_buf is the easy way to fill a buffer now. ok deraadt
Diffstat (limited to 'lib/libc/crypt/bcrypt.c')
-rw-r--r-- | lib/libc/crypt/bcrypt.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/libc/crypt/bcrypt.c b/lib/libc/crypt/bcrypt.c index 207e76ea469..e76f277718f 100644 --- a/lib/libc/crypt/bcrypt.c +++ b/lib/libc/crypt/bcrypt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcrypt.c,v 1.24 2008/04/02 19:54:05 millert Exp $ */ +/* $OpenBSD: bcrypt.c,v 1.25 2012/09/04 22:16:17 tedu Exp $ */ /* * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> @@ -148,15 +148,8 @@ char * bcrypt_gensalt(u_int8_t log_rounds) { u_int8_t csalt[BCRYPT_MAXSALT]; - u_int16_t i; - u_int32_t seed = 0; - - for (i = 0; i < BCRYPT_MAXSALT; i++) { - if (i % 4 == 0) - seed = arc4random(); - csalt[i] = seed & 0xff; - seed = seed >> 8; - } + + arc4random_buf(csalt, sizeof(csalt)); if (log_rounds < 4) log_rounds = 4; |