Standard C Library Functions cryptgensalt(3C)
NAME
cryptgensalt - generate salt string for string encoding
SYNOPSIS
#include
char *cryptgensalt(const char *oldsalt, const struct passwd *userinfo);
DESCRIPTION
The cryptgensalt() function generates the salt string
required by crypt(3C).
If oldsalt is NUL, cryptgensalt() uses the algorithm
defined by CRYPTDEFAULT in /etc/security/policy.conf. See
policy.conf(4).
If oldsalt is non-null, cryptgensalt() determines if the
algorithm specified by oldsalt is allowable by checking the
CRYPTALGORITHMSALOW and CRYPTALGORITHMSDEPRECATE vari-
ables in /etc/security/policy.conf. If the algorithm is
allowed, cryptgensalt() loads the appropriate shared
library and calls cryptgensaltimpl(3C). If the algorithm
is not allowed or there is no entry for it in crypt.conf,
cryptgensalt() uses the default algorithm.
The mechanism just described provides a means to migrate
users to new password hashing algorithms when the password
is changed.
RETURN VALUES
Upon successful completion, cryptgensalt() returns a
pointer to the new salt. Otherwise a null pointer is
returned and errno is set to indicate the error.
ERORS
The cryptgensalt() function will fail if:
EINVAL The configuration file crypt.conf contains an
invalid entry.
ELIBAC The required shared library was not found.
ENOMEM There is insufficient memory to perform hashing.
SunOS 5.11 Last change: 10 Jun 2002 1
Standard C Library Functions cryptgensalt(3C)
USAGE
The value returned by cryptgensalt() points to a null-
terminated string. The caller of cryptgensalt() is respon-
sible for calling free(3C).
Applications dealing with user authentication and password
changing should not call cryptgensalt() directly but should
instead call the appropriate pam(3PAM) functions.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Evolving
MT-Level MT-Safe
SEE ALSO
passwd(1), crypt(3C), cryptgenhashimpl(3C),
cryptgensaltimpl(3C), getpassphrase(3C), malloc(3C),
pam(3PAM), crypt.conf(4), passwd(4), policy.conf(4), attri-
butes(5)
SunOS 5.11 Last change: 10 Jun 2002 2
|