]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/lib/libcrypto/man/DES_random_key.3
Merge OpenSSL 1.1.1d.
[FreeBSD/FreeBSD.git] / secure / lib / libcrypto / man / DES_random_key.3
1 .\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.39)
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-09-10" "1.1.1d" "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 random generator must be
237 seeded when calling this function.
238 If the automatic seeding or reseeding of the OpenSSL \s-1CSPRNG\s0 fails due to
239 external circumstances (see \s-1\fBRAND\s0\fR\|(7)), the operation will fail.
240 If the function fails, 0 is returned.
241 .PP
242 Before a \s-1DES\s0 key can be used, it must be converted into the
243 architecture dependent \fIDES_key_schedule\fR via the
244 \&\fBDES_set_key_checked()\fR or \fBDES_set_key_unchecked()\fR function.
245 .PP
246 \&\fBDES_set_key_checked()\fR will check that the key passed is of odd parity
247 and is not a weak or semi-weak key.  If the parity is wrong, then \-1
248 is returned.  If the key is a weak key, then \-2 is returned.  If an
249 error is returned, the key schedule is not generated.
250 .PP
251 \&\fBDES_set_key()\fR works like
252 \&\fBDES_set_key_checked()\fR if the \fIDES_check_key\fR flag is non-zero,
253 otherwise like \fBDES_set_key_unchecked()\fR.  These functions are available
254 for compatibility; it is recommended to use a function that does not
255 depend on a global variable.
256 .PP
257 \&\fBDES_set_odd_parity()\fR sets the parity of the passed \fIkey\fR to odd.
258 .PP
259 \&\fBDES_is_weak_key()\fR returns 1 if the passed key is a weak key, 0 if it
260 is ok.
261 .PP
262 The following routines mostly operate on an input and output stream of
263 \&\fIDES_cblock\fRs.
264 .PP
265 \&\fBDES_ecb_encrypt()\fR is the basic \s-1DES\s0 encryption routine that encrypts or
266 decrypts a single 8\-byte \fIDES_cblock\fR in \fIelectronic code book\fR
267 (\s-1ECB\s0) mode.  It always transforms the input data, pointed to by
268 \&\fIinput\fR, into the output data, pointed to by the \fIoutput\fR argument.
269 If the \fIencrypt\fR argument is non-zero (\s-1DES_ENCRYPT\s0), the \fIinput\fR
270 (cleartext) is encrypted in to the \fIoutput\fR (ciphertext) using the
271 key_schedule specified by the \fIschedule\fR argument, previously set via
272 \&\fIDES_set_key\fR. If \fIencrypt\fR is zero (\s-1DES_DECRYPT\s0), the \fIinput\fR (now
273 ciphertext) is decrypted into the \fIoutput\fR (now cleartext).  Input
274 and output may overlap.  \fBDES_ecb_encrypt()\fR does not return a value.
275 .PP
276 \&\fBDES_ecb3_encrypt()\fR encrypts/decrypts the \fIinput\fR block by using
277 three-key Triple-DES encryption in \s-1ECB\s0 mode.  This involves encrypting
278 the input with \fIks1\fR, decrypting with the key schedule \fIks2\fR, and
279 then encrypting with \fIks3\fR.  This routine greatly reduces the chances
280 of brute force breaking of \s-1DES\s0 and has the advantage of if \fIks1\fR,
281 \&\fIks2\fR and \fIks3\fR are the same, it is equivalent to just encryption
282 using \s-1ECB\s0 mode and \fIks1\fR as the key.
283 .PP
284 The macro \fBDES_ecb2_encrypt()\fR is provided to perform two-key Triple-DES
285 encryption by using \fIks1\fR for the final encryption.
286 .PP
287 \&\fBDES_ncbc_encrypt()\fR encrypts/decrypts using the \fIcipher-block-chaining\fR
288 (\s-1CBC\s0) mode of \s-1DES.\s0  If the \fIencrypt\fR argument is non-zero, the
289 routine cipher-block-chain encrypts the cleartext data pointed to by
290 the \fIinput\fR argument into the ciphertext pointed to by the \fIoutput\fR
291 argument, using the key schedule provided by the \fIschedule\fR argument,
292 and initialization vector provided by the \fIivec\fR argument.  If the
293 \&\fIlength\fR argument is not an integral multiple of eight bytes, the
294 last block is copied to a temporary area and zero filled.  The output
295 is always an integral multiple of eight bytes.
296 .PP
297 \&\fBDES_xcbc_encrypt()\fR is \s-1RSA\s0's \s-1DESX\s0 mode of \s-1DES.\s0  It uses \fIinw\fR and
298 \&\fIoutw\fR to 'whiten' the encryption.  \fIinw\fR and \fIoutw\fR are secret
299 (unlike the iv) and are as such, part of the key.  So the key is sort
300 of 24 bytes.  This is much better than \s-1CBC DES.\s0
301 .PP
302 \&\fBDES_ede3_cbc_encrypt()\fR implements outer triple \s-1CBC DES\s0 encryption with
303 three keys. This means that each \s-1DES\s0 operation inside the \s-1CBC\s0 mode is
304 \&\f(CW\*(C`C=E(ks3,D(ks2,E(ks1,M)))\*(C'\fR.  This mode is used by \s-1SSL.\s0
305 .PP
306 The \fBDES_ede2_cbc_encrypt()\fR macro implements two-key Triple-DES by
307 reusing \fIks1\fR for the final encryption.  \f(CW\*(C`C=E(ks1,D(ks2,E(ks1,M)))\*(C'\fR.
308 This form of Triple-DES is used by the \s-1RSAREF\s0 library.
309 .PP
310 \&\fBDES_pcbc_encrypt()\fR encrypts/decrypts using the propagating cipher block
311 chaining mode used by Kerberos v4. Its parameters are the same as
312 \&\fBDES_ncbc_encrypt()\fR.
313 .PP
314 \&\fBDES_cfb_encrypt()\fR encrypts/decrypts using cipher feedback mode.  This
315 method takes an array of characters as input and outputs an array of
316 characters.  It does not require any padding to 8 character groups.
317 Note: the \fIivec\fR variable is changed and the new changed value needs to
318 be passed to the next call to this function.  Since this function runs
319 a complete \s-1DES ECB\s0 encryption per \fInumbits\fR, this function is only
320 suggested for use when sending a small number of characters.
321 .PP
322 \&\fBDES_cfb64_encrypt()\fR
323 implements \s-1CFB\s0 mode of \s-1DES\s0 with 64\-bit feedback.  Why is this
324 useful you ask?  Because this routine will allow you to encrypt an
325 arbitrary number of bytes, without 8 byte padding.  Each call to this
326 routine will encrypt the input bytes to output and then update ivec
327 and num.  num contains 'how far' we are though ivec.  If this does
328 not make much sense, read more about \s-1CFB\s0 mode of \s-1DES.\s0
329 .PP
330 \&\fBDES_ede3_cfb64_encrypt()\fR and \fBDES_ede2_cfb64_encrypt()\fR is the same as
331 \&\fBDES_cfb64_encrypt()\fR except that Triple-DES is used.
332 .PP
333 \&\fBDES_ofb_encrypt()\fR encrypts using output feedback mode.  This method
334 takes an array of characters as input and outputs an array of
335 characters.  It does not require any padding to 8 character groups.
336 Note: the \fIivec\fR variable is changed and the new changed value needs to
337 be passed to the next call to this function.  Since this function runs
338 a complete \s-1DES ECB\s0 encryption per \fInumbits\fR, this function is only
339 suggested for use when sending a small number of characters.
340 .PP
341 \&\fBDES_ofb64_encrypt()\fR is the same as \fBDES_cfb64_encrypt()\fR using Output
342 Feed Back mode.
343 .PP
344 \&\fBDES_ede3_ofb64_encrypt()\fR and \fBDES_ede2_ofb64_encrypt()\fR is the same as
345 \&\fBDES_ofb64_encrypt()\fR, using Triple-DES.
346 .PP
347 The following functions are included in the \s-1DES\s0 library for
348 compatibility with the \s-1MIT\s0 Kerberos library.
349 .PP
350 \&\fBDES_cbc_cksum()\fR produces an 8 byte checksum based on the input stream
351 (via \s-1CBC\s0 encryption).  The last 4 bytes of the checksum are returned
352 and the complete 8 bytes are placed in \fIoutput\fR. This function is
353 used by Kerberos v4.  Other applications should use
354 \&\fBEVP_DigestInit\fR\|(3) etc. instead.
355 .PP
356 \&\fBDES_quad_cksum()\fR is a Kerberos v4 function.  It returns a 4 byte
357 checksum from the input bytes.  The algorithm can be iterated over the
358 input, depending on \fIout_count\fR, 1, 2, 3 or 4 times.  If \fIoutput\fR is
359 non-NULL, the 8 bytes generated by each pass are written into
360 \&\fIoutput\fR.
361 .PP
362 The following are DES-based transformations:
363 .PP
364 \&\fBDES_fcrypt()\fR is a fast version of the Unix \fBcrypt\fR\|(3) function.  This
365 version takes only a small amount of space relative to other fast
366 \&\fBcrypt()\fR implementations.  This is different to the normal \fBcrypt()\fR in
367 that the third parameter is the buffer that the return value is
368 written into.  It needs to be at least 14 bytes long.  This function
369 is thread safe, unlike the normal \fBcrypt()\fR.
370 .PP
371 \&\fBDES_crypt()\fR is a faster replacement for the normal system \fBcrypt()\fR.
372 This function calls \fBDES_fcrypt()\fR with a static array passed as the
373 third parameter.  This mostly emulates the normal non-thread-safe semantics
374 of \fBcrypt\fR\|(3).
375 The \fBsalt\fR must be two \s-1ASCII\s0 characters.
376 .PP
377 The values returned by \fBDES_fcrypt()\fR and \fBDES_crypt()\fR are terminated by \s-1NUL\s0
378 character.
379 .PP
380 \&\fBDES_enc_write()\fR writes \fIlen\fR bytes to file descriptor \fIfd\fR from
381 buffer \fIbuf\fR. The data is encrypted via \fIpcbc_encrypt\fR (default)
382 using \fIsched\fR for the key and \fIiv\fR as a starting vector.  The actual
383 data send down \fIfd\fR consists of 4 bytes (in network byte order)
384 containing the length of the following encrypted data.  The encrypted
385 data then follows, padded with random data out to a multiple of 8
386 bytes.
387 .SH "BUGS"
388 .IX Header "BUGS"
389 \&\fBDES_cbc_encrypt()\fR does not modify \fBivec\fR; use \fBDES_ncbc_encrypt()\fR
390 instead.
391 .PP
392 \&\fBDES_cfb_encrypt()\fR and \fBDES_ofb_encrypt()\fR operates on input of 8 bits.
393 What this means is that if you set numbits to 12, and length to 2, the
394 first 12 bits will come from the 1st input byte and the low half of
395 the second input byte.  The second 12 bits will have the low 8 bits
396 taken from the 3rd input byte and the top 4 bits taken from the 4th
397 input byte.  The same holds for output.  This function has been
398 implemented this way because most people will be using a multiple of 8
399 and because once you get into pulling bytes input bytes apart things
400 get ugly!
401 .PP
402 \&\fBDES_string_to_key()\fR is available for backward compatibility with the
403 \&\s-1MIT\s0 library.  New applications should use a cryptographic hash function.
404 The same applies for \fBDES_string_to_2key()\fR.
405 .SH "NOTES"
406 .IX Header "NOTES"
407 The \fBdes\fR library was written to be source code compatible with
408 the \s-1MIT\s0 Kerberos library.
409 .PP
410 Applications should use the higher level functions
411 \&\fBEVP_EncryptInit\fR\|(3) etc. instead of calling these
412 functions directly.
413 .PP
414 Single-key \s-1DES\s0 is insecure due to its short key size.  \s-1ECB\s0 mode is
415 not suitable for most applications; see \fBdes_modes\fR\|(7).
416 .SH "RETURN VALUES"
417 .IX Header "RETURN VALUES"
418 \&\fBDES_set_key()\fR, \fBDES_key_sched()\fR, \fBDES_set_key_checked()\fR and \fBDES_is_weak_key()\fR
419 return 0 on success or negative values on error.
420 .PP
421 \&\fBDES_cbc_cksum()\fR and \fBDES_quad_cksum()\fR return 4\-byte integer representing the
422 last 4 bytes of the checksum of the input.
423 .PP
424 \&\fBDES_fcrypt()\fR returns a pointer to the caller-provided buffer and \fBDES_crypt()\fR \-
425 to a static buffer on success; otherwise they return \s-1NULL.\s0
426 .SH "SEE ALSO"
427 .IX Header "SEE ALSO"
428 \&\fBdes_modes\fR\|(7),
429 \&\fBEVP_EncryptInit\fR\|(3)
430 .SH "HISTORY"
431 .IX Header "HISTORY"
432 The requirement that the \fBsalt\fR parameter to \fBDES_crypt()\fR and \fBDES_fcrypt()\fR
433 be two \s-1ASCII\s0 characters was first enforced in
434 OpenSSL 1.1.0.  Previous versions tried to use the letter uppercase \fBA\fR
435 if both character were not present, and could crash when given non-ASCII
436 on some platforms.
437 .SH "COPYRIGHT"
438 .IX Header "COPYRIGHT"
439 Copyright 2000\-2019 The OpenSSL Project Authors. All Rights Reserved.
440 .PP
441 Licensed under the OpenSSL license (the \*(L"License\*(R").  You may not use
442 this file except in compliance with the License.  You can obtain a copy
443 in the file \s-1LICENSE\s0 in the source distribution or at
444 <https://www.openssl.org/source/license.html>.