| Current File : //usr/man/man3c/crypt_gensalt_impl.3c |
'\" te
.\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved.
.TH crypt_gensalt_impl 3C "10 Jun 2002" "SunOS 5.11" "Standard C Library Functions"
.SH NAME
crypt_gensalt_impl \- generate salt for password encryption
.SH SYNOPSIS
.LP
.nf
#include <crypt.h>
\fBchar *\fR\fBcrypt_gensalt_impl\fR(\fBchar *\fR\fIgsbuffer\fR, \fBsize_t\fR \fIgsbufflen\fR,
\fBconst char *\fR\fIoldsalt\fR, \fBconst struct passwd *\fR\fIuserinfo\fR,
\fBconst char **\fR\fIparams\fR);
.fi
.SH DESCRIPTION
.sp
.LP
The \fBcrypt_gensalt_impl()\fR function is called by \fBcrypt_gensalt\fR(3C) to generate the salt for password encryption.
.sp
.LP
The \fIgsbuffer\fR argument is a pointer to an MT-safe buffer of size \fIgsbufflen\fR.
.sp
.LP
The \fIoldsalt\fR and \fIuserinfo\fR arguments are passed unchanged from \fBcrypt_gensalt\fR(3C).
.sp
.LP
The \fIparams\fR argument is an \fIargv\fR-like null terminated vector of type \fBchar *\fR. The first element of \fIparams\fR represents the mechanism token name from \fBcrypt.conf\fR(4). The remaining elements of \fIparams\fR represent strings of the form <\fBparameter\fR>[=<\fBvalue\fR>] to allow passing in additional information from the \fBcrypt.conf\fR entry, such as specifying rounds information "\fBrounds=4096\fR".
.sp
.LP
The value returned by \fBcrypt_gensalt_impl()\fR points to a thread-specific buffer to be freed by the caller of \fBcrypt_gensalt\fR(3C) after calling \fBcrypt\fR(3C).
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBcrypt_gensalt_impl()\fR returns a pointer to the new salt. Otherwise a null pointer is returned and \fBerrno\fR is set to indicate the error.
.SH ERRORS
.sp
.LP
The \fBcrypt_gensalt_impl()\fR function will fail if:
.sp
.ne 2
.mk
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 11n
.rt
The configuration file \fBcrypt.conf\fR contains an invalid entry.
.RE
.sp
.ne 2
.mk
.na
\fB\fBELIBACC\fR\fR
.ad
.RS 11n
.rt
The required crypt shared library was not found.
.RE
.sp
.ne 2
.mk
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 11n
.rt
There is insufficient memory to perform hashing.
.RE
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Interface StabilityCommitted
_
MT-LevelMT-Safe
.TE
.SH SEE ALSO
.sp
.LP
\fBpasswd\fR(1), \fBcrypt\fR(3C), \fBcrypt_genhash_impl\fR(3C), \fBcrypt_gensalt\fR(3C), \fBgetpassphrase\fR(3C), \fBcrypt.conf\fR(4), \fBpasswd\fR(4), \fBattributes\fR(5)