summaryrefslogtreecommitdiff
path: root/src/lib/libc/crypt
diff options
context:
space:
mode:
authortedu <>2015-01-28 23:33:52 +0000
committertedu <>2015-01-28 23:33:52 +0000
commita1f5c39690c9143d4043aaabb4517ab02f2d1911 (patch)
treed618576f3065be0878ffb57657182319ed974673 /src/lib/libc/crypt
parent36ad7f26648c87c63edaa9659d100b44b14f0ae1 (diff)
downloadopenbsd-a1f5c39690c9143d4043aaabb4517ab02f2d1911.tar.gz
openbsd-a1f5c39690c9143d4043aaabb4517ab02f2d1911.tar.bz2
openbsd-a1f5c39690c9143d4043aaabb4517ab02f2d1911.zip
dial the time back to about 0.1s, closer to the original targets and
friendlier for users. requested by deraadt
Diffstat (limited to 'src/lib/libc/crypt')
-rw-r--r--src/lib/libc/crypt/bcrypt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libc/crypt/bcrypt.c b/src/lib/libc/crypt/bcrypt.c
index 8bf0995043..bc9441ccdf 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.51 2015/01/12 03:20:04 tedu Exp $ */ 1/* $OpenBSD: bcrypt.c,v 1.52 2015/01/28 23:33:52 tedu Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> 4 * Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
@@ -235,7 +235,7 @@ bcrypt_checkpass(const char *pass, const char *goodhash)
235 235
236/* 236/*
237 * Measure this system's performance by measuring the time for 8 rounds. 237 * Measure this system's performance by measuring the time for 8 rounds.
238 * We are aiming for something that takes between 0.25 and 0.5 seconds. 238 * We are aiming for something that takes around 0.1s, but not too much over.
239 */ 239 */
240int 240int
241bcrypt_autorounds(void) 241bcrypt_autorounds(void)
@@ -254,12 +254,12 @@ bcrypt_autorounds(void)
254 duration += (after.tv_nsec - before.tv_nsec) / 1000; 254 duration += (after.tv_nsec - before.tv_nsec) / 1000;
255 255
256 /* too quick? slow it down. */ 256 /* too quick? slow it down. */
257 while (r < 16 && duration <= 1000000 / 4) { 257 while (r < 16 && duration <= 60000) {
258 r += 1; 258 r += 1;
259 duration *= 2; 259 duration *= 2;
260 } 260 }
261 /* too slow? speed it up. */ 261 /* too slow? speed it up. */
262 while (r > 4 && duration > 1000000 / 2) { 262 while (r > 4 && duration > 120000) {
263 r -= 1; 263 r -= 1;
264 duration /= 2; 264 duration /= 2;
265 } 265 }