summaryrefslogtreecommitdiff
path: root/src/lib/libc/crypt/crypt_checkpass.3
diff options
context:
space:
mode:
authortedu <>2014-11-20 19:18:25 +0000
committertedu <>2014-11-20 19:18:25 +0000
commite2e79e022bd0815f76ca57243324eb59f75899be (patch)
tree3eb435e8491f8320373632f0ccde7c838d55514d /src/lib/libc/crypt/crypt_checkpass.3
parent9a3a3e0abe3dbaf29a4781c95bb7ff180bd6a104 (diff)
downloadopenbsd-e2e79e022bd0815f76ca57243324eb59f75899be.tar.gz
openbsd-e2e79e022bd0815f76ca57243324eb59f75899be.tar.bz2
openbsd-e2e79e022bd0815f76ca57243324eb59f75899be.zip
split crypt_checkpass off into a new file
Diffstat (limited to 'src/lib/libc/crypt/crypt_checkpass.3')
-rw-r--r--src/lib/libc/crypt/crypt_checkpass.361
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
32The
33.Fn crypt_checkpass
34function is provided to simplify checking a user's password.
35If both the hash and the password are the empty string, authentication
36is a success.
37Otherwise, the password is hashed and compared to the provided hash.
38If the hash is NULL, authentication will always fail, but a default
39amount of work is performed to simulate the hashing operation.
40A successful match will return 0.
41A failure will return \-1 and set errno.
42.Pp
43The
44.Fn crypt_newhash
45function is provided to simplify the creation of new password hashes.
46The provided
47.Fa password
48is randomly salted and hashed and stored in
49.Fa hash .
50The login class argument
51.Fa lc
52is used to identify the preferred hashing algorithm and parameters.
53Refer to
54.Xr login.conf 5 .
55.Sh RETURN VALUES
56These functions
57return 0 on success and -1 on failure.
58.Sh SEE ALSO
59.Xr crypt 3 ,
60.Xr login.conf 5 ,
61.Xr passwd 5