Add description of crypt_r().

This commit is contained in:
Michael Kerrisk 2008-08-25 04:57:21 +00:00
parent 3424352d58
commit 4e602cb2b0
1 changed files with 22 additions and 3 deletions

View File

@ -32,16 +32,21 @@
.\" added _XOPEN_SOURCE, aeb, 970705
.\" added GNU MD5 stuff, aeb, 011223
.\"
.TH CRYPT 3 2008-07-28 "" "Linux Programmer's Manual"
.TH CRYPT 3 2008-08-25 "" "Linux Programmer's Manual"
.SH NAME
crypt \- password and data encryption
crypt, crypt_r \- password and data encryption
.SH SYNOPSIS
.nf
.B #define _XOPEN_SOURCE
.br
.B #include <unistd.h>
.sp
.BI "char *crypt(const char *" key ", const char *" salt );
.sp
.BI "char *crypt_r(const char *" key ", const char *" salt ,
.BI " struct crypt_data *" data );
.fi
.sp
Link with \fI\-lcrypt\fP.
.SH DESCRIPTION
.BR crypt ()
@ -95,8 +100,20 @@ If you are planning on using the
.BR crypt ()
interface for a cryptography project, don't do it: get a good book on
encryption and one of the widely available DES libraries.
.BR crypt_r ()
is a reentrant version of
.BR crypt ().
The structure pointed to by
.I data
is used to store result data and bookkeeping information.
Other than allocating it,
the only thing that the caller should do with this structure is to set
.I data->initialized
to zero before the first call to
.BR crypt_r ().
.SH "RETURN VALUE"
A pointer to the encrypted password is returned.
On success, a pointer to the encrypted password is returned.
On error, NULL is returned.
.SH ERRORS
.TP
@ -139,7 +156,9 @@ function was not implemented, probably because of U.S.A. export restrictions.
.\" Making encrypted data computed using crypt() publicly available has
.\" to be considered insecure for the given reasons.
.SH "CONFORMING TO"
.BR crypt ():
SVr4, 4.3BSD, POSIX.1-2001.
.BR crypt_r () is a GNU extension.
.SH NOTES
.SS Glibc Notes
The glibc2 version of this function supports additional