summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/crypt/crypt_checkpass.313
-rw-r--r--lib/libc/crypt/cryptutil.c12
2 files changed, 10 insertions, 15 deletions
diff --git a/lib/libc/crypt/crypt_checkpass.3 b/lib/libc/crypt/crypt_checkpass.3
index 3a360fb8998..479a78647b9 100644
--- a/lib/libc/crypt/crypt_checkpass.3
+++ b/lib/libc/crypt/crypt_checkpass.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: crypt_checkpass.3,v 1.1 2014/11/20 19:18:25 tedu Exp $
+.\" $OpenBSD: crypt_checkpass.3,v 1.2 2014/11/21 05:13:44 tedu Exp $
.\"
.\" Copyright (c) Ted Unangst <tedu@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: November 20 2014 $
+.Dd $Mdocdate: November 21 2014 $
.Dt CRYPT_CHECKPASS 3
.Os
.Sh NAME
@@ -25,9 +25,8 @@
.In unistd.h
.Ft int
.Fn crypt_checkpass "const char *password" "const char *hash"
-.In login_cap.h
.Ft int
-.Fn crypt_newhash "const char *password" "login_cap_t *lc" "char *hash" "size_t hashsize"
+.Fn crypt_newhash "const char *password" "const char *pref" "char *hash" "size_t hashsize"
.Sh DESCRIPTION
The
.Fn crypt_checkpass
@@ -47,9 +46,9 @@ The provided
.Fa password
is randomly salted and hashed and stored in
.Fa hash .
-The login class argument
-.Fa lc
-is used to identify the preferred hashing algorithm and parameters.
+The
+.Fa pref
+argument identifies the preferred hashing algorithm and parameters.
Refer to
.Xr login.conf 5 .
.Sh RETURN VALUES
diff --git a/lib/libc/crypt/cryptutil.c b/lib/libc/crypt/cryptutil.c
index 4a8c46be49d..f9045ed601d 100644
--- a/lib/libc/crypt/cryptutil.c
+++ b/lib/libc/crypt/cryptutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cryptutil.c,v 1.2 2014/11/17 16:47:28 tedu Exp $ */
+/* $OpenBSD: cryptutil.c,v 1.3 2014/11/21 05:13:44 tedu Exp $ */
/*
* Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
*
@@ -55,16 +55,14 @@ fail:
}
int
-crypt_newhash(const char *pass, login_cap_t *lc, char *hash, size_t hashlen)
+crypt_newhash(const char *pass, const char *pref, char *hash, size_t hashlen)
{
int rv = -1;
- char *pref;
- char *defaultpref = "blowfish,8";
+ const char *defaultpref = "blowfish,8";
const char *errstr;
int rounds;
- if (lc == NULL ||
- (pref = login_getcapstr(lc, "localcipher", NULL, NULL)) == NULL)
+ if (pref == NULL)
pref = defaultpref;
if (strncmp(pref, "blowfish,", 9) != 0) {
errno = EINVAL;
@@ -76,7 +74,5 @@ crypt_newhash(const char *pass, login_cap_t *lc, char *hash, size_t hashlen)
rv = bcrypt_newhash(pass, rounds, hash, hashlen);
err:
- if (pref != defaultpref)
- free(pref);
return rv;
}