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