1 .\" @(#)des_crypt.3 2.1 88/08/11 4.0 RPCSRC; from 1.16 88/03/02 SMI;
3 .\" Taken from libc4 sources, which say:
4 .\" Copyright (C) 1993 Eric Young - can be distributed under GPL.
6 .\" However, the above header line suggests that this file in fact is
7 .\" Copyright Sun Microsystems, Inc (and is provided for unrestricted use,
8 .\" see other Sun RPC sources).
10 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
11 .\" can be distributed under GPL.
14 .TH DES_CRYPT 3 2020-04-11 "" "Linux Programmer's Manual"
16 des_crypt, ecb_crypt, cbc_crypt, des_setparity, DES_FAILED \- fast
21 .\" .B #include <des_crypt.h>
22 .B #include <rpc/des_crypt.h>
24 .BI "int ecb_crypt(char *" key ", char *" data ", unsigned " datalen ,
25 .BI " unsigned " mode );
27 .BI "int cbc_crypt(char *" key ", char *" data ", unsigned " datalen ,
28 .BI " unsigned " mode ", char *" ivec );
30 .BI "void des_setparity(char *" key );
32 .BI "int DES_FAILED(int " status );
41 (Data Encryption Standard).
42 These routines are faster and more general purpose than
44 They also are able to utilize
46 hardware if it is available.
50 (Electronic Code Book)
51 mode, which encrypts blocks of data independently.
55 (Cipher Block Chaining)
56 mode, which chains together
59 mode protects against insertions, deletions and
60 substitutions of blocks.
61 Also, regularities in the clear text will
62 not appear in the cipher text.
64 Here is how to use these routines.
67 is the 8-byte encryption key with parity.
68 To set the key's parity, which for
70 is in the low bit of each byte, use
74 contains the data to be encrypted or decrypted.
78 is the length in bytes of
80 which must be a multiple of 8.
83 is formed by ORing together some things.
84 For the encryption direction OR in either
88 For software versus hardware
89 encryption, OR in either
95 is specified, and there is no hardware, then the encryption is performed
96 in software and the routine returns
97 .BR DESERR_NOHWDEVICE .
102 is the 8-byte initialization
103 vector for the chaining.
104 It is updated to the next initialization
111 .BR DESERR_NOHWDEVICE
112 Encryption succeeded, but done in software instead of the requested hardware.
115 An error occurred in the hardware or driver.
118 Bad argument to routine.
120 Given a result status
125 .BI DES_FAILED( stat )
126 is false only for the first two statuses.
127 .\" So far the Sun page
128 .\" Some additions - aeb
130 These functions were added to glibc in version 2.1.
132 Because they employ the DES block cipher,
133 which is no longer considered secure,
139 were removed in glibc 2.28.
140 Applications should switch to a modern cryptography library, such as
143 For an explanation of the terms used in this section, see
149 Interface Attribute Value
154 T} Thread safety MT-Safe