OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / crypt.3
index 5673a38..25cd734 100644 (file)
@@ -1,6 +1,7 @@
 .\" Michael Haardt (michael@cantor.informatik.rwth.aachen.de)
 .\"     Sat Sep  3 22:00:30 MET DST 1994
 .\"
+.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
 .\" This is free documentation; you can redistribute it and/or
 .\" modify it under the terms of the GNU General Public License as
 .\" published by the Free Software Foundation; either version 2 of
@@ -17,9 +18,9 @@
 .\" GNU General Public License for more details.
 .\"
 .\" You should have received a copy of the GNU General Public
-.\" License along with this manual; if not, write to the Free
-.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
-.\" USA.
+.\" License along with this manual; if not, see
+.\" <http://www.gnu.org/licenses/>.
+.\" %%%LICENSE_END
 .\"
 .\" Sun Feb 19 21:32:25 1995, faith@cs.unc.edu edited details away
 .\"
 .\" added _XOPEN_SOURCE, aeb, 970705
 .\" added GNU MD5 stuff, aeb, 011223
 .\"
-.TH CRYPT 3 2010-06-20 "" "Linux Programmer's Manual"
+.TH CRYPT 3 2014-02-26 "" "Linux Programmer's Manual"
 .SH NAME
 crypt, crypt_r \- password and data encryption
 .SH SYNOPSIS
 .nf
-.B #define _XOPEN_SOURCE
+.BR "#define _XOPEN_SOURCE" "       /* See feature_test_macros(7) */"
 .br
 .B #include <unistd.h>
 .sp
 .BI "char *crypt(const char *" key ", const char *" salt );
 .sp
+.BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
+.br
+.B #include <crypt.h>
+.sp
 .BI "char *crypt_r(const char *" key ", const char *" salt ,
 .BI "              struct crypt_data *" data );
 .fi
@@ -60,7 +65,7 @@ is a user's typed password.
 .PP
 .I salt
 is a two-character string chosen from the set
-[\fBa\fP\(en\fBzA\fP\(en\fBZ0\fP\(en\fB9./\fP].
+[\fBa\-zA\-Z0\-9./\fP].
 This string is used to
 perturb the algorithm in one of 4096 different ways.
 .PP
@@ -112,11 +117,17 @@ 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"
+.SH RETURN VALUE
 On success, a pointer to the encrypted password is returned.
 On error, NULL is returned.
 .SH ERRORS
 .TP
+.B EINVAL
+.I salt
+has the wrong format.
+.TP
+.B
+.TP
 .B ENOSYS
 The
 .BR crypt ()
@@ -155,13 +166,27 @@ function was not implemented, probably because of U.S.A. export restrictions.
 .\" .PP
 .\" Making encrypted data computed using crypt() publicly available has
 .\" to be considered insecure for the given reasons.
-.SH "CONFORMING TO"
+.TP
+.B EPERM
+.I /proc/sys/crypto/fips_enabled
+has a nonzero value,
+and an attempt was made to use a weak encryption type, such as DES.
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR crypt ()
+function is not thread-safe.
+.LP
+The
+.BR crypt_r ()
+function is thread-safe.
+.SH CONFORMING TO
 .BR crypt ():
 SVr4, 4.3BSD, POSIX.1-2001.
 .BR crypt_r ()
 is a GNU extension.
 .SH NOTES
-.SS Glibc Notes
+.SS Glibc notes
 The glibc2 version of this function supports additional
 encryption algorithms.
 
@@ -216,15 +241,23 @@ SHA-512 | 86 characters
 .TE
 
 The characters in "\fIsalt\fP" and "\fIencrypted\fP" are drawn from the set
-[\fBa\fP\(en\fBzA\fP\(en\fBZ0\fP\(en\fB9./\fP].
+[\fBa\-zA\-Z0\-9./\fP].
 In the MD5 and SHA implementations the entire
 .I key
 is significant (instead of only the first
 8 bytes in DES).
-.SH "SEE ALSO"
+.SH SEE ALSO
 .BR login (1),
 .BR passwd (1),
 .BR encrypt (3),
 .BR getpass (3),
-.BR passwd (5),
-.BR feature_test_macros (7)
+.BR passwd (5)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.