summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorprovos <provos@openbsd.org>1998-07-04 18:27:04 +0000
committerprovos <provos@openbsd.org>1998-07-04 18:27:04 +0000
commitd1005ad82f7b6374ea9481bba0eb8d495b0eb97e (patch)
treeb2c7063c2df2668d0f76cf45c98b8b1ceb6bf94a
parentput 224 route on default, to avoid a hostname lookup (diff)
downloadwireguard-openbsd-d1005ad82f7b6374ea9481bba0eb8d495b0eb97e.tar.xz
wireguard-openbsd-d1005ad82f7b6374ea9481bba0eb8d495b0eb97e.zip
enable variable number of rounds for extended crypt, this is the crypt
variant used by BSDI, reminded of this fact by Solar Designer.
-rw-r--r--usr.bin/passwd/pwd_gensalt.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/passwd/pwd_gensalt.c b/usr.bin/passwd/pwd_gensalt.c
index 526e914c4c6..628b94a7c6e 100644
--- a/usr.bin/passwd/pwd_gensalt.c
+++ b/usr.bin/passwd/pwd_gensalt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pwd_gensalt.c,v 1.7 1997/04/10 20:04:54 provos Exp $ */
+/* $OpenBSD: pwd_gensalt.c,v 1.8 1998/07/04 18:27:04 provos Exp $ */
/*
* Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
* All rights reserved.
@@ -90,10 +90,13 @@ pwd_gensalt(salt, max, pwd, type)
to64(&salt[0], arc4random(), 2);
salt[2] = '\0';
} else if (!strcmp(now, "newsalt")) {
+ u_int32_t rounds = atol(next);
+ if (rounds < 725)
+ rounds = 725;
if (max < 10)
return 0;
salt[0] = _PASSWORD_EFMT1;
- to64(&salt[1], (int32_t) (29 * 25), 4);
+ to64(&salt[1], (u_int32_t) rounds, 4);
to64(&salt[5], arc4random(), 4);
salt[9] = '\0';
} else if (!strcmp(now, "md5")) {