openssl: Adjust manual pages for 1.0.1l.
[dragonfly.git] / secure / lib / libcrypto / man / des.3
1 .\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.20)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 'br\}
42 .\"
43 .\" Escape single quotes in literal strings from groff's Unicode transform.
44 .ie \n(.g .ds Aq \(aq
45 .el       .ds Aq '
46 .\"
47 .\" If the F register is turned on, we'll generate index entries on stderr for
48 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
49 .\" entries marked with X<> in POD.  Of course, you'll have to process the
50 .\" output yourself in some meaningful fashion.
51 .ie \nF \{\
52 .    de IX
53 .    tm Index:\\$1\t\\n%\t"\\$2"
54 ..
55 .    nr % 0
56 .    rr F
57 .\}
58 .el \{\
59 .    de IX
60 ..
61 .\}
62 .\"
63 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
65 .    \" fudge factors for nroff and troff
66 .if n \{\
67 .    ds #H 0
68 .    ds #V .8m
69 .    ds #F .3m
70 .    ds #[ \f1
71 .    ds #] \fP
72 .\}
73 .if t \{\
74 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75 .    ds #V .6m
76 .    ds #F 0
77 .    ds #[ \&
78 .    ds #] \&
79 .\}
80 .    \" simple accents for nroff and troff
81 .if n \{\
82 .    ds ' \&
83 .    ds ` \&
84 .    ds ^ \&
85 .    ds , \&
86 .    ds ~ ~
87 .    ds /
88 .\}
89 .if t \{\
90 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96 .\}
97 .    \" troff and (daisy-wheel) nroff accents
98 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105 .ds ae a\h'-(\w'a'u*4/10)'e
106 .ds Ae A\h'-(\w'A'u*4/10)'E
107 .    \" corrections for vroff
108 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110 .    \" for low resolution devices (crt and lpr)
111 .if \n(.H>23 .if \n(.V>19 \
112 \{\
113 .    ds : e
114 .    ds 8 ss
115 .    ds o a
116 .    ds d- d\h'-1'\(ga
117 .    ds D- D\h'-1'\(hy
118 .    ds th \o'bp'
119 .    ds Th \o'LP'
120 .    ds ae ae
121 .    ds Ae AE
122 .\}
123 .rm #[ #] #H #V #F C
124 .\" ========================================================================
125 .\"
126 .IX Title "des 3"
127 .TH des 3 "2015-01-15" "1.0.1l" "OpenSSL"
128 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
129 .\" way too many mistakes in technical documents.
130 .if n .ad l
131 .nh
132 .SH "NAME"
133 DES_random_key, DES_set_key, DES_key_sched, DES_set_key_checked,
134 DES_set_key_unchecked, DES_set_odd_parity, DES_is_weak_key,
135 DES_ecb_encrypt, DES_ecb2_encrypt, DES_ecb3_encrypt, DES_ncbc_encrypt,
136 DES_cfb_encrypt, DES_ofb_encrypt, DES_pcbc_encrypt, DES_cfb64_encrypt,
137 DES_ofb64_encrypt, DES_xcbc_encrypt, DES_ede2_cbc_encrypt,
138 DES_ede2_cfb64_encrypt, DES_ede2_ofb64_encrypt, DES_ede3_cbc_encrypt,
139 DES_ede3_cbcm_encrypt, DES_ede3_cfb64_encrypt, DES_ede3_ofb64_encrypt,
140 DES_cbc_cksum, DES_quad_cksum, DES_string_to_key, DES_string_to_2keys,
141 DES_fcrypt, DES_crypt, DES_enc_read, DES_enc_write \- DES encryption
142 .SH "SYNOPSIS"
143 .IX Header "SYNOPSIS"
144 .Vb 1
145 \& #include <openssl/des.h>
146 \&
147 \& void DES_random_key(DES_cblock *ret);
148 \&
149 \& int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);
150 \& int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);
151 \& int DES_set_key_checked(const_DES_cblock *key,
152 \&        DES_key_schedule *schedule);
153 \& void DES_set_key_unchecked(const_DES_cblock *key,
154 \&        DES_key_schedule *schedule);
155 \&
156 \& void DES_set_odd_parity(DES_cblock *key);
157 \& int DES_is_weak_key(const_DES_cblock *key);
158 \&
159 \& void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, 
160 \&        DES_key_schedule *ks, int enc);
161 \& void DES_ecb2_encrypt(const_DES_cblock *input, DES_cblock *output, 
162 \&        DES_key_schedule *ks1, DES_key_schedule *ks2, int enc);
163 \& void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, 
164 \&        DES_key_schedule *ks1, DES_key_schedule *ks2, 
165 \&        DES_key_schedule *ks3, int enc);
166 \&
167 \& void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, 
168 \&        long length, DES_key_schedule *schedule, DES_cblock *ivec, 
169 \&        int enc);
170 \& void DES_cfb_encrypt(const unsigned char *in, unsigned char *out,
171 \&        int numbits, long length, DES_key_schedule *schedule,
172 \&        DES_cblock *ivec, int enc);
173 \& void DES_ofb_encrypt(const unsigned char *in, unsigned char *out,
174 \&        int numbits, long length, DES_key_schedule *schedule,
175 \&        DES_cblock *ivec);
176 \& void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, 
177 \&        long length, DES_key_schedule *schedule, DES_cblock *ivec, 
178 \&        int enc);
179 \& void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out,
180 \&        long length, DES_key_schedule *schedule, DES_cblock *ivec,
181 \&        int *num, int enc);
182 \& void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out,
183 \&        long length, DES_key_schedule *schedule, DES_cblock *ivec,
184 \&        int *num);
185 \&
186 \& void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, 
187 \&        long length, DES_key_schedule *schedule, DES_cblock *ivec, 
188 \&        const_DES_cblock *inw, const_DES_cblock *outw, int enc);
189 \&
190 \& void DES_ede2_cbc_encrypt(const unsigned char *input,
191 \&        unsigned char *output, long length, DES_key_schedule *ks1,
192 \&        DES_key_schedule *ks2, DES_cblock *ivec, int enc);
193 \& void DES_ede2_cfb64_encrypt(const unsigned char *in,
194 \&        unsigned char *out, long length, DES_key_schedule *ks1,
195 \&        DES_key_schedule *ks2, DES_cblock *ivec, int *num, int enc);
196 \& void DES_ede2_ofb64_encrypt(const unsigned char *in,
197 \&        unsigned char *out, long length, DES_key_schedule *ks1,
198 \&        DES_key_schedule *ks2, DES_cblock *ivec, int *num);
199 \&
200 \& void DES_ede3_cbc_encrypt(const unsigned char *input,
201 \&        unsigned char *output, long length, DES_key_schedule *ks1,
202 \&        DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec,
203 \&        int enc);
204 \& void DES_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, 
205 \&        long length, DES_key_schedule *ks1, DES_key_schedule *ks2, 
206 \&        DES_key_schedule *ks3, DES_cblock *ivec1, DES_cblock *ivec2, 
207 \&        int enc);
208 \& void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, 
209 \&        long length, DES_key_schedule *ks1, DES_key_schedule *ks2,
210 \&        DES_key_schedule *ks3, DES_cblock *ivec, int *num, int enc);
211 \& void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, 
212 \&        long length, DES_key_schedule *ks1, 
213 \&        DES_key_schedule *ks2, DES_key_schedule *ks3, 
214 \&        DES_cblock *ivec, int *num);
215 \&
216 \& DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, 
217 \&        long length, DES_key_schedule *schedule, 
218 \&        const_DES_cblock *ivec);
219 \& DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], 
220 \&        long length, int out_count, DES_cblock *seed);
221 \& void DES_string_to_key(const char *str, DES_cblock *key);
222 \& void DES_string_to_2keys(const char *str, DES_cblock *key1,
223 \&        DES_cblock *key2);
224 \&
225 \& char *DES_fcrypt(const char *buf, const char *salt, char *ret);
226 \& char *DES_crypt(const char *buf, const char *salt);
227 \&
228 \& int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched,
229 \&        DES_cblock *iv);
230 \& int DES_enc_write(int fd, const void *buf, int len,
231 \&        DES_key_schedule *sched, DES_cblock *iv);
232 .Ve
233 .SH "DESCRIPTION"
234 .IX Header "DESCRIPTION"
235 This library contains a fast implementation of the \s-1DES\s0 encryption
236 algorithm.
237 .PP
238 There are two phases to the use of \s-1DES\s0 encryption.  The first is the
239 generation of a \fIDES_key_schedule\fR from a key, the second is the
240 actual encryption.  A \s-1DES\s0 key is of type \fIDES_cblock\fR. This type is
241 consists of 8 bytes with odd parity.  The least significant bit in
242 each byte is the parity bit.  The key schedule is an expanded form of
243 the key; it is used to speed the encryption process.
244 .PP
245 \&\fIDES_random_key()\fR generates a random key.  The \s-1PRNG\s0 must be seeded
246 prior to using this function (see \fIrand\fR\|(3)).  If the \s-1PRNG\s0
247 could not generate a secure key, 0 is returned.
248 .PP
249 Before a \s-1DES\s0 key can be used, it must be converted into the
250 architecture dependent \fIDES_key_schedule\fR via the
251 \&\fIDES_set_key_checked()\fR or \fIDES_set_key_unchecked()\fR function.
252 .PP
253 \&\fIDES_set_key_checked()\fR will check that the key passed is of odd parity
254 and is not a week or semi-weak key.  If the parity is wrong, then \-1
255 is returned.  If the key is a weak key, then \-2 is returned.  If an
256 error is returned, the key schedule is not generated.
257 .PP
258 \&\fIDES_set_key()\fR works like
259 \&\fIDES_set_key_checked()\fR if the \fIDES_check_key\fR flag is non-zero,
260 otherwise like \fIDES_set_key_unchecked()\fR.  These functions are available
261 for compatibility; it is recommended to use a function that does not
262 depend on a global variable.
263 .PP
264 \&\fIDES_set_odd_parity()\fR sets the parity of the passed \fIkey\fR to odd.
265 .PP
266 \&\fIDES_is_weak_key()\fR returns 1 if the passed key is a weak key, 0 if it
267 is ok.
268 .PP
269 The following routines mostly operate on an input and output stream of
270 \&\fIDES_cblock\fRs.
271 .PP
272 \&\fIDES_ecb_encrypt()\fR is the basic \s-1DES\s0 encryption routine that encrypts or
273 decrypts a single 8\-byte \fIDES_cblock\fR in \fIelectronic code book\fR
274 (\s-1ECB\s0) mode.  It always transforms the input data, pointed to by
275 \&\fIinput\fR, into the output data, pointed to by the \fIoutput\fR argument.
276 If the \fIencrypt\fR argument is non-zero (\s-1DES_ENCRYPT\s0), the \fIinput\fR
277 (cleartext) is encrypted in to the \fIoutput\fR (ciphertext) using the
278 key_schedule specified by the \fIschedule\fR argument, previously set via
279 \&\fIDES_set_key\fR. If \fIencrypt\fR is zero (\s-1DES_DECRYPT\s0), the \fIinput\fR (now
280 ciphertext) is decrypted into the \fIoutput\fR (now cleartext).  Input
281 and output may overlap.  \fIDES_ecb_encrypt()\fR does not return a value.
282 .PP
283 \&\fIDES_ecb3_encrypt()\fR encrypts/decrypts the \fIinput\fR block by using
284 three-key Triple-DES encryption in \s-1ECB\s0 mode.  This involves encrypting
285 the input with \fIks1\fR, decrypting with the key schedule \fIks2\fR, and
286 then encrypting with \fIks3\fR.  This routine greatly reduces the chances
287 of brute force breaking of \s-1DES\s0 and has the advantage of if \fIks1\fR,
288 \&\fIks2\fR and \fIks3\fR are the same, it is equivalent to just encryption
289 using \s-1ECB\s0 mode and \fIks1\fR as the key.
290 .PP
291 The macro \fIDES_ecb2_encrypt()\fR is provided to perform two-key Triple-DES
292 encryption by using \fIks1\fR for the final encryption.
293 .PP
294 \&\fIDES_ncbc_encrypt()\fR encrypts/decrypts using the \fIcipher-block-chaining\fR
295 (\s-1CBC\s0) mode of \s-1DES\s0.  If the \fIencrypt\fR argument is non-zero, the
296 routine cipher-block-chain encrypts the cleartext data pointed to by
297 the \fIinput\fR argument into the ciphertext pointed to by the \fIoutput\fR
298 argument, using the key schedule provided by the \fIschedule\fR argument,
299 and initialization vector provided by the \fIivec\fR argument.  If the
300 \&\fIlength\fR argument is not an integral multiple of eight bytes, the
301 last block is copied to a temporary area and zero filled.  The output
302 is always an integral multiple of eight bytes.
303 .PP
304 \&\fIDES_xcbc_encrypt()\fR is \s-1RSA\s0's \s-1DESX\s0 mode of \s-1DES\s0.  It uses \fIinw\fR and
305 \&\fIoutw\fR to 'whiten' the encryption.  \fIinw\fR and \fIoutw\fR are secret
306 (unlike the iv) and are as such, part of the key.  So the key is sort
307 of 24 bytes.  This is much better than \s-1CBC\s0 \s-1DES\s0.
308 .PP
309 \&\fIDES_ede3_cbc_encrypt()\fR implements outer triple \s-1CBC\s0 \s-1DES\s0 encryption with
310 three keys. This means that each \s-1DES\s0 operation inside the \s-1CBC\s0 mode is
311 an \f(CW\*(C`C=E(ks3,D(ks2,E(ks1,M)))\*(C'\fR.  This mode is used by \s-1SSL\s0.
312 .PP
313 The \fIDES_ede2_cbc_encrypt()\fR macro implements two-key Triple-DES by
314 reusing \fIks1\fR for the final encryption.  \f(CW\*(C`C=E(ks1,D(ks2,E(ks1,M)))\*(C'\fR.
315 This form of Triple-DES is used by the \s-1RSAREF\s0 library.
316 .PP
317 \&\fIDES_pcbc_encrypt()\fR encrypt/decrypts using the propagating cipher block
318 chaining mode used by Kerberos v4. Its parameters are the same as
319 \&\fIDES_ncbc_encrypt()\fR.
320 .PP
321 \&\fIDES_cfb_encrypt()\fR encrypt/decrypts using cipher feedback mode.  This
322 method takes an array of characters as input and outputs and array of
323 characters.  It does not require any padding to 8 character groups.
324 Note: the \fIivec\fR variable is changed and the new changed value needs to
325 be passed to the next call to this function.  Since this function runs
326 a complete \s-1DES\s0 \s-1ECB\s0 encryption per \fInumbits\fR, this function is only
327 suggested for use when sending small numbers of characters.
328 .PP
329 \&\fIDES_cfb64_encrypt()\fR
330 implements \s-1CFB\s0 mode of \s-1DES\s0 with 64bit feedback.  Why is this
331 useful you ask?  Because this routine will allow you to encrypt an
332 arbitrary number of bytes, no 8 byte padding.  Each call to this
333 routine will encrypt the input bytes to output and then update ivec
334 and num.  num contains 'how far' we are though ivec.  If this does
335 not make much sense, read more about cfb mode of \s-1DES\s0 :\-).
336 .PP
337 \&\fIDES_ede3_cfb64_encrypt()\fR and \fIDES_ede2_cfb64_encrypt()\fR is the same as
338 \&\fIDES_cfb64_encrypt()\fR except that Triple-DES is used.
339 .PP
340 \&\fIDES_ofb_encrypt()\fR encrypts using output feedback mode.  This method
341 takes an array of characters as input and outputs and array of
342 characters.  It does not require any padding to 8 character groups.
343 Note: the \fIivec\fR variable is changed and the new changed value needs to
344 be passed to the next call to this function.  Since this function runs
345 a complete \s-1DES\s0 \s-1ECB\s0 encryption per numbits, this function is only
346 suggested for use when sending small numbers of characters.
347 .PP
348 \&\fIDES_ofb64_encrypt()\fR is the same as \fIDES_cfb64_encrypt()\fR using Output
349 Feed Back mode.
350 .PP
351 \&\fIDES_ede3_ofb64_encrypt()\fR and \fIDES_ede2_ofb64_encrypt()\fR is the same as
352 \&\fIDES_ofb64_encrypt()\fR, using Triple-DES.
353 .PP
354 The following functions are included in the \s-1DES\s0 library for
355 compatibility with the \s-1MIT\s0 Kerberos library.
356 .PP
357 \&\fIDES_cbc_cksum()\fR produces an 8 byte checksum based on the input stream
358 (via \s-1CBC\s0 encryption).  The last 4 bytes of the checksum are returned
359 and the complete 8 bytes are placed in \fIoutput\fR. This function is
360 used by Kerberos v4.  Other applications should use
361 \&\fIEVP_DigestInit\fR\|(3) etc. instead.
362 .PP
363 \&\fIDES_quad_cksum()\fR is a Kerberos v4 function.  It returns a 4 byte
364 checksum from the input bytes.  The algorithm can be iterated over the
365 input, depending on \fIout_count\fR, 1, 2, 3 or 4 times.  If \fIoutput\fR is
366 non-NULL, the 8 bytes generated by each pass are written into
367 \&\fIoutput\fR.
368 .PP
369 The following are DES-based transformations:
370 .PP
371 \&\fIDES_fcrypt()\fR is a fast version of the Unix \fIcrypt\fR\|(3) function.  This
372 version takes only a small amount of space relative to other fast
373 \&\fIcrypt()\fR implementations.  This is different to the normal crypt in
374 that the third parameter is the buffer that the return value is
375 written into.  It needs to be at least 14 bytes long.  This function
376 is thread safe, unlike the normal crypt.
377 .PP
378 \&\fIDES_crypt()\fR is a faster replacement for the normal system \fIcrypt()\fR.
379 This function calls \fIDES_fcrypt()\fR with a static array passed as the
380 third parameter.  This emulates the normal non-thread safe semantics
381 of \fIcrypt\fR\|(3).
382 .PP
383 \&\fIDES_enc_write()\fR writes \fIlen\fR bytes to file descriptor \fIfd\fR from
384 buffer \fIbuf\fR. The data is encrypted via \fIpcbc_encrypt\fR (default)
385 using \fIsched\fR for the key and \fIiv\fR as a starting vector.  The actual
386 data send down \fIfd\fR consists of 4 bytes (in network byte order)
387 containing the length of the following encrypted data.  The encrypted
388 data then follows, padded with random data out to a multiple of 8
389 bytes.
390 .PP
391 \&\fIDES_enc_read()\fR is used to read \fIlen\fR bytes from file descriptor
392 \&\fIfd\fR into buffer \fIbuf\fR. The data being read from \fIfd\fR is assumed to
393 have come from \fIDES_enc_write()\fR and is decrypted using \fIsched\fR for
394 the key schedule and \fIiv\fR for the initial vector.
395 .PP
396 \&\fBWarning:\fR The data format used by \fIDES_enc_write()\fR and \fIDES_enc_read()\fR
397 has a cryptographic weakness: When asked to write more than \s-1MAXWRITE\s0
398 bytes, \fIDES_enc_write()\fR will split the data into several chunks that
399 are all encrypted using the same \s-1IV\s0.  So don't use these functions
400 unless you are sure you know what you do (in which case you might not
401 want to use them anyway).  They cannot handle non-blocking sockets.
402 \&\fIDES_enc_read()\fR uses an internal state and thus cannot be used on
403 multiple files.
404 .PP
405 \&\fIDES_rw_mode\fR is used to specify the encryption mode to use with
406 \&\fIDES_enc_read()\fR and \fIDES_end_write()\fR.  If set to \fI\s-1DES_PCBC_MODE\s0\fR (the
407 default), DES_pcbc_encrypt is used.  If set to \fI\s-1DES_CBC_MODE\s0\fR
408 DES_cbc_encrypt is used.
409 .SH "NOTES"
410 .IX Header "NOTES"
411 Single-key \s-1DES\s0 is insecure due to its short key size.  \s-1ECB\s0 mode is
412 not suitable for most applications; see \fIdes_modes\fR\|(7).
413 .PP
414 The \fIevp\fR\|(3) library provides higher-level encryption functions.
415 .SH "BUGS"
416 .IX Header "BUGS"
417 \&\fIDES_3cbc_encrypt()\fR is flawed and must not be used in applications.
418 .PP
419 \&\fIDES_cbc_encrypt()\fR does not modify \fBivec\fR; use \fIDES_ncbc_encrypt()\fR
420 instead.
421 .PP
422 \&\fIDES_cfb_encrypt()\fR and \fIDES_ofb_encrypt()\fR operates on input of 8 bits.
423 What this means is that if you set numbits to 12, and length to 2, the
424 first 12 bits will come from the 1st input byte and the low half of
425 the second input byte.  The second 12 bits will have the low 8 bits
426 taken from the 3rd input byte and the top 4 bits taken from the 4th
427 input byte.  The same holds for output.  This function has been
428 implemented this way because most people will be using a multiple of 8
429 and because once you get into pulling bytes input bytes apart things
430 get ugly!
431 .PP
432 \&\fIDES_string_to_key()\fR is available for backward compatibility with the
433 \&\s-1MIT\s0 library.  New applications should use a cryptographic hash function.
434 The same applies for \fIDES_string_to_2key()\fR.
435 .SH "CONFORMING TO"
436 .IX Header "CONFORMING TO"
437 \&\s-1ANSI\s0 X3.106
438 .PP
439 The \fBdes\fR library was written to be source code compatible with
440 the \s-1MIT\s0 Kerberos library.
441 .SH "SEE ALSO"
442 .IX Header "SEE ALSO"
443 \&\fIcrypt\fR\|(3), \fIdes_modes\fR\|(7), \fIevp\fR\|(3), \fIrand\fR\|(3)
444 .SH "HISTORY"
445 .IX Header "HISTORY"
446 In OpenSSL 0.9.7, all des_ functions were renamed to \s-1DES_\s0 to avoid
447 clashes with older versions of libdes.  Compatibility des_ functions
448 are provided for a short while, as well as \fIcrypt()\fR.
449 Declarations for these are in <openssl/des_old.h>. There is no \s-1DES_\s0
450 variant for \fIdes_random_seed()\fR.
451 This will happen to other functions
452 as well if they are deemed redundant (\fIdes_random_seed()\fR just calls
453 \&\fIRAND_seed()\fR and is present for backward compatibility only), buggy or
454 already scheduled for removal.
455 .PP
456 \&\fIdes_cbc_cksum()\fR, \fIdes_cbc_encrypt()\fR, \fIdes_ecb_encrypt()\fR,
457 \&\fIdes_is_weak_key()\fR, \fIdes_key_sched()\fR, \fIdes_pcbc_encrypt()\fR,
458 \&\fIdes_quad_cksum()\fR, \fIdes_random_key()\fR and \fIdes_string_to_key()\fR
459 are available in the \s-1MIT\s0 Kerberos library;
460 \&\fIdes_check_key_parity()\fR, \fIdes_fixup_key_parity()\fR and \fIdes_is_weak_key()\fR
461 are available in newer versions of that library.
462 .PP
463 \&\fIdes_set_key_checked()\fR and \fIdes_set_key_unchecked()\fR were added in
464 OpenSSL 0.9.5.
465 .PP
466 \&\fIdes_generate_random_block()\fR, \fIdes_init_random_number_generator()\fR,
467 \&\fIdes_new_random_key()\fR, \fIdes_set_random_generator_seed()\fR and
468 \&\fIdes_set_sequence_number()\fR and \fIdes_rand_data()\fR are used in newer
469 versions of Kerberos but are not implemented here.
470 .PP
471 \&\fIdes_random_key()\fR generated cryptographically weak random data in
472 SSLeay and in OpenSSL prior version 0.9.5, as well as in the original
473 \&\s-1MIT\s0 library.
474 .SH "AUTHOR"
475 .IX Header "AUTHOR"
476 Eric Young (eay@cryptsoft.com). Modified for the OpenSSL project
477 (http://www.openssl.org).