]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/lib/libcrypto/man/DES_random_key.3
MFC: r344602
[FreeBSD/FreeBSD.git] / secure / lib / libcrypto / man / DES_random_key.3
1 .\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35)
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 .    ds C`
42 .    ds C'
43 'br\}
44 .\"
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
46 .ie \n(.g .ds Aq \(aq
47 .el       .ds Aq '
48 .\"
49 .\" If the F register is >0, we'll generate index entries on stderr for
50 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51 .\" entries marked with X<> in POD.  Of course, you'll have to process the
52 .\" output yourself in some meaningful fashion.
53 .\"
54 .\" Avoid warning from groff about undefined register 'F'.
55 .de IX
56 ..
57 .nr rF 0
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{\
60 .    if \nF \{\
61 .        de IX
62 .        tm Index:\\$1\t\\n%\t"\\$2"
63 ..
64 .        if !\nF==2 \{\
65 .            nr % 0
66 .            nr F 2
67 .        \}
68 .    \}
69 .\}
70 .rr rF
71 .\"
72 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
73 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
74 .    \" fudge factors for nroff and troff
75 .if n \{\
76 .    ds #H 0
77 .    ds #V .8m
78 .    ds #F .3m
79 .    ds #[ \f1
80 .    ds #] \fP
81 .\}
82 .if t \{\
83 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
84 .    ds #V .6m
85 .    ds #F 0
86 .    ds #[ \&
87 .    ds #] \&
88 .\}
89 .    \" simple accents for nroff and troff
90 .if n \{\
91 .    ds ' \&
92 .    ds ` \&
93 .    ds ^ \&
94 .    ds , \&
95 .    ds ~ ~
96 .    ds /
97 .\}
98 .if t \{\
99 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
100 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
101 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
102 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
103 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
104 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
105 .\}
106 .    \" troff and (daisy-wheel) nroff accents
107 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
108 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
109 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
110 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
111 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
112 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
113 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
114 .ds ae a\h'-(\w'a'u*4/10)'e
115 .ds Ae A\h'-(\w'A'u*4/10)'E
116 .    \" corrections for vroff
117 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
118 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
119 .    \" for low resolution devices (crt and lpr)
120 .if \n(.H>23 .if \n(.V>19 \
121 \{\
122 .    ds : e
123 .    ds 8 ss
124 .    ds o a
125 .    ds d- d\h'-1'\(ga
126 .    ds D- D\h'-1'\(hy
127 .    ds th \o'bp'
128 .    ds Th \o'LP'
129 .    ds ae ae
130 .    ds Ae AE
131 .\}
132 .rm #[ #] #H #V #F C
133 .\" ========================================================================
134 .\"
135 .IX Title "DES_RANDOM_KEY 3"
136 .TH DES_RANDOM_KEY 3 "2019-02-26" "1.1.1b" "OpenSSL"
137 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
138 .\" way too many mistakes in technical documents.
139 .if n .ad l
140 .nh
141 .SH "NAME"
142 DES_random_key, DES_set_key, DES_key_sched, DES_set_key_checked, DES_set_key_unchecked, DES_set_odd_parity, DES_is_weak_key, DES_ecb_encrypt, DES_ecb2_encrypt, DES_ecb3_encrypt, DES_ncbc_encrypt, DES_cfb_encrypt, DES_ofb_encrypt, DES_pcbc_encrypt, DES_cfb64_encrypt, DES_ofb64_encrypt, DES_xcbc_encrypt, DES_ede2_cbc_encrypt, DES_ede2_cfb64_encrypt, DES_ede2_ofb64_encrypt, DES_ede3_cbc_encrypt, DES_ede3_cfb64_encrypt, DES_ede3_ofb64_encrypt, DES_cbc_cksum, DES_quad_cksum, DES_string_to_key, DES_string_to_2keys, DES_fcrypt, DES_crypt \- DES encryption
143 .SH "SYNOPSIS"
144 .IX Header "SYNOPSIS"
145 .Vb 1
146 \& #include <openssl/des.h>
147 \&
148 \& void DES_random_key(DES_cblock *ret);
149 \&
150 \& int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);
151 \& int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);
152 \& int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule);
153 \& void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule);
154 \&
155 \& void DES_set_odd_parity(DES_cblock *key);
156 \& int DES_is_weak_key(const_DES_cblock *key);
157 \&
158 \& void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,
159 \&                      DES_key_schedule *ks, int enc);
160 \& void DES_ecb2_encrypt(const_DES_cblock *input, DES_cblock *output,
161 \&                       DES_key_schedule *ks1, DES_key_schedule *ks2, int enc);
162 \& void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
163 \&                       DES_key_schedule *ks1, DES_key_schedule *ks2,
164 \&                       DES_key_schedule *ks3, int enc);
165 \&
166 \& void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output,
167 \&                       long length, DES_key_schedule *schedule, DES_cblock *ivec,
168 \&                       int enc);
169 \& void DES_cfb_encrypt(const unsigned char *in, unsigned char *out,
170 \&                      int numbits, long length, DES_key_schedule *schedule,
171 \&                      DES_cblock *ivec, int enc);
172 \& void DES_ofb_encrypt(const unsigned char *in, unsigned char *out,
173 \&                      int numbits, long length, DES_key_schedule *schedule,
174 \&                      DES_cblock *ivec);
175 \& void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output,
176 \&                       long length, DES_key_schedule *schedule, DES_cblock *ivec,
177 \&                       int enc);
178 \& void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out,
179 \&                        long length, DES_key_schedule *schedule, DES_cblock *ivec,
180 \&                        int *num, int enc);
181 \& void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out,
182 \&                        long length, DES_key_schedule *schedule, DES_cblock *ivec,
183 \&                        int *num);
184 \&
185 \& void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output,
186 \&                       long length, DES_key_schedule *schedule, DES_cblock *ivec,
187 \&                       const_DES_cblock *inw, const_DES_cblock *outw, int enc);
188 \&
189 \& void DES_ede2_cbc_encrypt(const unsigned char *input, unsigned char *output,
190 \&                           long length, DES_key_schedule *ks1,
191 \&                           DES_key_schedule *ks2, DES_cblock *ivec, int enc);
192 \& void DES_ede2_cfb64_encrypt(const unsigned char *in, unsigned char *out,
193 \&                             long length, DES_key_schedule *ks1,
194 \&                             DES_key_schedule *ks2, DES_cblock *ivec,
195 \&                             int *num, int enc);
196 \& void DES_ede2_ofb64_encrypt(const unsigned char *in, unsigned char *out,
197 \&                             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, unsigned char *output,
201 \&                           long length, DES_key_schedule *ks1,
202 \&                           DES_key_schedule *ks2, DES_key_schedule *ks3,
203 \&                           DES_cblock *ivec, int enc);
204 \& void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,
205 \&                             long length, DES_key_schedule *ks1,
206 \&                             DES_key_schedule *ks2, DES_key_schedule *ks3,
207 \&                             DES_cblock *ivec, int *num, int enc);
208 \& void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out,
209 \&                             long length, DES_key_schedule *ks1,
210 \&                             DES_key_schedule *ks2, DES_key_schedule *ks3,
211 \&                             DES_cblock *ivec, int *num);
212 \&
213 \& DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output,
214 \&                        long length, DES_key_schedule *schedule,
215 \&                        const_DES_cblock *ivec);
216 \& DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[],
217 \&                         long length, int out_count, DES_cblock *seed);
218 \& void DES_string_to_key(const char *str, DES_cblock *key);
219 \& void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2);
220 \&
221 \& char *DES_fcrypt(const char *buf, const char *salt, char *ret);
222 \& char *DES_crypt(const char *buf, const char *salt);
223 .Ve
224 .SH "DESCRIPTION"
225 .IX Header "DESCRIPTION"
226 This library contains a fast implementation of the \s-1DES\s0 encryption
227 algorithm.
228 .PP
229 There are two phases to the use of \s-1DES\s0 encryption.  The first is the
230 generation of a \fIDES_key_schedule\fR from a key, the second is the
231 actual encryption.  A \s-1DES\s0 key is of type \fIDES_cblock\fR. This type
232 consists of 8 bytes with odd parity.  The least significant bit in
233 each byte is the parity bit.  The key schedule is an expanded form of
234 the key; it is used to speed the encryption process.
235 .PP
236 \&\fBDES_random_key()\fR generates a random key.  The \s-1PRNG\s0 must be seeded
237 prior to using this function (see \fBRAND_bytes\fR\|(3)).  If the \s-1PRNG\s0
238 could not generate a secure key, 0 is returned.
239 .PP
240 Before a \s-1DES\s0 key can be used, it must be converted into the
241 architecture dependent \fIDES_key_schedule\fR via the
242 \&\fBDES_set_key_checked()\fR or \fBDES_set_key_unchecked()\fR function.
243 .PP
244 \&\fBDES_set_key_checked()\fR will check that the key passed is of odd parity
245 and is not a weak or semi-weak key.  If the parity is wrong, then \-1
246 is returned.  If the key is a weak key, then \-2 is returned.  If an
247 error is returned, the key schedule is not generated.
248 .PP
249 \&\fBDES_set_key()\fR works like
250 \&\fBDES_set_key_checked()\fR if the \fIDES_check_key\fR flag is non-zero,
251 otherwise like \fBDES_set_key_unchecked()\fR.  These functions are available
252 for compatibility; it is recommended to use a function that does not
253 depend on a global variable.
254 .PP
255 \&\fBDES_set_odd_parity()\fR sets the parity of the passed \fIkey\fR to odd.
256 .PP
257 \&\fBDES_is_weak_key()\fR returns 1 if the passed key is a weak key, 0 if it
258 is ok.
259 .PP
260 The following routines mostly operate on an input and output stream of
261 \&\fIDES_cblock\fRs.
262 .PP
263 \&\fBDES_ecb_encrypt()\fR is the basic \s-1DES\s0 encryption routine that encrypts or
264 decrypts a single 8\-byte \fIDES_cblock\fR in \fIelectronic code book\fR
265 (\s-1ECB\s0) mode.  It always transforms the input data, pointed to by
266 \&\fIinput\fR, into the output data, pointed to by the \fIoutput\fR argument.
267 If the \fIencrypt\fR argument is non-zero (\s-1DES_ENCRYPT\s0), the \fIinput\fR
268 (cleartext) is encrypted in to the \fIoutput\fR (ciphertext) using the
269 key_schedule specified by the \fIschedule\fR argument, previously set via
270 \&\fIDES_set_key\fR. If \fIencrypt\fR is zero (\s-1DES_DECRYPT\s0), the \fIinput\fR (now
271 ciphertext) is decrypted into the \fIoutput\fR (now cleartext).  Input
272 and output may overlap.  \fBDES_ecb_encrypt()\fR does not return a value.
273 .PP
274 \&\fBDES_ecb3_encrypt()\fR encrypts/decrypts the \fIinput\fR block by using
275 three-key Triple-DES encryption in \s-1ECB\s0 mode.  This involves encrypting
276 the input with \fIks1\fR, decrypting with the key schedule \fIks2\fR, and
277 then encrypting with \fIks3\fR.  This routine greatly reduces the chances
278 of brute force breaking of \s-1DES\s0 and has the advantage of if \fIks1\fR,
279 \&\fIks2\fR and \fIks3\fR are the same, it is equivalent to just encryption
280 using \s-1ECB\s0 mode and \fIks1\fR as the key.
281 .PP
282 The macro \fBDES_ecb2_encrypt()\fR is provided to perform two-key Triple-DES
283 encryption by using \fIks1\fR for the final encryption.
284 .PP
285 \&\fBDES_ncbc_encrypt()\fR encrypts/decrypts using the \fIcipher-block-chaining\fR
286 (\s-1CBC\s0) mode of \s-1DES.\s0  If the \fIencrypt\fR argument is non-zero, the
287 routine cipher-block-chain encrypts the cleartext data pointed to by
288 the \fIinput\fR argument into the ciphertext pointed to by the \fIoutput\fR
289 argument, using the key schedule provided by the \fIschedule\fR argument,
290 and initialization vector provided by the \fIivec\fR argument.  If the
291 \&\fIlength\fR argument is not an integral multiple of eight bytes, the
292 last block is copied to a temporary area and zero filled.  The output
293 is always an integral multiple of eight bytes.
294 .PP
295 \&\fBDES_xcbc_encrypt()\fR is \s-1RSA\s0's \s-1DESX\s0 mode of \s-1DES.\s0  It uses \fIinw\fR and
296 \&\fIoutw\fR to 'whiten' the encryption.  \fIinw\fR and \fIoutw\fR are secret
297 (unlike the iv) and are as such, part of the key.  So the key is sort
298 of 24 bytes.  This is much better than \s-1CBC DES.\s0
299 .PP
300 \&\fBDES_ede3_cbc_encrypt()\fR implements outer triple \s-1CBC DES\s0 encryption with
301 three keys. This means that each \s-1DES\s0 operation inside the \s-1CBC\s0 mode is
302 \&\f(CW\*(C`C=E(ks3,D(ks2,E(ks1,M)))\*(C'\fR.  This mode is used by \s-1SSL.\s0
303 .PP
304 The \fBDES_ede2_cbc_encrypt()\fR macro implements two-key Triple-DES by
305 reusing \fIks1\fR for the final encryption.  \f(CW\*(C`C=E(ks1,D(ks2,E(ks1,M)))\*(C'\fR.
306 This form of Triple-DES is used by the \s-1RSAREF\s0 library.
307 .PP
308 \&\fBDES_pcbc_encrypt()\fR encrypts/decrypts using the propagating cipher block
309 chaining mode used by Kerberos v4. Its parameters are the same as
310 \&\fBDES_ncbc_encrypt()\fR.
311 .PP
312 \&\fBDES_cfb_encrypt()\fR encrypts/decrypts using cipher feedback mode.  This
313 method takes an array of characters as input and outputs an array of
314 characters.  It does not require any padding to 8 character groups.
315 Note: the \fIivec\fR variable is changed and the new changed value needs to
316 be passed to the next call to this function.  Since this function runs
317 a complete \s-1DES ECB\s0 encryption per \fInumbits\fR, this function is only
318 suggested for use when sending a small number of characters.
319 .PP
320 \&\fBDES_cfb64_encrypt()\fR
321 implements \s-1CFB\s0 mode of \s-1DES\s0 with 64\-bit feedback.  Why is this
322 useful you ask?  Because this routine will allow you to encrypt an
323 arbitrary number of bytes, without 8 byte padding.  Each call to this
324 routine will encrypt the input bytes to output and then update ivec
325 and num.  num contains 'how far' we are though ivec.  If this does
326 not make much sense, read more about \s-1CFB\s0 mode of \s-1DES.\s0
327 .PP
328 \&\fBDES_ede3_cfb64_encrypt()\fR and \fBDES_ede2_cfb64_encrypt()\fR is the same as
329 \&\fBDES_cfb64_encrypt()\fR except that Triple-DES is used.
330 .PP
331 \&\fBDES_ofb_encrypt()\fR encrypts using output feedback mode.  This method
332 takes an array of characters as input and outputs an array of
333 characters.  It does not require any padding to 8 character groups.
334 Note: the \fIivec\fR variable is changed and the new changed value needs to
335 be passed to the next call to this function.  Since this function runs
336 a complete \s-1DES ECB\s0 encryption per \fInumbits\fR, this function is only
337 suggested for use when sending a small number of characters.
338 .PP
339 \&\fBDES_ofb64_encrypt()\fR is the same as \fBDES_cfb64_encrypt()\fR using Output
340 Feed Back mode.
341 .PP
342 \&\fBDES_ede3_ofb64_encrypt()\fR and \fBDES_ede2_ofb64_encrypt()\fR is the same as
343 \&\fBDES_ofb64_encrypt()\fR, using Triple-DES.
344 .PP
345 The following functions are included in the \s-1DES\s0 library for
346 compatibility with the \s-1MIT\s0 Kerberos library.
347 .PP
348 \&\fBDES_cbc_cksum()\fR produces an 8 byte checksum based on the input stream
349 (via \s-1CBC\s0 encryption).  The last 4 bytes of the checksum are returned
350 and the complete 8 bytes are placed in \fIoutput\fR. This function is
351 used by Kerberos v4.  Other applications should use
352 \&\fBEVP_DigestInit\fR\|(3) etc. instead.
353 .PP
354 \&\fBDES_quad_cksum()\fR is a Kerberos v4 function.  It returns a 4 byte
355 checksum from the input bytes.  The algorithm can be iterated over the
356 input, depending on \fIout_count\fR, 1, 2, 3 or 4 times.  If \fIoutput\fR is
357 non-NULL, the 8 bytes generated by each pass are written into
358 \&\fIoutput\fR.
359 .PP
360 The following are DES-based transformations:
361 .PP
362 \&\fBDES_fcrypt()\fR is a fast version of the Unix \fBcrypt\fR\|(3) function.  This
363 version takes only a small amount of space relative to other fast
364 \&\fBcrypt()\fR implementations.  This is different to the normal \fBcrypt()\fR in
365 that the third parameter is the buffer that the return value is
366 written into.  It needs to be at least 14 bytes long.  This function
367 is thread safe, unlike the normal \fBcrypt()\fR.
368 .PP
369 \&\fBDES_crypt()\fR is a faster replacement for the normal system \fBcrypt()\fR.
370 This function calls \fBDES_fcrypt()\fR with a static array passed as the
371 third parameter.  This mostly emulates the normal non-thread-safe semantics
372 of \fBcrypt\fR\|(3).
373 The \fBsalt\fR must be two \s-1ASCII\s0 characters.
374 .PP
375 The values returned by \fBDES_fcrypt()\fR and \fBDES_crypt()\fR are terminated by \s-1NUL\s0
376 character.
377 .PP
378 \&\fBDES_enc_write()\fR writes \fIlen\fR bytes to file descriptor \fIfd\fR from
379 buffer \fIbuf\fR. The data is encrypted via \fIpcbc_encrypt\fR (default)
380 using \fIsched\fR for the key and \fIiv\fR as a starting vector.  The actual
381 data send down \fIfd\fR consists of 4 bytes (in network byte order)
382 containing the length of the following encrypted data.  The encrypted
383 data then follows, padded with random data out to a multiple of 8
384 bytes.
385 .SH "BUGS"
386 .IX Header "BUGS"
387 \&\fBDES_cbc_encrypt()\fR does not modify \fBivec\fR; use \fBDES_ncbc_encrypt()\fR
388 instead.
389 .PP
390 \&\fBDES_cfb_encrypt()\fR and \fBDES_ofb_encrypt()\fR operates on input of 8 bits.
391 What this means is that if you set numbits to 12, and length to 2, the
392 first 12 bits will come from the 1st input byte and the low half of
393 the second input byte.  The second 12 bits will have the low 8 bits
394 taken from the 3rd input byte and the top 4 bits taken from the 4th
395 input byte.  The same holds for output.  This function has been
396 implemented this way because most people will be using a multiple of 8
397 and because once you get into pulling bytes input bytes apart things
398 get ugly!
399 .PP
400 \&\fBDES_string_to_key()\fR is available for backward compatibility with the
401 \&\s-1MIT\s0 library.  New applications should use a cryptographic hash function.
402 The same applies for \fBDES_string_to_2key()\fR.
403 .SH "NOTES"
404 .IX Header "NOTES"
405 The \fBdes\fR library was written to be source code compatible with
406 the \s-1MIT\s0 Kerberos library.
407 .PP
408 Applications should use the higher level functions
409 \&\fBEVP_EncryptInit\fR\|(3) etc. instead of calling these
410 functions directly.
411 .PP
412 Single-key \s-1DES\s0 is insecure due to its short key size.  \s-1ECB\s0 mode is
413 not suitable for most applications; see \fBdes_modes\fR\|(7).
414 .SH "RETURN VALUES"
415 .IX Header "RETURN VALUES"
416 \&\fBDES_set_key()\fR, \fBDES_key_sched()\fR, \fBDES_set_key_checked()\fR and \fBDES_is_weak_key()\fR
417 return 0 on success or negative values on error.
418 .PP
419 \&\fBDES_cbc_cksum()\fR and \fBDES_quad_cksum()\fR return 4\-byte integer representing the
420 last 4 bytes of the checksum of the input.
421 .PP
422 \&\fBDES_fcrypt()\fR returns a pointer to the caller-provided buffer and \fBDES_crypt()\fR \-
423 to a static buffer on success; otherwise they return \s-1NULL.\s0
424 .SH "HISTORY"
425 .IX Header "HISTORY"
426 The requirement that the \fBsalt\fR parameter to \fBDES_crypt()\fR and \fBDES_fcrypt()\fR
427 be two \s-1ASCII\s0 characters was first enforced in
428 OpenSSL 1.1.0.  Previous versions tried to use the letter uppercase \fBA\fR
429 if both character were not present, and could crash when given non-ASCII
430 on some platforms.
431 .SH "SEE ALSO"
432 .IX Header "SEE ALSO"
433 \&\fBdes_modes\fR\|(7),
434 \&\fBEVP_EncryptInit\fR\|(3)
435 .SH "COPYRIGHT"
436 .IX Header "COPYRIGHT"
437 Copyright 2000\-2018 The OpenSSL Project Authors. All Rights Reserved.
438 .PP
439 Licensed under the OpenSSL license (the \*(L"License\*(R").  You may not use
440 this file except in compliance with the License.  You can obtain a copy
441 in the file \s-1LICENSE\s0 in the source distribution or at
442 <https://www.openssl.org/source/license.html>.