diff options
author | 2014-11-21 05:13:44 +0000 | |
---|---|---|
committer | 2014-11-21 05:13:44 +0000 | |
commit | 817d1ee3be5cd45876f490c81c585e5b57bf1fb5 (patch) | |
tree | a0d18c82c4ace5d9bbd0d81089cfee81a6977435 /lib/libc/crypt/cryptutil.c | |
parent | We repeatedly observed assertion crashes in the low-level terminal (diff) | |
download | wireguard-openbsd-817d1ee3be5cd45876f490c81c585e5b57bf1fb5.tar.xz wireguard-openbsd-817d1ee3be5cd45876f490c81c585e5b57bf1fb5.zip |
change prototype for crypt_newhash. the login_cap_t is a holdover from its
pwd_gensalt origins, but a string argument works equally work and is more
friendly to consumers beyond local user accounts.
ok deraadt
Diffstat (limited to 'lib/libc/crypt/cryptutil.c')
-rw-r--r-- | lib/libc/crypt/cryptutil.c | 12 |
1 files changed, 4 insertions, 8 deletions
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; } |