xref: /netbsd-src/crypto/external/bsd/openssl.old/lib/libdes/des.pod (revision c9496f6b604074a9451a67df576a5b423068e71e)
1*c9496f6bSchristos=pod
2*c9496f6bSchristos
3*c9496f6bSchristos=head1 NAME
4*c9496f6bSchristos
5*c9496f6bSchristosdes_random_key, des_set_key, des_key_sched, des_set_key_checked,
6*c9496f6bSchristosdes_set_key_unchecked, des_set_odd_parity, des_is_weak_key,
7*c9496f6bSchristosdes_ecb_encrypt, des_ecb2_encrypt, des_ecb3_encrypt, des_ncbc_encrypt,
8*c9496f6bSchristosdes_cfb_encrypt, des_ofb_encrypt, des_pcbc_encrypt, des_cfb64_encrypt,
9*c9496f6bSchristosdes_ofb64_encrypt, des_xcbc_encrypt, des_ede2_cbc_encrypt,
10*c9496f6bSchristosdes_ede2_cfb64_encrypt, des_ede2_ofb64_encrypt, des_ede3_cbc_encrypt,
11*c9496f6bSchristosdes_ede3_cbcm_encrypt, des_ede3_cfb64_encrypt, des_ede3_ofb64_encrypt,
12*c9496f6bSchristosdes_read_password, des_read_2passwords, des_read_pw_string,
13*c9496f6bSchristosdes_cbc_cksum, des_quad_cksum, des_string_to_key, des_string_to_2keys,
14*c9496f6bSchristosdes_fcrypt, des_crypt, des_enc_read, des_enc_write - DES encryption
15*c9496f6bSchristos
16*c9496f6bSchristos=head1 SYNOPSIS
17*c9496f6bSchristos
18*c9496f6bSchristos #include <openssl/des.h>
19*c9496f6bSchristos
20*c9496f6bSchristos void des_random_key(des_cblock *ret);
21*c9496f6bSchristos
22*c9496f6bSchristos int des_set_key(const_des_cblock *key, des_key_schedule schedule);
23*c9496f6bSchristos int des_key_sched(const_des_cblock *key, des_key_schedule schedule);
24*c9496f6bSchristos int des_set_key_checked(const_des_cblock *key,
25*c9496f6bSchristos        des_key_schedule schedule);
26*c9496f6bSchristos void des_set_key_unchecked(const_des_cblock *key,
27*c9496f6bSchristos        des_key_schedule schedule);
28*c9496f6bSchristos
29*c9496f6bSchristos void des_set_odd_parity(des_cblock *key);
30*c9496f6bSchristos int des_is_weak_key(const_des_cblock *key);
31*c9496f6bSchristos
32*c9496f6bSchristos void des_ecb_encrypt(const_des_cblock *input, des_cblock *output,
33*c9496f6bSchristos        des_key_schedule ks, int enc);
34*c9496f6bSchristos void des_ecb2_encrypt(const_des_cblock *input, des_cblock *output,
35*c9496f6bSchristos        des_key_schedule ks1, des_key_schedule ks2, int enc);
36*c9496f6bSchristos void des_ecb3_encrypt(const_des_cblock *input, des_cblock *output,
37*c9496f6bSchristos        des_key_schedule ks1, des_key_schedule ks2,
38*c9496f6bSchristos        des_key_schedule ks3, int enc);
39*c9496f6bSchristos
40*c9496f6bSchristos void des_ncbc_encrypt(const unsigned char *input, unsigned char *output,
41*c9496f6bSchristos        long length, des_key_schedule schedule, des_cblock *ivec,
42*c9496f6bSchristos        int enc);
43*c9496f6bSchristos void des_cfb_encrypt(const unsigned char *in, unsigned char *out,
44*c9496f6bSchristos        int numbits, long length, des_key_schedule schedule,
45*c9496f6bSchristos        des_cblock *ivec, int enc);
46*c9496f6bSchristos void des_ofb_encrypt(const unsigned char *in, unsigned char *out,
47*c9496f6bSchristos        int numbits, long length, des_key_schedule schedule,
48*c9496f6bSchristos        des_cblock *ivec);
49*c9496f6bSchristos void des_pcbc_encrypt(const unsigned char *input, unsigned char *output,
50*c9496f6bSchristos        long length, des_key_schedule schedule, des_cblock *ivec,
51*c9496f6bSchristos        int enc);
52*c9496f6bSchristos void des_cfb64_encrypt(const unsigned char *in, unsigned char *out,
53*c9496f6bSchristos        long length, des_key_schedule schedule, des_cblock *ivec,
54*c9496f6bSchristos        int *num, int enc);
55*c9496f6bSchristos void des_ofb64_encrypt(const unsigned char *in, unsigned char *out,
56*c9496f6bSchristos        long length, des_key_schedule schedule, des_cblock *ivec,
57*c9496f6bSchristos        int *num);
58*c9496f6bSchristos
59*c9496f6bSchristos void des_xcbc_encrypt(const unsigned char *input, unsigned char *output,
60*c9496f6bSchristos        long length, des_key_schedule schedule, des_cblock *ivec,
61*c9496f6bSchristos        const_des_cblock *inw, const_des_cblock *outw, int enc);
62*c9496f6bSchristos
63*c9496f6bSchristos void des_ede2_cbc_encrypt(const unsigned char *input,
64*c9496f6bSchristos        unsigned char *output, long length, des_key_schedule ks1,
65*c9496f6bSchristos        des_key_schedule ks2, des_cblock *ivec, int enc);
66*c9496f6bSchristos void des_ede2_cfb64_encrypt(const unsigned char *in,
67*c9496f6bSchristos        unsigned char *out, long length, des_key_schedule ks1,
68*c9496f6bSchristos        des_key_schedule ks2, des_cblock *ivec, int *num, int enc);
69*c9496f6bSchristos void des_ede2_ofb64_encrypt(const unsigned char *in,
70*c9496f6bSchristos        unsigned char *out, long length, des_key_schedule ks1,
71*c9496f6bSchristos        des_key_schedule ks2, des_cblock *ivec, int *num);
72*c9496f6bSchristos
73*c9496f6bSchristos void des_ede3_cbc_encrypt(const unsigned char *input,
74*c9496f6bSchristos        unsigned char *output, long length, des_key_schedule ks1,
75*c9496f6bSchristos        des_key_schedule ks2, des_key_schedule ks3, des_cblock *ivec,
76*c9496f6bSchristos        int enc);
77*c9496f6bSchristos void des_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out,
78*c9496f6bSchristos        long length, des_key_schedule ks1, des_key_schedule ks2,
79*c9496f6bSchristos        des_key_schedule ks3, des_cblock *ivec1, des_cblock *ivec2,
80*c9496f6bSchristos        int enc);
81*c9496f6bSchristos void des_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,
82*c9496f6bSchristos        long length, des_key_schedule ks1, des_key_schedule ks2,
83*c9496f6bSchristos        des_key_schedule ks3, des_cblock *ivec, int *num, int enc);
84*c9496f6bSchristos void des_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out,
85*c9496f6bSchristos        long length, des_key_schedule ks1,
86*c9496f6bSchristos        des_key_schedule ks2, des_key_schedule ks3,
87*c9496f6bSchristos        des_cblock *ivec, int *num);
88*c9496f6bSchristos
89*c9496f6bSchristos int des_read_password(des_cblock *key, const char *prompt, int verify);
90*c9496f6bSchristos int des_read_2passwords(des_cblock *key1, des_cblock *key2,
91*c9496f6bSchristos        const char *prompt, int verify);
92*c9496f6bSchristos int des_read_pw_string(char *buf, int length, const char *prompt,
93*c9496f6bSchristos        int verify);
94*c9496f6bSchristos
95*c9496f6bSchristos DES_LONG des_cbc_cksum(const unsigned char *input, des_cblock *output,
96*c9496f6bSchristos        long length, des_key_schedule schedule,
97*c9496f6bSchristos        const_des_cblock *ivec);
98*c9496f6bSchristos DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[],
99*c9496f6bSchristos        long length, int out_count, des_cblock *seed);
100*c9496f6bSchristos void des_string_to_key(const char *str, des_cblock *key);
101*c9496f6bSchristos void des_string_to_2keys(const char *str, des_cblock *key1,
102*c9496f6bSchristos        des_cblock *key2);
103*c9496f6bSchristos
104*c9496f6bSchristos char *des_fcrypt(const char *buf, const char *salt, char *ret);
105*c9496f6bSchristos char *des_crypt(const char *buf, const char *salt);
106*c9496f6bSchristos char *crypt(const char *buf, const char *salt);
107*c9496f6bSchristos
108*c9496f6bSchristos int des_enc_read(int fd, void *buf, int len, des_key_schedule sched,
109*c9496f6bSchristos        des_cblock *iv);
110*c9496f6bSchristos int des_enc_write(int fd, const void *buf, int len,
111*c9496f6bSchristos        des_key_schedule sched, des_cblock *iv);
112*c9496f6bSchristos
113*c9496f6bSchristos=head1 DESCRIPTION
114*c9496f6bSchristos
115*c9496f6bSchristosThis library contains a fast implementation of the DES encryption
116*c9496f6bSchristosalgorithm.
117*c9496f6bSchristos
118*c9496f6bSchristosThere are two phases to the use of DES encryption.  The first is the
119*c9496f6bSchristosgeneration of a I<des_key_schedule> from a key, the second is the
120*c9496f6bSchristosactual encryption.  A DES key is of type I<des_cblock>. This type is
121*c9496f6bSchristosconsists of 8 bytes with odd parity.  The least significant bit in
122*c9496f6bSchristoseach byte is the parity bit.  The key schedule is an expanded form of
123*c9496f6bSchristosthe key; it is used to speed the encryption process.
124*c9496f6bSchristos
125*c9496f6bSchristosdes_random_key() generates a random key.  The PRNG must be seeded
126*c9496f6bSchristosprior to using this function (see L<rand(3)|rand(3)>; for backward
127*c9496f6bSchristoscompatibility the function des_random_seed() is available as well).
128*c9496f6bSchristosIf the PRNG could not generate a secure key, 0 is returned.  In
129*c9496f6bSchristosearlier versions of the library, des_random_key() did not generate
130*c9496f6bSchristossecure keys.
131*c9496f6bSchristos
132*c9496f6bSchristosBefore a DES key can be used, it must be converted into the
133*c9496f6bSchristosarchitecture dependent I<des_key_schedule> via the
134*c9496f6bSchristosdes_set_key_checked() or des_set_key_unchecked() function.
135*c9496f6bSchristos
136*c9496f6bSchristosdes_set_key_checked() will check that the key passed is of odd parity
137*c9496f6bSchristosand is not a week or semi-weak key.  If the parity is wrong, then -1
138*c9496f6bSchristosis returned.  If the key is a weak key, then -2 is returned.  If an
139*c9496f6bSchristoserror is returned, the key schedule is not generated.
140*c9496f6bSchristos
141*c9496f6bSchristosdes_set_key() (called des_key_sched() in the MIT library) works like
142*c9496f6bSchristosdes_set_key_checked() if the I<des_check_key> flag is non-zero,
143*c9496f6bSchristosotherwise like des_set_key_unchecked().  These functions are available
144*c9496f6bSchristosfor compatibility; it is recommended to use a function that does not
145*c9496f6bSchristosdepend on a global variable.
146*c9496f6bSchristos
147*c9496f6bSchristosdes_set_odd_parity() (called des_fixup_key_parity() in the MIT
148*c9496f6bSchristoslibrary) sets the parity of the passed I<key> to odd.
149*c9496f6bSchristos
150*c9496f6bSchristosdes_is_weak_key() returns 1 is the passed key is a weak key, 0 if it
151*c9496f6bSchristosis ok.  The probability that a randomly generated key is weak is
152*c9496f6bSchristos1/2^52, so it is not really worth checking for them.
153*c9496f6bSchristos
154*c9496f6bSchristosThe following routines mostly operate on an input and output stream of
155*c9496f6bSchristosI<des_cblock>s.
156*c9496f6bSchristos
157*c9496f6bSchristosdes_ecb_encrypt() is the basic DES encryption routine that encrypts or
158*c9496f6bSchristosdecrypts a single 8-byte I<des_cblock> in I<electronic code book>
159*c9496f6bSchristos(ECB) mode.  It always transforms the input data, pointed to by
160*c9496f6bSchristosI<input>, into the output data, pointed to by the I<output> argument.
161*c9496f6bSchristosIf the I<encrypt> argument is non-zero (DES_ENCRYPT), the I<input>
162*c9496f6bSchristos(cleartext) is encrypted in to the I<output> (ciphertext) using the
163*c9496f6bSchristoskey_schedule specified by the I<schedule> argument, previously set via
164*c9496f6bSchristosI<des_set_key>. If I<encrypt> is zero (DES_DECRYPT), the I<input> (now
165*c9496f6bSchristosciphertext) is decrypted into the I<output> (now cleartext).  Input
166*c9496f6bSchristosand output may overlap.  des_ecb_encrypt() does not return a value.
167*c9496f6bSchristos
168*c9496f6bSchristosdes_ecb3_encrypt() encrypts/decrypts the I<input> block by using
169*c9496f6bSchristosthree-key Triple-DES encryption in ECB mode.  This involves encrypting
170*c9496f6bSchristosthe input with I<ks1>, decrypting with the key schedule I<ks2>, and
171*c9496f6bSchristosthen encrypting with I<ks3>.  This routine greatly reduces the chances
172*c9496f6bSchristosof brute force breaking of DES and has the advantage of if I<ks1>,
173*c9496f6bSchristosI<ks2> and I<ks3> are the same, it is equivalent to just encryption
174*c9496f6bSchristosusing ECB mode and I<ks1> as the key.
175*c9496f6bSchristos
176*c9496f6bSchristosThe macro des_ecb2_encrypt() is provided to perform two-key Triple-DES
177*c9496f6bSchristosencryption by using I<ks1> for the final encryption.
178*c9496f6bSchristos
179*c9496f6bSchristosdes_ncbc_encrypt() encrypts/decrypts using the I<cipher-block-chaining>
180*c9496f6bSchristos(CBC) mode of DES.  If the I<encrypt> argument is non-zero, the
181*c9496f6bSchristosroutine cipher-block-chain encrypts the cleartext data pointed to by
182*c9496f6bSchristosthe I<input> argument into the ciphertext pointed to by the I<output>
183*c9496f6bSchristosargument, using the key schedule provided by the I<schedule> argument,
184*c9496f6bSchristosand initialization vector provided by the I<ivec> argument.  If the
185*c9496f6bSchristosI<length> argument is not an integral multiple of eight bytes, the
186*c9496f6bSchristoslast block is copied to a temporary area and zero filled.  The output
187*c9496f6bSchristosis always an integral multiple of eight bytes.
188*c9496f6bSchristos
189*c9496f6bSchristosdes_xcbc_encrypt() is RSA's DESX mode of DES.  It uses I<inw> and
190*c9496f6bSchristosI<outw> to 'whiten' the encryption.  I<inw> and I<outw> are secret
191*c9496f6bSchristos(unlike the iv) and are as such, part of the key.  So the key is sort
192*c9496f6bSchristosof 24 bytes.  This is much better than CBC DES.
193*c9496f6bSchristos
194*c9496f6bSchristosdes_ede3_cbc_encrypt() implements outer triple CBC DES encryption with
195*c9496f6bSchristosthree keys. This means that each DES operation inside the CBC mode is
196*c9496f6bSchristosreally an C<C=E(ks3,D(ks2,E(ks1,M)))>.  This mode is used by SSL.
197*c9496f6bSchristos
198*c9496f6bSchristosThe des_ede2_cbc_encrypt() macro implements two-key Triple-DES by
199*c9496f6bSchristosreusing I<ks1> for the final encryption.  C<C=E(ks1,D(ks2,E(ks1,M)))>.
200*c9496f6bSchristosThis form of Triple-DES is used by the RSAREF library.
201*c9496f6bSchristos
202*c9496f6bSchristosdes_pcbc_encrypt() encrypt/decrypts using the propagating cipher block
203*c9496f6bSchristoschaining mode used by Kerberos v4. Its parameters are the same as
204*c9496f6bSchristosdes_ncbc_encrypt().
205*c9496f6bSchristos
206*c9496f6bSchristosdes_cfb_encrypt() encrypt/decrypts using cipher feedback mode.  This
207*c9496f6bSchristosmethod takes an array of characters as input and outputs and array of
208*c9496f6bSchristoscharacters.  It does not require any padding to 8 character groups.
209*c9496f6bSchristosNote: the I<ivec> variable is changed and the new changed value needs to
210*c9496f6bSchristosbe passed to the next call to this function.  Since this function runs
211*c9496f6bSchristosa complete DES ECB encryption per I<numbits>, this function is only
212*c9496f6bSchristossuggested for use when sending small numbers of characters.
213*c9496f6bSchristos
214*c9496f6bSchristosdes_cfb64_encrypt()
215*c9496f6bSchristosimplements CFB mode of DES with 64bit feedback.  Why is this
216*c9496f6bSchristosuseful you ask?  Because this routine will allow you to encrypt an
217*c9496f6bSchristosarbitrary number of bytes, no 8 byte padding.  Each call to this
218*c9496f6bSchristosroutine will encrypt the input bytes to output and then update ivec
219*c9496f6bSchristosand num.  num contains 'how far' we are though ivec.  If this does
220*c9496f6bSchristosnot make much sense, read more about cfb mode of DES :-).
221*c9496f6bSchristos
222*c9496f6bSchristosdes_ede3_cfb64_encrypt() and des_ede2_cfb64_encrypt() is the same as
223*c9496f6bSchristosdes_cfb64_encrypt() except that Triple-DES is used.
224*c9496f6bSchristos
225*c9496f6bSchristosdes_ofb_encrypt() encrypts using output feedback mode.  This method
226*c9496f6bSchristostakes an array of characters as input and outputs and array of
227*c9496f6bSchristoscharacters.  It does not require any padding to 8 character groups.
228*c9496f6bSchristosNote: the I<ivec> variable is changed and the new changed value needs to
229*c9496f6bSchristosbe passed to the next call to this function.  Since this function runs
230*c9496f6bSchristosa complete DES ECB encryption per numbits, this function is only
231*c9496f6bSchristossuggested for use when sending small numbers of characters.
232*c9496f6bSchristos
233*c9496f6bSchristosdes_ofb64_encrypt() is the same as des_cfb64_encrypt() using Output
234*c9496f6bSchristosFeed Back mode.
235*c9496f6bSchristos
236*c9496f6bSchristosdes_ede3_ofb64_encrypt() and des_ede2_ofb64_encrypt() is the same as
237*c9496f6bSchristosdes_ofb64_encrypt(), using Triple-DES.
238*c9496f6bSchristos
239*c9496f6bSchristosThe following functions are included in the DES library for
240*c9496f6bSchristoscompatibility with the MIT Kerberos library. des_read_pw_string()
241*c9496f6bSchristosis also available under the name EVP_read_pw_string().
242*c9496f6bSchristos
243*c9496f6bSchristosdes_read_pw_string() writes the string specified by I<prompt> to
244*c9496f6bSchristosstandard output, turns echo off and reads in input string from the
245*c9496f6bSchristosterminal.  The string is returned in I<buf>, which must have space for
246*c9496f6bSchristosat least I<length> bytes.  If I<verify> is set, the user is asked for
247*c9496f6bSchristosthe password twice and unless the two copies match, an error is
248*c9496f6bSchristosreturned.  A return code of -1 indicates a system error, 1 failure due
249*c9496f6bSchristosto use interaction, and 0 is success.
250*c9496f6bSchristos
251*c9496f6bSchristosdes_read_password() does the same and converts the password to a DES
252*c9496f6bSchristoskey by calling des_string_to_key(); des_read_2password() operates in
253*c9496f6bSchristosthe same way as des_read_password() except that it generates two keys
254*c9496f6bSchristosby using the des_string_to_2key() function.  des_string_to_key() is
255*c9496f6bSchristosavailable for backward compatibility with the MIT library.  New
256*c9496f6bSchristosapplications should use a cryptographic hash function.  The same
257*c9496f6bSchristosapplies for des_string_to_2key().
258*c9496f6bSchristos
259*c9496f6bSchristosdes_cbc_cksum() produces an 8 byte checksum based on the input stream
260*c9496f6bSchristos(via CBC encryption).  The last 4 bytes of the checksum are returned
261*c9496f6bSchristosand the complete 8 bytes are placed in I<output>. This function is
262*c9496f6bSchristosused by Kerberos v4.  Other applications should use
263*c9496f6bSchristosL<EVP_DigestInit(3)|EVP_DigestInit(3)> etc. instead.
264*c9496f6bSchristos
265*c9496f6bSchristosdes_quad_cksum() is a Kerberos v4 function.  It returns a 4 byte
266*c9496f6bSchristoschecksum from the input bytes.  The algorithm can be iterated over the
267*c9496f6bSchristosinput, depending on I<out_count>, 1, 2, 3 or 4 times.  If I<output> is
268*c9496f6bSchristosnon-NULL, the 8 bytes generated by each pass are written into
269*c9496f6bSchristosI<output>.
270*c9496f6bSchristos
271*c9496f6bSchristosThe following are DES-based transformations:
272*c9496f6bSchristos
273*c9496f6bSchristosdes_fcrypt() is a fast version of the Unix crypt(3) function.  This
274*c9496f6bSchristosversion takes only a small amount of space relative to other fast
275*c9496f6bSchristoscrypt() implementations.  This is different to the normal crypt in
276*c9496f6bSchristosthat the third parameter is the buffer that the return value is
277*c9496f6bSchristoswritten into.  It needs to be at least 14 bytes long.  This function
278*c9496f6bSchristosis thread safe, unlike the normal crypt.
279*c9496f6bSchristos
280*c9496f6bSchristosdes_crypt() is a faster replacement for the normal system crypt().
281*c9496f6bSchristosThis function calls des_fcrypt() with a static array passed as the
282*c9496f6bSchristosthird parameter.  This emulates the normal non-thread safe semantics
283*c9496f6bSchristosof crypt(3).
284*c9496f6bSchristos
285*c9496f6bSchristosdes_enc_write() writes I<len> bytes to file descriptor I<fd> from
286*c9496f6bSchristosbuffer I<buf>. The data is encrypted via I<pcbc_encrypt> (default)
287*c9496f6bSchristosusing I<sched> for the key and I<iv> as a starting vector.  The actual
288*c9496f6bSchristosdata send down I<fd> consists of 4 bytes (in network byte order)
289*c9496f6bSchristoscontaining the length of the following encrypted data.  The encrypted
290*c9496f6bSchristosdata then follows, padded with random data out to a multiple of 8
291*c9496f6bSchristosbytes.
292*c9496f6bSchristos
293*c9496f6bSchristosdes_enc_read() is used to read I<len> bytes from file descriptor
294*c9496f6bSchristosI<fd> into buffer I<buf>. The data being read from I<fd> is assumed to
295*c9496f6bSchristoshave come from des_enc_write() and is decrypted using I<sched> for
296*c9496f6bSchristosthe key schedule and I<iv> for the initial vector.
297*c9496f6bSchristos
298*c9496f6bSchristosB<Warning:> The data format used by des_enc_write() and des_enc_read()
299*c9496f6bSchristoshas a cryptographic weakness: When asked to write more than MAXWRITE
300*c9496f6bSchristosbytes, des_enc_write() will split the data into several chunks that
301*c9496f6bSchristosare all encrypted using the same IV.  So don't use these functions
302*c9496f6bSchristosunless you are sure you know what you do (in which case you might not
303*c9496f6bSchristoswant to use them anyway).  They cannot handle non-blocking sockets.
304*c9496f6bSchristosdes_enc_read() uses an internal state and thus cannot be used on
305*c9496f6bSchristosmultiple files.
306*c9496f6bSchristos
307*c9496f6bSchristosI<des_rw_mode> is used to specify the encryption mode to use with
308*c9496f6bSchristosdes_enc_read() and des_end_write().  If set to I<DES_PCBC_MODE> (the
309*c9496f6bSchristosdefault), des_pcbc_encrypt is used.  If set to I<DES_CBC_MODE>
310*c9496f6bSchristosdes_cbc_encrypt is used.
311*c9496f6bSchristos
312*c9496f6bSchristos=head1 NOTES
313*c9496f6bSchristos
314*c9496f6bSchristosSingle-key DES is insecure due to its short key size.  ECB mode is
315*c9496f6bSchristosnot suitable for most applications; see L<des_modes(7)|des_modes(7)>.
316*c9496f6bSchristos
317*c9496f6bSchristosThe L<evp(3)|evp(3)> library provides higher-level encryption functions.
318*c9496f6bSchristos
319*c9496f6bSchristos=head1 BUGS
320*c9496f6bSchristos
321*c9496f6bSchristosdes_3cbc_encrypt() is flawed and must not be used in applications.
322*c9496f6bSchristos
323*c9496f6bSchristosdes_cbc_encrypt() does not modify B<ivec>; use des_ncbc_encrypt()
324*c9496f6bSchristosinstead.
325*c9496f6bSchristos
326*c9496f6bSchristosdes_cfb_encrypt() and des_ofb_encrypt() operates on input of 8 bits.
327*c9496f6bSchristosWhat this means is that if you set numbits to 12, and length to 2, the
328*c9496f6bSchristosfirst 12 bits will come from the 1st input byte and the low half of
329*c9496f6bSchristosthe second input byte.  The second 12 bits will have the low 8 bits
330*c9496f6bSchristostaken from the 3rd input byte and the top 4 bits taken from the 4th
331*c9496f6bSchristosinput byte.  The same holds for output.  This function has been
332*c9496f6bSchristosimplemented this way because most people will be using a multiple of 8
333*c9496f6bSchristosand because once you get into pulling bytes input bytes apart things
334*c9496f6bSchristosget ugly!
335*c9496f6bSchristos
336*c9496f6bSchristosdes_read_pw_string() is the most machine/OS dependent function and
337*c9496f6bSchristosnormally generates the most problems when porting this code.
338*c9496f6bSchristos
339*c9496f6bSchristos=head1 CONFORMING TO
340*c9496f6bSchristos
341*c9496f6bSchristosANSI X3.106
342*c9496f6bSchristos
343*c9496f6bSchristosThe B<des> library was written to be source code compatible with
344*c9496f6bSchristosthe MIT Kerberos library.
345*c9496f6bSchristos
346*c9496f6bSchristos=head1 SEE ALSO
347*c9496f6bSchristos
348*c9496f6bSchristoscrypt(3), L<des_modes(7)|des_modes(7)>, L<evp(3)|evp(3)>, L<rand(3)|rand(3)>
349*c9496f6bSchristos
350*c9496f6bSchristos=head1 HISTORY
351*c9496f6bSchristos
352*c9496f6bSchristosdes_cbc_cksum(), des_cbc_encrypt(), des_ecb_encrypt(),
353*c9496f6bSchristosdes_is_weak_key(), des_key_sched(), des_pcbc_encrypt(),
354*c9496f6bSchristosdes_quad_cksum(), des_random_key(), des_read_password() and
355*c9496f6bSchristosdes_string_to_key() are available in the MIT Kerberos library;
356*c9496f6bSchristosdes_check_key_parity(), des_fixup_key_parity() and des_is_weak_key()
357*c9496f6bSchristosare available in newer versions of that library.
358*c9496f6bSchristos
359*c9496f6bSchristosdes_set_key_checked() and des_set_key_unchecked() were added in
360*c9496f6bSchristosOpenSSL 0.9.5.
361*c9496f6bSchristos
362*c9496f6bSchristosdes_generate_random_block(), des_init_random_number_generator(),
363*c9496f6bSchristosdes_new_random_key(), des_set_random_generator_seed() and
364*c9496f6bSchristosdes_set_sequence_number() and des_rand_data() are used in newer
365*c9496f6bSchristosversions of Kerberos but are not implemented here.
366*c9496f6bSchristos
367*c9496f6bSchristosdes_random_key() generated cryptographically weak random data in
368*c9496f6bSchristosSSLeay and in OpenSSL prior version 0.9.5, as well as in the original
369*c9496f6bSchristosMIT library.
370*c9496f6bSchristos
371*c9496f6bSchristos=head1 AUTHOR
372*c9496f6bSchristos
373*c9496f6bSchristosEric Young (eay@cryptsoft.com). Modified for the OpenSSL project
374*c9496f6bSchristos(http://www.openssl.org).
375*c9496f6bSchristos
376*c9496f6bSchristos=cut
377