2 .\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH CRYPT_GENSALT 3C "Jun 10, 2002"
8 crypt_gensalt \- generate salt string for string encoding
14 \fBchar *\fR\fBcrypt_gensalt\fR(\fBconst char *\fR\fIoldsalt\fR, \fBconst struct passwd *\fR\fIuserinfo\fR);
20 The \fBcrypt_gensalt()\fR function generates the salt string required by
24 If \fIoldsalt\fR is \fINULL\fR, \fBcrypt_gensalt()\fR uses the algorithm
25 defined by \fBCRYPT_DEFAULT\fR in \fB/etc/security/policy.conf\fR. See
29 If \fIoldsalt\fR is non-null, \fBcrypt_gensalt()\fR determines if the algorithm
30 specified by \fIoldsalt\fR is allowable by checking the
31 \fBCRYPT_ALGORITHMS_ALLOW\fR and \fBCRYPT_ALGORITHMS_DEPRECATE\fR variables in
32 \fB/etc/security/policy.conf\fR. If the algorithm is allowed,
33 \fBcrypt_gensalt()\fR loads the appropriate shared library and calls
34 \fBcrypt_gensalt_impl\fR(3C). If the algorithm is not allowed or there is no
35 entry for it in \fBcrypt.conf\fR, \fBcrypt_gensalt()\fR uses the default
39 The mechanism just described provides a means to migrate users to new password
40 hashing algorithms when the password is changed.
44 Upon successful completion, \fBcrypt_gensalt()\fR returns a pointer to the new
45 salt. Otherwise a null pointer is returned and \fBerrno\fR is set to indicate
50 The \fBcrypt_gensalt()\fR function will fail if:
57 The configuration file \fBcrypt.conf\fR contains an invalid entry.
66 The required shared library was not found.
75 There is insufficient memory to perform hashing.
81 The value returned by \fBcrypt_gensalt()\fR points to a null-terminated string.
82 The caller of \fBcrypt_gensalt()\fR is responsible for calling \fBfree\fR(3C).
85 Applications dealing with user authentication and password changing should not
86 call \fBcrypt_gensalt()\fR directly but should instead call the appropriate
87 \fBpam\fR(3PAM) functions.
91 See \fBattributes\fR(5) for descriptions of the following attributes:
99 ATTRIBUTE TYPE ATTRIBUTE VALUE
101 Interface Stability Evolving
109 \fBpasswd\fR(1), \fBcrypt\fR(3C), \fBcrypt_genhash_impl\fR(3C),
110 \fBcrypt_gensalt_impl\fR(3C), \fBgetpassphrase\fR(3C), \fBmalloc\fR(3C),
111 \fBpam\fR(3PAM), \fBcrypt.conf\fR(4), \fBpasswd\fR(4), \fBpolicy.conf\fR(4),