xref: /freebsd/crypto/openssl/doc/man3/DES_random_key.pod (revision e71b70530d95c4f34d8bdbd78d1242df1ba4a945)
1*e71b7053SJung-uk Kim=pod
2*e71b7053SJung-uk Kim
3*e71b7053SJung-uk Kim=head1 NAME
4*e71b7053SJung-uk Kim
5*e71b7053SJung-uk KimDES_random_key, DES_set_key, DES_key_sched, DES_set_key_checked,
6*e71b7053SJung-uk KimDES_set_key_unchecked, DES_set_odd_parity, DES_is_weak_key,
7*e71b7053SJung-uk KimDES_ecb_encrypt, DES_ecb2_encrypt, DES_ecb3_encrypt, DES_ncbc_encrypt,
8*e71b7053SJung-uk KimDES_cfb_encrypt, DES_ofb_encrypt, DES_pcbc_encrypt, DES_cfb64_encrypt,
9*e71b7053SJung-uk KimDES_ofb64_encrypt, DES_xcbc_encrypt, DES_ede2_cbc_encrypt,
10*e71b7053SJung-uk KimDES_ede2_cfb64_encrypt, DES_ede2_ofb64_encrypt, DES_ede3_cbc_encrypt,
11*e71b7053SJung-uk KimDES_ede3_cfb64_encrypt, DES_ede3_ofb64_encrypt,
12*e71b7053SJung-uk KimDES_cbc_cksum, DES_quad_cksum, DES_string_to_key, DES_string_to_2keys,
13*e71b7053SJung-uk KimDES_fcrypt, DES_crypt - DES encryption
14*e71b7053SJung-uk Kim
15*e71b7053SJung-uk Kim=head1 SYNOPSIS
16*e71b7053SJung-uk Kim
17*e71b7053SJung-uk Kim #include <openssl/des.h>
18*e71b7053SJung-uk Kim
19*e71b7053SJung-uk Kim void DES_random_key(DES_cblock *ret);
20*e71b7053SJung-uk Kim
21*e71b7053SJung-uk Kim int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);
22*e71b7053SJung-uk Kim int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);
23*e71b7053SJung-uk Kim int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule);
24*e71b7053SJung-uk Kim void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule);
25*e71b7053SJung-uk Kim
26*e71b7053SJung-uk Kim void DES_set_odd_parity(DES_cblock *key);
27*e71b7053SJung-uk Kim int DES_is_weak_key(const_DES_cblock *key);
28*e71b7053SJung-uk Kim
29*e71b7053SJung-uk Kim void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,
30*e71b7053SJung-uk Kim                      DES_key_schedule *ks, int enc);
31*e71b7053SJung-uk Kim void DES_ecb2_encrypt(const_DES_cblock *input, DES_cblock *output,
32*e71b7053SJung-uk Kim                       DES_key_schedule *ks1, DES_key_schedule *ks2, int enc);
33*e71b7053SJung-uk Kim void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
34*e71b7053SJung-uk Kim                       DES_key_schedule *ks1, DES_key_schedule *ks2,
35*e71b7053SJung-uk Kim                       DES_key_schedule *ks3, int enc);
36*e71b7053SJung-uk Kim
37*e71b7053SJung-uk Kim void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output,
38*e71b7053SJung-uk Kim                       long length, DES_key_schedule *schedule, DES_cblock *ivec,
39*e71b7053SJung-uk Kim                       int enc);
40*e71b7053SJung-uk Kim void DES_cfb_encrypt(const unsigned char *in, unsigned char *out,
41*e71b7053SJung-uk Kim                      int numbits, long length, DES_key_schedule *schedule,
42*e71b7053SJung-uk Kim                      DES_cblock *ivec, int enc);
43*e71b7053SJung-uk Kim void DES_ofb_encrypt(const unsigned char *in, unsigned char *out,
44*e71b7053SJung-uk Kim                      int numbits, long length, DES_key_schedule *schedule,
45*e71b7053SJung-uk Kim                      DES_cblock *ivec);
46*e71b7053SJung-uk Kim void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output,
47*e71b7053SJung-uk Kim                       long length, DES_key_schedule *schedule, DES_cblock *ivec,
48*e71b7053SJung-uk Kim                       int enc);
49*e71b7053SJung-uk Kim void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out,
50*e71b7053SJung-uk Kim                        long length, DES_key_schedule *schedule, DES_cblock *ivec,
51*e71b7053SJung-uk Kim                        int *num, int enc);
52*e71b7053SJung-uk Kim void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out,
53*e71b7053SJung-uk Kim                        long length, DES_key_schedule *schedule, DES_cblock *ivec,
54*e71b7053SJung-uk Kim                        int *num);
55*e71b7053SJung-uk Kim
56*e71b7053SJung-uk Kim void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output,
57*e71b7053SJung-uk Kim                       long length, DES_key_schedule *schedule, DES_cblock *ivec,
58*e71b7053SJung-uk Kim                       const_DES_cblock *inw, const_DES_cblock *outw, int enc);
59*e71b7053SJung-uk Kim
60*e71b7053SJung-uk Kim void DES_ede2_cbc_encrypt(const unsigned char *input, unsigned char *output,
61*e71b7053SJung-uk Kim                           long length, DES_key_schedule *ks1,
62*e71b7053SJung-uk Kim                           DES_key_schedule *ks2, DES_cblock *ivec, int enc);
63*e71b7053SJung-uk Kim void DES_ede2_cfb64_encrypt(const unsigned char *in, unsigned char *out,
64*e71b7053SJung-uk Kim                             long length, DES_key_schedule *ks1,
65*e71b7053SJung-uk Kim                             DES_key_schedule *ks2, DES_cblock *ivec,
66*e71b7053SJung-uk Kim                             int *num, int enc);
67*e71b7053SJung-uk Kim void DES_ede2_ofb64_encrypt(const unsigned char *in, unsigned char *out,
68*e71b7053SJung-uk Kim                             long length, DES_key_schedule *ks1,
69*e71b7053SJung-uk Kim                             DES_key_schedule *ks2, DES_cblock *ivec, int *num);
70*e71b7053SJung-uk Kim
71*e71b7053SJung-uk Kim void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output,
72*e71b7053SJung-uk Kim                           long length, DES_key_schedule *ks1,
73*e71b7053SJung-uk Kim                           DES_key_schedule *ks2, DES_key_schedule *ks3,
74*e71b7053SJung-uk Kim                           DES_cblock *ivec, int enc);
75*e71b7053SJung-uk Kim void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,
76*e71b7053SJung-uk Kim                             long length, DES_key_schedule *ks1,
77*e71b7053SJung-uk Kim                             DES_key_schedule *ks2, DES_key_schedule *ks3,
78*e71b7053SJung-uk Kim                             DES_cblock *ivec, int *num, int enc);
79*e71b7053SJung-uk Kim void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out,
80*e71b7053SJung-uk Kim                             long length, DES_key_schedule *ks1,
81*e71b7053SJung-uk Kim                             DES_key_schedule *ks2, DES_key_schedule *ks3,
82*e71b7053SJung-uk Kim                             DES_cblock *ivec, int *num);
83*e71b7053SJung-uk Kim
84*e71b7053SJung-uk Kim DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output,
85*e71b7053SJung-uk Kim                        long length, DES_key_schedule *schedule,
86*e71b7053SJung-uk Kim                        const_DES_cblock *ivec);
87*e71b7053SJung-uk Kim DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[],
88*e71b7053SJung-uk Kim                         long length, int out_count, DES_cblock *seed);
89*e71b7053SJung-uk Kim void DES_string_to_key(const char *str, DES_cblock *key);
90*e71b7053SJung-uk Kim void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2);
91*e71b7053SJung-uk Kim
92*e71b7053SJung-uk Kim char *DES_fcrypt(const char *buf, const char *salt, char *ret);
93*e71b7053SJung-uk Kim char *DES_crypt(const char *buf, const char *salt);
94*e71b7053SJung-uk Kim
95*e71b7053SJung-uk Kim=head1 DESCRIPTION
96*e71b7053SJung-uk Kim
97*e71b7053SJung-uk KimThis library contains a fast implementation of the DES encryption
98*e71b7053SJung-uk Kimalgorithm.
99*e71b7053SJung-uk Kim
100*e71b7053SJung-uk KimThere are two phases to the use of DES encryption.  The first is the
101*e71b7053SJung-uk Kimgeneration of a I<DES_key_schedule> from a key, the second is the
102*e71b7053SJung-uk Kimactual encryption.  A DES key is of type I<DES_cblock>. This type is
103*e71b7053SJung-uk Kimconsists of 8 bytes with odd parity.  The least significant bit in
104*e71b7053SJung-uk Kimeach byte is the parity bit.  The key schedule is an expanded form of
105*e71b7053SJung-uk Kimthe key; it is used to speed the encryption process.
106*e71b7053SJung-uk Kim
107*e71b7053SJung-uk KimDES_random_key() generates a random key.  The PRNG must be seeded
108*e71b7053SJung-uk Kimprior to using this function (see L<RAND_bytes(3)>).  If the PRNG
109*e71b7053SJung-uk Kimcould not generate a secure key, 0 is returned.
110*e71b7053SJung-uk Kim
111*e71b7053SJung-uk KimBefore a DES key can be used, it must be converted into the
112*e71b7053SJung-uk Kimarchitecture dependent I<DES_key_schedule> via the
113*e71b7053SJung-uk KimDES_set_key_checked() or DES_set_key_unchecked() function.
114*e71b7053SJung-uk Kim
115*e71b7053SJung-uk KimDES_set_key_checked() will check that the key passed is of odd parity
116*e71b7053SJung-uk Kimand is not a weak or semi-weak key.  If the parity is wrong, then -1
117*e71b7053SJung-uk Kimis returned.  If the key is a weak key, then -2 is returned.  If an
118*e71b7053SJung-uk Kimerror is returned, the key schedule is not generated.
119*e71b7053SJung-uk Kim
120*e71b7053SJung-uk KimDES_set_key() works like
121*e71b7053SJung-uk KimDES_set_key_checked() if the I<DES_check_key> flag is non-zero,
122*e71b7053SJung-uk Kimotherwise like DES_set_key_unchecked().  These functions are available
123*e71b7053SJung-uk Kimfor compatibility; it is recommended to use a function that does not
124*e71b7053SJung-uk Kimdepend on a global variable.
125*e71b7053SJung-uk Kim
126*e71b7053SJung-uk KimDES_set_odd_parity() sets the parity of the passed I<key> to odd.
127*e71b7053SJung-uk Kim
128*e71b7053SJung-uk KimDES_is_weak_key() returns 1 if the passed key is a weak key, 0 if it
129*e71b7053SJung-uk Kimis ok.
130*e71b7053SJung-uk Kim
131*e71b7053SJung-uk KimThe following routines mostly operate on an input and output stream of
132*e71b7053SJung-uk KimI<DES_cblock>s.
133*e71b7053SJung-uk Kim
134*e71b7053SJung-uk KimDES_ecb_encrypt() is the basic DES encryption routine that encrypts or
135*e71b7053SJung-uk Kimdecrypts a single 8-byte I<DES_cblock> in I<electronic code book>
136*e71b7053SJung-uk Kim(ECB) mode.  It always transforms the input data, pointed to by
137*e71b7053SJung-uk KimI<input>, into the output data, pointed to by the I<output> argument.
138*e71b7053SJung-uk KimIf the I<encrypt> argument is non-zero (DES_ENCRYPT), the I<input>
139*e71b7053SJung-uk Kim(cleartext) is encrypted in to the I<output> (ciphertext) using the
140*e71b7053SJung-uk Kimkey_schedule specified by the I<schedule> argument, previously set via
141*e71b7053SJung-uk KimI<DES_set_key>. If I<encrypt> is zero (DES_DECRYPT), the I<input> (now
142*e71b7053SJung-uk Kimciphertext) is decrypted into the I<output> (now cleartext).  Input
143*e71b7053SJung-uk Kimand output may overlap.  DES_ecb_encrypt() does not return a value.
144*e71b7053SJung-uk Kim
145*e71b7053SJung-uk KimDES_ecb3_encrypt() encrypts/decrypts the I<input> block by using
146*e71b7053SJung-uk Kimthree-key Triple-DES encryption in ECB mode.  This involves encrypting
147*e71b7053SJung-uk Kimthe input with I<ks1>, decrypting with the key schedule I<ks2>, and
148*e71b7053SJung-uk Kimthen encrypting with I<ks3>.  This routine greatly reduces the chances
149*e71b7053SJung-uk Kimof brute force breaking of DES and has the advantage of if I<ks1>,
150*e71b7053SJung-uk KimI<ks2> and I<ks3> are the same, it is equivalent to just encryption
151*e71b7053SJung-uk Kimusing ECB mode and I<ks1> as the key.
152*e71b7053SJung-uk Kim
153*e71b7053SJung-uk KimThe macro DES_ecb2_encrypt() is provided to perform two-key Triple-DES
154*e71b7053SJung-uk Kimencryption by using I<ks1> for the final encryption.
155*e71b7053SJung-uk Kim
156*e71b7053SJung-uk KimDES_ncbc_encrypt() encrypts/decrypts using the I<cipher-block-chaining>
157*e71b7053SJung-uk Kim(CBC) mode of DES.  If the I<encrypt> argument is non-zero, the
158*e71b7053SJung-uk Kimroutine cipher-block-chain encrypts the cleartext data pointed to by
159*e71b7053SJung-uk Kimthe I<input> argument into the ciphertext pointed to by the I<output>
160*e71b7053SJung-uk Kimargument, using the key schedule provided by the I<schedule> argument,
161*e71b7053SJung-uk Kimand initialization vector provided by the I<ivec> argument.  If the
162*e71b7053SJung-uk KimI<length> argument is not an integral multiple of eight bytes, the
163*e71b7053SJung-uk Kimlast block is copied to a temporary area and zero filled.  The output
164*e71b7053SJung-uk Kimis always an integral multiple of eight bytes.
165*e71b7053SJung-uk Kim
166*e71b7053SJung-uk KimDES_xcbc_encrypt() is RSA's DESX mode of DES.  It uses I<inw> and
167*e71b7053SJung-uk KimI<outw> to 'whiten' the encryption.  I<inw> and I<outw> are secret
168*e71b7053SJung-uk Kim(unlike the iv) and are as such, part of the key.  So the key is sort
169*e71b7053SJung-uk Kimof 24 bytes.  This is much better than CBC DES.
170*e71b7053SJung-uk Kim
171*e71b7053SJung-uk KimDES_ede3_cbc_encrypt() implements outer triple CBC DES encryption with
172*e71b7053SJung-uk Kimthree keys. This means that each DES operation inside the CBC mode is
173*e71b7053SJung-uk Kiman C<C=E(ks3,D(ks2,E(ks1,M)))>.  This mode is used by SSL.
174*e71b7053SJung-uk Kim
175*e71b7053SJung-uk KimThe DES_ede2_cbc_encrypt() macro implements two-key Triple-DES by
176*e71b7053SJung-uk Kimreusing I<ks1> for the final encryption.  C<C=E(ks1,D(ks2,E(ks1,M)))>.
177*e71b7053SJung-uk KimThis form of Triple-DES is used by the RSAREF library.
178*e71b7053SJung-uk Kim
179*e71b7053SJung-uk KimDES_pcbc_encrypt() encrypt/decrypts using the propagating cipher block
180*e71b7053SJung-uk Kimchaining mode used by Kerberos v4. Its parameters are the same as
181*e71b7053SJung-uk KimDES_ncbc_encrypt().
182*e71b7053SJung-uk Kim
183*e71b7053SJung-uk KimDES_cfb_encrypt() encrypt/decrypts using cipher feedback mode.  This
184*e71b7053SJung-uk Kimmethod takes an array of characters as input and outputs and array of
185*e71b7053SJung-uk Kimcharacters.  It does not require any padding to 8 character groups.
186*e71b7053SJung-uk KimNote: the I<ivec> variable is changed and the new changed value needs to
187*e71b7053SJung-uk Kimbe passed to the next call to this function.  Since this function runs
188*e71b7053SJung-uk Kima complete DES ECB encryption per I<numbits>, this function is only
189*e71b7053SJung-uk Kimsuggested for use when sending small numbers of characters.
190*e71b7053SJung-uk Kim
191*e71b7053SJung-uk KimDES_cfb64_encrypt()
192*e71b7053SJung-uk Kimimplements CFB mode of DES with 64bit feedback.  Why is this
193*e71b7053SJung-uk Kimuseful you ask?  Because this routine will allow you to encrypt an
194*e71b7053SJung-uk Kimarbitrary number of bytes, no 8 byte padding.  Each call to this
195*e71b7053SJung-uk Kimroutine will encrypt the input bytes to output and then update ivec
196*e71b7053SJung-uk Kimand num.  num contains 'how far' we are though ivec.  If this does
197*e71b7053SJung-uk Kimnot make much sense, read more about cfb mode of DES :-).
198*e71b7053SJung-uk Kim
199*e71b7053SJung-uk KimDES_ede3_cfb64_encrypt() and DES_ede2_cfb64_encrypt() is the same as
200*e71b7053SJung-uk KimDES_cfb64_encrypt() except that Triple-DES is used.
201*e71b7053SJung-uk Kim
202*e71b7053SJung-uk KimDES_ofb_encrypt() encrypts using output feedback mode.  This method
203*e71b7053SJung-uk Kimtakes an array of characters as input and outputs and array of
204*e71b7053SJung-uk Kimcharacters.  It does not require any padding to 8 character groups.
205*e71b7053SJung-uk KimNote: the I<ivec> variable is changed and the new changed value needs to
206*e71b7053SJung-uk Kimbe passed to the next call to this function.  Since this function runs
207*e71b7053SJung-uk Kima complete DES ECB encryption per numbits, this function is only
208*e71b7053SJung-uk Kimsuggested for use when sending small numbers of characters.
209*e71b7053SJung-uk Kim
210*e71b7053SJung-uk KimDES_ofb64_encrypt() is the same as DES_cfb64_encrypt() using Output
211*e71b7053SJung-uk KimFeed Back mode.
212*e71b7053SJung-uk Kim
213*e71b7053SJung-uk KimDES_ede3_ofb64_encrypt() and DES_ede2_ofb64_encrypt() is the same as
214*e71b7053SJung-uk KimDES_ofb64_encrypt(), using Triple-DES.
215*e71b7053SJung-uk Kim
216*e71b7053SJung-uk KimThe following functions are included in the DES library for
217*e71b7053SJung-uk Kimcompatibility with the MIT Kerberos library.
218*e71b7053SJung-uk Kim
219*e71b7053SJung-uk KimDES_cbc_cksum() produces an 8 byte checksum based on the input stream
220*e71b7053SJung-uk Kim(via CBC encryption).  The last 4 bytes of the checksum are returned
221*e71b7053SJung-uk Kimand the complete 8 bytes are placed in I<output>. This function is
222*e71b7053SJung-uk Kimused by Kerberos v4.  Other applications should use
223*e71b7053SJung-uk KimL<EVP_DigestInit(3)> etc. instead.
224*e71b7053SJung-uk Kim
225*e71b7053SJung-uk KimDES_quad_cksum() is a Kerberos v4 function.  It returns a 4 byte
226*e71b7053SJung-uk Kimchecksum from the input bytes.  The algorithm can be iterated over the
227*e71b7053SJung-uk Kiminput, depending on I<out_count>, 1, 2, 3 or 4 times.  If I<output> is
228*e71b7053SJung-uk Kimnon-NULL, the 8 bytes generated by each pass are written into
229*e71b7053SJung-uk KimI<output>.
230*e71b7053SJung-uk Kim
231*e71b7053SJung-uk KimThe following are DES-based transformations:
232*e71b7053SJung-uk Kim
233*e71b7053SJung-uk KimDES_fcrypt() is a fast version of the Unix crypt(3) function.  This
234*e71b7053SJung-uk Kimversion takes only a small amount of space relative to other fast
235*e71b7053SJung-uk Kimcrypt() implementations.  This is different to the normal crypt in
236*e71b7053SJung-uk Kimthat the third parameter is the buffer that the return value is
237*e71b7053SJung-uk Kimwritten into.  It needs to be at least 14 bytes long.  This function
238*e71b7053SJung-uk Kimis thread safe, unlike the normal crypt.
239*e71b7053SJung-uk Kim
240*e71b7053SJung-uk KimDES_crypt() is a faster replacement for the normal system crypt().
241*e71b7053SJung-uk KimThis function calls DES_fcrypt() with a static array passed as the
242*e71b7053SJung-uk Kimthird parameter.  This mostly emulates the normal non-thread-safe semantics
243*e71b7053SJung-uk Kimof crypt(3).
244*e71b7053SJung-uk KimThe B<salt> must be two ASCII characters.
245*e71b7053SJung-uk Kim
246*e71b7053SJung-uk KimThe values returned by DES_fcrypt() and DES_crypt() are terminated by NUL
247*e71b7053SJung-uk Kimcharacter.
248*e71b7053SJung-uk Kim
249*e71b7053SJung-uk KimDES_enc_write() writes I<len> bytes to file descriptor I<fd> from
250*e71b7053SJung-uk Kimbuffer I<buf>. The data is encrypted via I<pcbc_encrypt> (default)
251*e71b7053SJung-uk Kimusing I<sched> for the key and I<iv> as a starting vector.  The actual
252*e71b7053SJung-uk Kimdata send down I<fd> consists of 4 bytes (in network byte order)
253*e71b7053SJung-uk Kimcontaining the length of the following encrypted data.  The encrypted
254*e71b7053SJung-uk Kimdata then follows, padded with random data out to a multiple of 8
255*e71b7053SJung-uk Kimbytes.
256*e71b7053SJung-uk Kim
257*e71b7053SJung-uk Kim=head1 BUGS
258*e71b7053SJung-uk Kim
259*e71b7053SJung-uk KimDES_cbc_encrypt() does not modify B<ivec>; use DES_ncbc_encrypt()
260*e71b7053SJung-uk Kiminstead.
261*e71b7053SJung-uk Kim
262*e71b7053SJung-uk KimDES_cfb_encrypt() and DES_ofb_encrypt() operates on input of 8 bits.
263*e71b7053SJung-uk KimWhat this means is that if you set numbits to 12, and length to 2, the
264*e71b7053SJung-uk Kimfirst 12 bits will come from the 1st input byte and the low half of
265*e71b7053SJung-uk Kimthe second input byte.  The second 12 bits will have the low 8 bits
266*e71b7053SJung-uk Kimtaken from the 3rd input byte and the top 4 bits taken from the 4th
267*e71b7053SJung-uk Kiminput byte.  The same holds for output.  This function has been
268*e71b7053SJung-uk Kimimplemented this way because most people will be using a multiple of 8
269*e71b7053SJung-uk Kimand because once you get into pulling bytes input bytes apart things
270*e71b7053SJung-uk Kimget ugly!
271*e71b7053SJung-uk Kim
272*e71b7053SJung-uk KimDES_string_to_key() is available for backward compatibility with the
273*e71b7053SJung-uk KimMIT library.  New applications should use a cryptographic hash function.
274*e71b7053SJung-uk KimThe same applies for DES_string_to_2key().
275*e71b7053SJung-uk Kim
276*e71b7053SJung-uk Kim=head1 NOTES
277*e71b7053SJung-uk Kim
278*e71b7053SJung-uk KimThe B<des> library was written to be source code compatible with
279*e71b7053SJung-uk Kimthe MIT Kerberos library.
280*e71b7053SJung-uk Kim
281*e71b7053SJung-uk KimApplications should use the higher level functions
282*e71b7053SJung-uk KimL<EVP_EncryptInit(3)> etc. instead of calling these
283*e71b7053SJung-uk Kimfunctions directly.
284*e71b7053SJung-uk Kim
285*e71b7053SJung-uk KimSingle-key DES is insecure due to its short key size.  ECB mode is
286*e71b7053SJung-uk Kimnot suitable for most applications; see L<des_modes(7)>.
287*e71b7053SJung-uk Kim
288*e71b7053SJung-uk Kim=head1 RETURN VALUES
289*e71b7053SJung-uk Kim
290*e71b7053SJung-uk KimDES_set_key(), DES_key_sched(), DES_set_key_checked() and DES_is_weak_key()
291*e71b7053SJung-uk Kimreturn 0 on success or negative values on error.
292*e71b7053SJung-uk Kim
293*e71b7053SJung-uk KimDES_cbc_cksum() and DES_quad_cksum() return 4-byte integer representing the
294*e71b7053SJung-uk Kimlast 4 bytes of the checksum of the input.
295*e71b7053SJung-uk Kim
296*e71b7053SJung-uk KimDES_fcrypt() returns a pointer to the caller-provided buffer and DES_crypt() -
297*e71b7053SJung-uk Kimto a static buffer on success; otherwise they return NULL.
298*e71b7053SJung-uk Kim
299*e71b7053SJung-uk Kim=head1 HISTORY
300*e71b7053SJung-uk Kim
301*e71b7053SJung-uk KimThe requirement that the B<salt> parameter to DES_crypt() and DES_fcrypt()
302*e71b7053SJung-uk Kimbe two ASCII characters was first enforced in
303*e71b7053SJung-uk KimOpenSSL 1.1.0.  Previous versions tried to use the letter uppercase B<A>
304*e71b7053SJung-uk Kimif both character were not present, and could crash when given non-ASCII
305*e71b7053SJung-uk Kimon some platforms.
306*e71b7053SJung-uk Kim
307*e71b7053SJung-uk Kim=head1 SEE ALSO
308*e71b7053SJung-uk Kim
309*e71b7053SJung-uk KimL<des_modes(7)>,
310*e71b7053SJung-uk KimL<EVP_EncryptInit(3)>
311*e71b7053SJung-uk Kim
312*e71b7053SJung-uk Kim=head1 COPYRIGHT
313*e71b7053SJung-uk Kim
314*e71b7053SJung-uk KimCopyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
315*e71b7053SJung-uk Kim
316*e71b7053SJung-uk KimLicensed under the OpenSSL license (the "License").  You may not use
317*e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
318*e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
319*e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
320*e71b7053SJung-uk Kim
321*e71b7053SJung-uk Kim=cut
322