]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/encrypt.3
des_crypt.3: Minor wording fix in VERSIONS
[thirdparty/man-pages.git] / man3 / encrypt.3
index 433102c0a21df45bf02dbbbca529dbddf35f6df9..fb7f87e2f1bfdd00cfb13413d8db0bcdceed8cb6 100644 (file)
 .\"
 .\" Modified 2003-04-04, aeb
 .\"
-.TH ENCRYPT 3 2015-08-08 "" "Linux Programmer's Manual"
+.TH ENCRYPT 3 2018-04-30 "" "Linux Programmer's Manual"
 .SH NAME
 encrypt, setkey, encrypt_r, setkey_r \- encrypt 64-bit messages
 .SH SYNOPSIS
+.nf
 .BR "#define _XOPEN_SOURCE" "       /* See feature_test_macros(7) */"
-.br
 .B #include <unistd.h>
 .PP
 .BI "void encrypt(char " block "[64], int " edflag );
 
 .BR "#define _XOPEN_SOURCE" "       /* See feature_test_macros(7) */"
-.br
 .B #include <stdlib.h>
 .PP
 .BI "void setkey(const char *" key );
 
 .BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
-.br
 .B "#include <crypt.h>"
 .PP
 .BI "void setkey_r(const char *" key ", struct crypt_data *" data );
-.br
 .BI "void encrypt_r(char *" block ", int " edflag \
 ", struct crypt_data *" data );
+.fi
 .PP
 Each of these requires linking with \fI\-lcrypt\fP.
 .SH DESCRIPTION
@@ -102,7 +100,7 @@ struct crypt_data {
     int      direction;
     int      initialized;
 };
-.fi
+.EE
 .in
 .PP
 Before calling
@@ -121,6 +119,17 @@ On success, it is unchanged.
 .B ENOSYS
 The function is not provided.
 (For example because of former USA export restrictions.)
+.SH VERSIONS
+Because they employ the DES block cipher,
+which is no longer considered secure,
+.BR crypt (),
+.BR crypt_r (),
+.BR setkey (),
+and
+.BR setkey_r ()
+were removed in glibc 2.28.
+Applications should switch to a modern cryptography library, such as
+.BR libgcrypt .
 .SH ATTRIBUTES
 For an explanation of the terms used in this section, see
 .BR attributes (7).
@@ -149,9 +158,13 @@ and
 .BR setkey_r ()
 are GNU extensions.
 .SH NOTES
+.SS Availability in glibc
+See
+.BR crypt (3).
+.SS Features in glibc
 In glibc 2.2, these functions use the DES algorithm.
 .SH EXAMPLE
-.nf
+.EX
 #define _XOPEN_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
@@ -177,28 +190,28 @@ main(void)
         }
         setkey(key);
     }
-    printf("Before encrypting: %s\\n", orig);
+    printf("Before encrypting: %s\en", orig);
 
     encrypt(buf, 0);
     for (i = 0; i < 8; i++) {
-        for (j = 0, txt[i] = \(aq\\0\(aq; j < 8; j++) {
+        for (j = 0, txt[i] = \(aq\e0\(aq; j < 8; j++) {
             txt[i] |= buf[i * 8 + j] << j;
         }
-        txt[8] = \(aq\\0\(aq;
+        txt[8] = \(aq\e0\(aq;
     }
-    printf("After encrypting:  %s\\n", txt);
+    printf("After encrypting:  %s\en", txt);
 
     encrypt(buf, 1);
     for (i = 0; i < 8; i++) {
-        for (j = 0, txt[i] = \(aq\\0\(aq; j < 8; j++) {
+        for (j = 0, txt[i] = \(aq\e0\(aq; j < 8; j++) {
             txt[i] |= buf[i * 8 + j] << j;
         }
-        txt[8] = \(aq\\0\(aq;
+        txt[8] = \(aq\e0\(aq;
     }
-    printf("After decrypting:  %s\\n", txt);
+    printf("After decrypting:  %s\en", txt);
     exit(EXIT_SUCCESS);
 }
-.fi
+.EE
 .SH SEE ALSO
 .BR cbc_crypt (3),
 .BR crypt (3),