summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libc/crypt/cryptutil.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/lib/libc/crypt/cryptutil.c b/src/lib/libc/crypt/cryptutil.c
index ca8be8fa0f..f101240524 100644
--- a/src/lib/libc/crypt/cryptutil.c
+++ b/src/lib/libc/crypt/cryptutil.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cryptutil.c,v 1.5 2014/11/24 21:36:35 tedu Exp $ */ 1/* $OpenBSD: cryptutil.c,v 1.6 2014/12/24 22:10:34 tedu Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> 3 * Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
4 * 4 *
@@ -29,8 +29,7 @@ crypt_checkpass(const char *pass, const char *goodhash)
29 29
30 if (goodhash == NULL) { 30 if (goodhash == NULL) {
31 /* fake it */ 31 /* fake it */
32 bcrypt_newhash(pass, 8, dummy, sizeof(dummy)); 32 goto fake;
33 goto fail;
34 } 33 }
35 34
36 /* empty password */ 35 /* empty password */
@@ -43,14 +42,9 @@ crypt_checkpass(const char *pass, const char *goodhash)
43 return 0; 42 return 0;
44 } 43 }
45 44
46 /* have to do it the hard way */ 45 /* unsupported. fake it. */
47 res = crypt(pass, goodhash); 46fake:
48 if (res == NULL || strlen(res) != strlen(goodhash) || 47 bcrypt_newhash(pass, 8, dummy, sizeof(dummy));
49 timingsafe_bcmp(res, goodhash, strlen(goodhash)) != 0) {
50 goto fail;
51 }
52
53 return 0;
54fail: 48fail:
55 errno = EACCES; 49 errno = EACCES;
56 return -1; 50 return -1;