diff options
Diffstat (limited to 'src/lib/libc/crypt/crypt_checkpass.3')
| -rw-r--r-- | src/lib/libc/crypt/crypt_checkpass.3 | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/lib/libc/crypt/crypt_checkpass.3 b/src/lib/libc/crypt/crypt_checkpass.3 new file mode 100644 index 0000000000..3a360fb899 --- /dev/null +++ b/src/lib/libc/crypt/crypt_checkpass.3 | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | .\" $OpenBSD: crypt_checkpass.3,v 1.1 2014/11/20 19:18:25 tedu Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) Ted Unangst <tedu@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: November 20 2014 $ | ||
| 18 | .Dt CRYPT_CHECKPASS 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm crypt_checkpass , | ||
| 22 | .Nm crypt_newhash | ||
| 23 | .Nd password hashing | ||
| 24 | .Sh SYNOPSIS | ||
| 25 | .In unistd.h | ||
| 26 | .Ft int | ||
| 27 | .Fn crypt_checkpass "const char *password" "const char *hash" | ||
| 28 | .In login_cap.h | ||
| 29 | .Ft int | ||
| 30 | .Fn crypt_newhash "const char *password" "login_cap_t *lc" "char *hash" "size_t hashsize" | ||
| 31 | .Sh DESCRIPTION | ||
| 32 | The | ||
| 33 | .Fn crypt_checkpass | ||
| 34 | function is provided to simplify checking a user's password. | ||
| 35 | If both the hash and the password are the empty string, authentication | ||
| 36 | is a success. | ||
| 37 | Otherwise, the password is hashed and compared to the provided hash. | ||
| 38 | If the hash is NULL, authentication will always fail, but a default | ||
| 39 | amount of work is performed to simulate the hashing operation. | ||
| 40 | A successful match will return 0. | ||
| 41 | A failure will return \-1 and set errno. | ||
| 42 | .Pp | ||
| 43 | The | ||
| 44 | .Fn crypt_newhash | ||
| 45 | function is provided to simplify the creation of new password hashes. | ||
| 46 | The provided | ||
| 47 | .Fa password | ||
| 48 | is randomly salted and hashed and stored in | ||
| 49 | .Fa hash . | ||
| 50 | The login class argument | ||
| 51 | .Fa lc | ||
| 52 | is used to identify the preferred hashing algorithm and parameters. | ||
| 53 | Refer to | ||
| 54 | .Xr login.conf 5 . | ||
| 55 | .Sh RETURN VALUES | ||
| 56 | These functions | ||
| 57 | return 0 on success and -1 on failure. | ||
| 58 | .Sh SEE ALSO | ||
| 59 | .Xr crypt 3 , | ||
| 60 | .Xr login.conf 5 , | ||
| 61 | .Xr passwd 5 | ||
