summaryrefslogtreecommitdiffstats
path: root/lib/libc/crypt/bcrypt.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2015-01-28 23:33:52 +0000
committertedu <tedu@openbsd.org>2015-01-28 23:33:52 +0000
commit6c34c85324a2b2cdac1dfd036d75d76d8987fe3d (patch)
tree63ddf2c1b547a6ed5dc09029408f0e54f0428001 /lib/libc/crypt/bcrypt.c
parentAdd a test where the TLS handshake fails because of null ciphers. (diff)
downloadwireguard-openbsd-6c34c85324a2b2cdac1dfd036d75d76d8987fe3d.tar.xz
wireguard-openbsd-6c34c85324a2b2cdac1dfd036d75d76d8987fe3d.zip
dial the time back to about 0.1s, closer to the original targets and
friendlier for users. requested by deraadt
Diffstat (limited to 'lib/libc/crypt/bcrypt.c')
-rw-r--r--lib/libc/crypt/bcrypt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/crypt/bcrypt.c b/lib/libc/crypt/bcrypt.c
index 8bf09950438..bc9441ccdf5 100644
--- a/lib/libc/crypt/bcrypt.c
+++ b/lib/libc/crypt/bcrypt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcrypt.c,v 1.51 2015/01/12 03:20:04 tedu Exp $ */
+/* $OpenBSD: bcrypt.c,v 1.52 2015/01/28 23:33:52 tedu Exp $ */
/*
* Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
@@ -235,7 +235,7 @@ bcrypt_checkpass(const char *pass, const char *goodhash)
/*
* Measure this system's performance by measuring the time for 8 rounds.
- * We are aiming for something that takes between 0.25 and 0.5 seconds.
+ * We are aiming for something that takes around 0.1s, but not too much over.
*/
int
bcrypt_autorounds(void)
@@ -254,12 +254,12 @@ bcrypt_autorounds(void)
duration += (after.tv_nsec - before.tv_nsec) / 1000;
/* too quick? slow it down. */
- while (r < 16 && duration <= 1000000 / 4) {
+ while (r < 16 && duration <= 60000) {
r += 1;
duration *= 2;
}
/* too slow? speed it up. */
- while (r > 4 && duration > 1000000 / 2) {
+ while (r > 4 && duration > 120000) {
r -= 1;
duration /= 2;
}