diff options
Diffstat (limited to 'man3/encrypt.3')
-rw-r--r-- | man3/encrypt.3 | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/man3/encrypt.3 b/man3/encrypt.3 index 0ff57911e..a3fae2f30 100644 --- a/man3/encrypt.3 +++ b/man3/encrypt.3 @@ -9,12 +9,12 @@ .\" .\" Modified 2003-04-04, aeb .\" -.TH encrypt 3 2023-02-05 "Linux man-pages 6.03" +.TH encrypt 3 2023-07-20 "Linux man-pages 6.05.01" .SH NAME encrypt, setkey, encrypt_r, setkey_r \- encrypt 64-bit messages .SH LIBRARY -Encryption and decryption library -.RI ( libcrypto ", " \-lcrypto ) +Password hashing library +.RI ( libcrypt ", " \-lcrypt ) .SH SYNOPSIS .nf .BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */" @@ -104,50 +104,52 @@ 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 encrypt (), -.BR encrypt_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). -.ad l -.nh .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ +.na +.nh .BR encrypt (), .BR setkey () T} Thread safety MT-Unsafe race:crypt T{ +.na +.nh .BR encrypt_r (), .BR setkey_r () T} Thread safety MT-Safe .TE -.hy -.ad .sp 1 .SH STANDARDS -.BR encrypt (), -.BR setkey (): -POSIX.1-2001, POSIX.1-2008, SUS, SVr4. -.PP -The functions +.TP +.BR encrypt () +.TQ +.BR setkey () +POSIX.1-2008. +.TP .BR encrypt_r () -and +.TQ .BR setkey_r () -are GNU extensions. -.SH NOTES +None. +.SH HISTORY +Removed in glibc 2.28. +.PP +Because they employ the DES block cipher, +which is no longer considered secure, +these functions were removed from glibc. +Applications should switch to a modern cryptography library, such as +.BR libgcrypt . +.TP +.BR encrypt () +.TQ +.BR setkey () +POSIX.1-2001, SUS, SVr4. .SS Availability in glibc See .BR crypt (3). @@ -161,7 +163,7 @@ In glibc 2.2, these functions use the DES algorithm. #include <stdio.h> #include <stdlib.h> #include <unistd.h> - +\& int main(void) { @@ -169,11 +171,11 @@ main(void) char orig[9] = "eggplant"; char buf[64]; char txt[9]; - +\& for (size_t i = 0; i < 64; i++) { key[i] = rand() & 1; } - +\& for (size_t i = 0; i < 8; i++) { for (size_t j = 0; j < 8; j++) { buf[i * 8 + j] = orig[i] >> j & 1; @@ -181,7 +183,7 @@ main(void) setkey(key); } printf("Before encrypting: %s\en", orig); - +\& encrypt(buf, 0); for (size_t i = 0; i < 8; i++) { for (size_t j = 0, txt[i] = \[aq]\e0\[aq]; j < 8; j++) { @@ -190,7 +192,7 @@ main(void) txt[8] = \[aq]\e0\[aq]; } printf("After encrypting: %s\en", txt); - +\& encrypt(buf, 1); for (size_t i = 0; i < 8; i++) { for (size_t j = 0, txt[i] = \[aq]\e0\[aq]; j < 8; j++) { |