diff options
author | cvs2svn <admin@example.com> | 2002-05-15 02:29:23 +0000 |
---|---|---|
committer | cvs2svn <admin@example.com> | 2002-05-15 02:29:23 +0000 |
commit | fd9566423b542798f5c8b06e68101a9ea5bb9885 (patch) | |
tree | f2cc037857a260afc5aaaaaa6cf62d06923c6273 /src/lib/libcrypto/des | |
parent | 536c76cbb863bab152f19842ab88772c01e922c7 (diff) | |
download | openbsd-fd9566423b542798f5c8b06e68101a9ea5bb9885.tar.gz openbsd-fd9566423b542798f5c8b06e68101a9ea5bb9885.tar.bz2 openbsd-fd9566423b542798f5c8b06e68101a9ea5bb9885.zip |
This commit was manufactured by cvs2git to create branch 'openssl'.
Diffstat (limited to 'src/lib/libcrypto/des')
-rw-r--r-- | src/lib/libcrypto/des/des-lib.com | 1003 | ||||
-rw-r--r-- | src/lib/libcrypto/des/des.pod | 217 | ||||
-rw-r--r-- | src/lib/libcrypto/des/des_old.c | 271 | ||||
-rw-r--r-- | src/lib/libcrypto/des/des_old.h | 437 | ||||
-rw-r--r-- | src/lib/libcrypto/des/des_old2.c | 82 |
5 files changed, 2010 insertions, 0 deletions
diff --git a/src/lib/libcrypto/des/des-lib.com b/src/lib/libcrypto/des/des-lib.com new file mode 100644 index 0000000000..2aea7a0dea --- /dev/null +++ b/src/lib/libcrypto/des/des-lib.com | |||
@@ -0,0 +1,1003 @@ | |||
1 | $! | ||
2 | $! DES-LIB.COM | ||
3 | $! Written By: Robert Byer | ||
4 | $! Vice-President | ||
5 | $! A-Com Computing, Inc. | ||
6 | $! byer@mail.all-net.net | ||
7 | $! | ||
8 | $! Changes by Richard Levitte <richard@levitte.org> | ||
9 | $! | ||
10 | $! This command files compiles and creates the | ||
11 | $! "[.xxx.EXE.CRYPTO.DES]LIBDES.OLB" library. The "xxx" denotes the machine | ||
12 | $! architecture of AXP or VAX. | ||
13 | $! | ||
14 | $! It was re-written to try to determine which "C" compiler to try to use | ||
15 | $! or the user can specify a compiler in P3. | ||
16 | $! | ||
17 | $! Specify one of the following to build just that part, specify "ALL" to | ||
18 | $! just build everything. | ||
19 | $! | ||
20 | $! ALL To Just Build "Everything". | ||
21 | $! LIBRARY To Just Build The [.xxx.EXE.CRYPTO.DES]LIBDES.OLB Library. | ||
22 | $! DESTEST To Just Build The [.xxx.EXE.CRYPTO.DES]DESTEST.EXE Program. | ||
23 | $! SPEED To Just Build The [.xxx.EXE.CRYPTO.DES]SPEED.EXE Program. | ||
24 | $! RPW To Just Build The [.xxx.EXE.CRYPTO.DES]RPW.EXE Program. | ||
25 | $! DES To Just Build The [.xxx.EXE.CRYPTO.DES]DES.EXE Program. | ||
26 | $! DES_OPTS To Just Build The [.xxx.EXE.CRYPTO.DES]DES_OPTS.EXE Program. | ||
27 | $! | ||
28 | $! Specify either DEBUG or NODEBUG as P2 to compile with or without | ||
29 | $! debugging information. | ||
30 | $! | ||
31 | $! Specify which compiler at P3 to try to compile under. | ||
32 | $! | ||
33 | $! VAXC For VAX C. | ||
34 | $! DECC For DEC C. | ||
35 | $! GNUC For GNU C. | ||
36 | $! | ||
37 | $! If you don't speficy a compiler, it will try to determine which | ||
38 | $! "C" compiler to try to use. | ||
39 | $! | ||
40 | $! P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up) | ||
41 | $! | ||
42 | $! | ||
43 | $! Make sure we know what architecture we run on. | ||
44 | $! | ||
45 | $! | ||
46 | $! Check Which Architecture We Are Using. | ||
47 | $! | ||
48 | $ IF (F$GETSYI("CPU").GE.128) | ||
49 | $ THEN | ||
50 | $! | ||
51 | $! The Architecture Is AXP. | ||
52 | $! | ||
53 | $ ARCH := AXP | ||
54 | $! | ||
55 | $! Else... | ||
56 | $! | ||
57 | $ ELSE | ||
58 | $! | ||
59 | $! The Architecture Is VAX. | ||
60 | $! | ||
61 | $ ARCH := VAX | ||
62 | $! | ||
63 | $! End The Architecture Check. | ||
64 | $! | ||
65 | $ ENDIF | ||
66 | $! | ||
67 | $! Check To Make Sure We Have Valid Command Line Parameters. | ||
68 | $! | ||
69 | $ GOSUB CHECK_OPTIONS | ||
70 | $! | ||
71 | $! Tell The User What Kind of Machine We Run On. | ||
72 | $! | ||
73 | $ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine." | ||
74 | $! | ||
75 | $! Define The OBJ Directory Name. | ||
76 | $! | ||
77 | $ OBJ_DIR := SYS$DISK:[--.'ARCH'.OBJ.CRYPTO.DES] | ||
78 | $! | ||
79 | $! Check To See If The Architecture Specific OBJ Directory Exists. | ||
80 | $! | ||
81 | $ IF (F$PARSE(OBJ_DIR).EQS."") | ||
82 | $ THEN | ||
83 | $! | ||
84 | $! It Dosen't Exist, So Create It. | ||
85 | $! | ||
86 | $ CREATE/DIR 'OBJ_DIR' | ||
87 | $! | ||
88 | $! End The Architecture Specific OBJ Directory Check. | ||
89 | $! | ||
90 | $ ENDIF | ||
91 | $! | ||
92 | $! Define The EXE Directory Name. | ||
93 | $! | ||
94 | $ EXE_DIR :== SYS$DISK:[--.'ARCH'.EXE.CRYPTO.DES] | ||
95 | $! | ||
96 | $! Check To See If The Architecture Specific Directory Exists. | ||
97 | $! | ||
98 | $ IF (F$PARSE(EXE_DIR).EQS."") | ||
99 | $ THEN | ||
100 | $! | ||
101 | $! It Dosen't Exist, So Create It. | ||
102 | $! | ||
103 | $ CREATE/DIR 'EXE_DIR' | ||
104 | $! | ||
105 | $! End The Architecture Specific Directory Check. | ||
106 | $! | ||
107 | $ ENDIF | ||
108 | $! | ||
109 | $! Define The Library Name. | ||
110 | $! | ||
111 | $ LIB_NAME := 'EXE_DIR'LIBDES.OLB | ||
112 | $! | ||
113 | $! Check To See What We Are To Do. | ||
114 | $! | ||
115 | $ IF (BUILDALL.EQS."TRUE") | ||
116 | $ THEN | ||
117 | $! | ||
118 | $! Since Nothing Special Was Specified, Do Everything. | ||
119 | $! | ||
120 | $ GOSUB LIBRARY | ||
121 | $ GOSUB DESTEST | ||
122 | $ GOSUB SPEED | ||
123 | $ GOSUB RPW | ||
124 | $ GOSUB DES | ||
125 | $ GOSUB DES_OPTS | ||
126 | $! | ||
127 | $! Else... | ||
128 | $! | ||
129 | $ ELSE | ||
130 | $! | ||
131 | $! Build Just What The User Wants Us To Build. | ||
132 | $! | ||
133 | $ GOSUB 'BUILDALL' | ||
134 | $! | ||
135 | $! End The BUILDALL Check. | ||
136 | $! | ||
137 | $ ENDIF | ||
138 | $! | ||
139 | $! Time To EXIT. | ||
140 | $! | ||
141 | $ EXIT | ||
142 | $ LIBRARY: | ||
143 | $! | ||
144 | $! Tell The User That We Are Compiling. | ||
145 | $! | ||
146 | $ WRITE SYS$OUTPUT "Compiling The ",LIB_NAME," Files." | ||
147 | $! | ||
148 | $! Check To See If We Already Have A "[.xxx.EXE.CRYPTO.DES]LIBDES.OLB" Library... | ||
149 | $! | ||
150 | $ IF (F$SEARCH(LIB_NAME).EQS."") | ||
151 | $ THEN | ||
152 | $! | ||
153 | $! Guess Not, Create The Library. | ||
154 | $! | ||
155 | $ LIBRARY/CREATE/OBJECT 'LIB_NAME' | ||
156 | $! | ||
157 | $! End The Library Exist Check. | ||
158 | $! | ||
159 | $ ENDIF | ||
160 | $! | ||
161 | $! Define The DES Library Files. | ||
162 | $! | ||
163 | $ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ - | ||
164 | "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ - | ||
165 | "enc_read,enc_writ,ofb64enc,"+ - | ||
166 | "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ - | ||
167 | "des_enc,fcrypt_b,read2pwd,"+ - | ||
168 | "fcrypt,xcbc_enc,read_pwd,rpc_enc,cbc_cksm,supp" | ||
169 | $! | ||
170 | $! Define A File Counter And Set It To "0". | ||
171 | $! | ||
172 | $ FILE_COUNTER = 0 | ||
173 | $! | ||
174 | $! Top Of The File Loop. | ||
175 | $! | ||
176 | $ NEXT_FILE: | ||
177 | $! | ||
178 | $! O.K, Extract The File Name From The File List. | ||
179 | $! | ||
180 | $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",LIB_DES) | ||
181 | $! | ||
182 | $! Check To See If We Are At The End Of The File List. | ||
183 | $! | ||
184 | $ IF (FILE_NAME.EQS.",") THEN GOTO FILE_DONE | ||
185 | $! | ||
186 | $! Increment The Counter. | ||
187 | $! | ||
188 | $ FILE_COUNTER = FILE_COUNTER + 1 | ||
189 | $! | ||
190 | $! Create The Source File Name. | ||
191 | $! | ||
192 | $ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME + ".C" | ||
193 | $! | ||
194 | $! Tell The User We Are Compiling The Source File. | ||
195 | $! | ||
196 | $ WRITE SYS$OUTPUT " ",FILE_NAME,".C" | ||
197 | $! | ||
198 | $! Create The Object File Name. | ||
199 | $! | ||
200 | $ OBJECT_FILE = OBJ_DIR + FILE_NAME + "." + ARCH + "OBJ" | ||
201 | $ ON WARNING THEN GOTO NEXT_FILE | ||
202 | $! | ||
203 | $! Check To See If The File We Want To Compile Actually Exists. | ||
204 | $! | ||
205 | $ IF (F$SEARCH(SOURCE_FILE).EQS."") | ||
206 | $ THEN | ||
207 | $! | ||
208 | $! Tell The User That The File Dosen't Exist. | ||
209 | $! | ||
210 | $ WRITE SYS$OUTPUT "" | ||
211 | $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist." | ||
212 | $ WRITE SYS$OUTPUT "" | ||
213 | $! | ||
214 | $! Exit The Build. | ||
215 | $! | ||
216 | $ EXIT | ||
217 | $! | ||
218 | $! End The File Exists Check. | ||
219 | $! | ||
220 | $ ENDIF | ||
221 | $! | ||
222 | $! Compile The File. | ||
223 | $! | ||
224 | $ ON ERROR THEN GOTO NEXT_FILE | ||
225 | $ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
226 | $! | ||
227 | $! Add It To The Library. | ||
228 | $! | ||
229 | $ LIBRARY/REPLACE/OBJECT 'LIB_NAME' 'OBJECT_FILE' | ||
230 | $! | ||
231 | $! Time To Clean Up The Object File. | ||
232 | $! | ||
233 | $ DELETE 'OBJECT_FILE';* | ||
234 | $! | ||
235 | $! Go Back And Do It Again. | ||
236 | $! | ||
237 | $ GOTO NEXT_FILE | ||
238 | $! | ||
239 | $! All Done With This Library Part. | ||
240 | $! | ||
241 | $ FILE_DONE: | ||
242 | $! | ||
243 | $! Tell The User That We Are All Done. | ||
244 | $! | ||
245 | $ WRITE SYS$OUTPUT "Library ",LIB_NAME," Built." | ||
246 | $! | ||
247 | $! All Done, Time To Return. | ||
248 | $! | ||
249 | $ RETURN | ||
250 | $! | ||
251 | $! Compile The DESTEST Program. | ||
252 | $! | ||
253 | $ DESTEST: | ||
254 | $! | ||
255 | $! Check To See If We Have The Proper Libraries. | ||
256 | $! | ||
257 | $ GOSUB LIB_CHECK | ||
258 | $! | ||
259 | $! Check To See If We Have A Linker Option File. | ||
260 | $! | ||
261 | $ GOSUB CHECK_OPT_FILE | ||
262 | $! | ||
263 | $! Check To See If The File We Want To Compile Actually Exists. | ||
264 | $! | ||
265 | $ IF (F$SEARCH("SYS$DISK:[]DESTEST.C").EQS."") | ||
266 | $ THEN | ||
267 | $! | ||
268 | $! Tell The User That The File Dosen't Exist. | ||
269 | $! | ||
270 | $ WRITE SYS$OUTPUT "" | ||
271 | $ WRITE SYS$OUTPUT "The File DESTEST.C Dosen't Exist." | ||
272 | $ WRITE SYS$OUTPUT "" | ||
273 | $! | ||
274 | $! Exit The Build. | ||
275 | $! | ||
276 | $ EXIT | ||
277 | $! | ||
278 | $! End The DESTEST.C File Check. | ||
279 | $! | ||
280 | $ ENDIF | ||
281 | $! | ||
282 | $! Tell The User What We Are Building. | ||
283 | $! | ||
284 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DESTEST.EXE" | ||
285 | $! | ||
286 | $! Compile The DESTEST Program. | ||
287 | $! | ||
288 | $ CC/OBJECT='OBJ_DIR'DESTEST.OBJ SYS$DISK:[]DESTEST.C | ||
289 | $! | ||
290 | $! Link The DESTEST Program. | ||
291 | $! | ||
292 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DESTEST.EXE - | ||
293 | 'OBJ_DIR'DESTEST.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
294 | $! | ||
295 | $! All Done, Time To Return. | ||
296 | $! | ||
297 | $ RETURN | ||
298 | $! | ||
299 | $! Compile The SPEED Program. | ||
300 | $! | ||
301 | $ SPEED: | ||
302 | $! | ||
303 | $! Check To See If We Have The Proper Libraries. | ||
304 | $! | ||
305 | $ GOSUB LIB_CHECK | ||
306 | $! | ||
307 | $! Check To See If We Have A Linker Option File. | ||
308 | $! | ||
309 | $ GOSUB CHECK_OPT_FILE | ||
310 | $! | ||
311 | $! Check To See If The File We Want To Compile Actually Exists. | ||
312 | $! | ||
313 | $ IF (F$SEARCH("SYS$DISK:[]SPEED.C").EQS."") | ||
314 | $ THEN | ||
315 | $! | ||
316 | $! Tell The User That The File Dosen't Exist. | ||
317 | $! | ||
318 | $ WRITE SYS$OUTPUT "" | ||
319 | $ WRITE SYS$OUTPUT "The File SPEED.C Dosen't Exist." | ||
320 | $ WRITE SYS$OUTPUT "" | ||
321 | $! | ||
322 | $! Exit The Build. | ||
323 | $! | ||
324 | $ EXIT | ||
325 | $! | ||
326 | $! End The SPEED.C File Check. | ||
327 | $! | ||
328 | $ ENDIF | ||
329 | $! | ||
330 | $! Tell The User What We Are Building. | ||
331 | $! | ||
332 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"SPEED.EXE" | ||
333 | $! | ||
334 | $! Compile The SPEED Program. | ||
335 | $! | ||
336 | $ CC/OBJECT='OBJ_DIR'SPEED.OBJ SYS$DISK:[]SPEED.C | ||
337 | $! | ||
338 | $! Link The SPEED Program. | ||
339 | $! | ||
340 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'SPEED.EXE - | ||
341 | 'OBJ_DIR'SPEED.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
342 | $! | ||
343 | $! All Done, Time To Return. | ||
344 | $! | ||
345 | $ RETURN | ||
346 | $! | ||
347 | $! Compile The RPW Program. | ||
348 | $! | ||
349 | $ RPW: | ||
350 | $! | ||
351 | $! Check To See If We Have The Proper Libraries. | ||
352 | $! | ||
353 | $ GOSUB LIB_CHECK | ||
354 | $! | ||
355 | $! Check To See If We Have A Linker Option File. | ||
356 | $! | ||
357 | $ GOSUB CHECK_OPT_FILE | ||
358 | $! | ||
359 | $! Check To See If The File We Want To Compile Actually Exists. | ||
360 | $! | ||
361 | $ IF (F$SEARCH("SYS$DISK:[]RPW.C").EQS."") | ||
362 | $ THEN | ||
363 | $! | ||
364 | $! Tell The User That The File Dosen't Exist. | ||
365 | $! | ||
366 | $ WRITE SYS$OUTPUT "" | ||
367 | $ WRITE SYS$OUTPUT "The File RPW.C Dosen't Exist." | ||
368 | $ WRITE SYS$OUTPUT "" | ||
369 | $! | ||
370 | $! Exit The Build. | ||
371 | $! | ||
372 | $ EXIT | ||
373 | $! | ||
374 | $! End The RPW.C File Check. | ||
375 | $! | ||
376 | $ ENDIF | ||
377 | $! | ||
378 | $! Tell The User What We Are Building. | ||
379 | $! | ||
380 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"RPW.EXE" | ||
381 | $! | ||
382 | $! Compile The RPW Program. | ||
383 | $! | ||
384 | $ CC/OBJECT='OBJ_DIR'RPW.OBJ SYS$DISK:[]RPW.C | ||
385 | $! | ||
386 | $! Link The RPW Program. | ||
387 | $! | ||
388 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'RPW.EXE - | ||
389 | 'OBJ_DIR'RPW.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
390 | $! | ||
391 | $! All Done, Time To Return. | ||
392 | $! | ||
393 | $ RETURN | ||
394 | $! | ||
395 | $! Compile The DES Program. | ||
396 | $! | ||
397 | $ DES: | ||
398 | $! | ||
399 | $! Check To See If We Have The Proper Libraries. | ||
400 | $! | ||
401 | $ GOSUB LIB_CHECK | ||
402 | $! | ||
403 | $! Check To See If We Have A Linker Option File. | ||
404 | $! | ||
405 | $ GOSUB CHECK_OPT_FILE | ||
406 | $! | ||
407 | $! Check To See If The File We Want To Compile Actually Exists. | ||
408 | $! | ||
409 | $ IF (F$SEARCH("SYS$DISK:[]DES.C").EQS."") | ||
410 | $ THEN | ||
411 | $! | ||
412 | $! Tell The User That The File Dosen't Exist. | ||
413 | $! | ||
414 | $ WRITE SYS$OUTPUT "" | ||
415 | $ WRITE SYS$OUTPUT "The File DES.C Dosen't Exist." | ||
416 | $ WRITE SYS$OUTPUT "" | ||
417 | $! | ||
418 | $! Exit The Build. | ||
419 | $! | ||
420 | $ EXIT | ||
421 | $! | ||
422 | $! End The DES.C File Check. | ||
423 | $! | ||
424 | $ ENDIF | ||
425 | $! | ||
426 | $! Tell The User What We Are Building. | ||
427 | $! | ||
428 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DES.EXE" | ||
429 | $! | ||
430 | $! Compile The DES Program. | ||
431 | $! | ||
432 | $ CC/OBJECT='OBJ_DIR'DES.OBJ SYS$DISK:[]DES.C | ||
433 | $ CC/OBJECT='OBJ_DIR'DES.OBJ SYS$DISK:[]CBC3_ENC.C | ||
434 | $! | ||
435 | $! Link The DES Program. | ||
436 | $! | ||
437 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DES.EXE - | ||
438 | 'OBJ_DIR'DES.OBJ,'OBJ_DIR'CBC3_ENC.OBJ,- | ||
439 | 'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
440 | $! | ||
441 | $! All Done, Time To Return. | ||
442 | $! | ||
443 | $ RETURN | ||
444 | $! | ||
445 | $! Compile The DES_OPTS Program. | ||
446 | $! | ||
447 | $ DES_OPTS: | ||
448 | $! | ||
449 | $! Check To See If We Have The Proper Libraries. | ||
450 | $! | ||
451 | $ GOSUB LIB_CHECK | ||
452 | $! | ||
453 | $! Check To See If We Have A Linker Option File. | ||
454 | $! | ||
455 | $ GOSUB CHECK_OPT_FILE | ||
456 | $! | ||
457 | $! Check To See If The File We Want To Compile Actually Exists. | ||
458 | $! | ||
459 | $ IF (F$SEARCH("SYS$DISK:[]DES_OPTS.C").EQS."") | ||
460 | $ THEN | ||
461 | $! | ||
462 | $! Tell The User That The File Dosen't Exist. | ||
463 | $! | ||
464 | $ WRITE SYS$OUTPUT "" | ||
465 | $ WRITE SYS$OUTPUT "The File DES_OPTS.C Dosen't Exist." | ||
466 | $ WRITE SYS$OUTPUT "" | ||
467 | $! | ||
468 | $! Exit The Build. | ||
469 | $! | ||
470 | $ EXIT | ||
471 | $! | ||
472 | $! End The DES_OPTS.C File Check. | ||
473 | $! | ||
474 | $ ENDIF | ||
475 | $! | ||
476 | $! Tell The User What We Are Building. | ||
477 | $! | ||
478 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DES_OPTS.EXE" | ||
479 | $! | ||
480 | $! Compile The DES_OPTS Program. | ||
481 | $! | ||
482 | $ CC/OBJECT='OBJ_DIR'DES_OPTS.OBJ SYS$DISK:[]DES_OPTS.C | ||
483 | $! | ||
484 | $! Link The DES_OPTS Program. | ||
485 | $! | ||
486 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DES_OPTS.EXE - | ||
487 | 'OBJ_DIR'DES_OPTS.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
488 | $! | ||
489 | $! All Done, Time To Return. | ||
490 | $! | ||
491 | $ RETURN | ||
492 | $ EXIT | ||
493 | $! | ||
494 | $! Check For The Link Option FIle. | ||
495 | $! | ||
496 | $ CHECK_OPT_FILE: | ||
497 | $! | ||
498 | $! Check To See If We Need To Make A VAX C Option File. | ||
499 | $! | ||
500 | $ IF (COMPILER.EQS."VAXC") | ||
501 | $ THEN | ||
502 | $! | ||
503 | $! Check To See If We Already Have A VAX C Linker Option File. | ||
504 | $! | ||
505 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
506 | $ THEN | ||
507 | $! | ||
508 | $! We Need A VAX C Linker Option File. | ||
509 | $! | ||
510 | $ CREATE 'OPT_FILE' | ||
511 | $DECK | ||
512 | ! | ||
513 | ! Default System Options File To Link Agianst | ||
514 | ! The Sharable VAX C Runtime Library. | ||
515 | ! | ||
516 | SYS$SHARE:VAXCRTL.EXE/SHARE | ||
517 | $EOD | ||
518 | $! | ||
519 | $! End The Option File Check. | ||
520 | $! | ||
521 | $ ENDIF | ||
522 | $! | ||
523 | $! End The VAXC Check. | ||
524 | $! | ||
525 | $ ENDIF | ||
526 | $! | ||
527 | $! Check To See If We Need A GNU C Option File. | ||
528 | $! | ||
529 | $ IF (COMPILER.EQS."GNUC") | ||
530 | $ THEN | ||
531 | $! | ||
532 | $! Check To See If We Already Have A GNU C Linker Option File. | ||
533 | $! | ||
534 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
535 | $ THEN | ||
536 | $! | ||
537 | $! We Need A GNU C Linker Option File. | ||
538 | $! | ||
539 | $ CREATE 'OPT_FILE' | ||
540 | $DECK | ||
541 | ! | ||
542 | ! Default System Options File To Link Agianst | ||
543 | ! The Sharable C Runtime Library. | ||
544 | ! | ||
545 | GNU_CC:[000000]GCCLIB/LIBRARY | ||
546 | SYS$SHARE:VAXCRTL/SHARE | ||
547 | $EOD | ||
548 | $! | ||
549 | $! End The Option File Check. | ||
550 | $! | ||
551 | $ ENDIF | ||
552 | $! | ||
553 | $! End The GNU C Check. | ||
554 | $! | ||
555 | $ ENDIF | ||
556 | $! | ||
557 | $! Check To See If We Need A DEC C Option File. | ||
558 | $! | ||
559 | $ IF (COMPILER.EQS."DECC") | ||
560 | $ THEN | ||
561 | $! | ||
562 | $! Check To See If We Already Have A DEC C Linker Option File. | ||
563 | $! | ||
564 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
565 | $ THEN | ||
566 | $! | ||
567 | $! Figure Out If We Need An AXP Or A VAX Linker Option File. | ||
568 | $! | ||
569 | $ IF (F$GETSYI("CPU").LT.128) | ||
570 | $ THEN | ||
571 | $! | ||
572 | $! We Need A DEC C Linker Option File For VAX. | ||
573 | $! | ||
574 | $ CREATE 'OPT_FILE' | ||
575 | $DECK | ||
576 | ! | ||
577 | ! Default System Options File To Link Agianst | ||
578 | ! The Sharable DEC C Runtime Library. | ||
579 | ! | ||
580 | SYS$SHARE:DECC$SHR.EXE/SHARE | ||
581 | $EOD | ||
582 | $! | ||
583 | $! Else... | ||
584 | $! | ||
585 | $ ELSE | ||
586 | $! | ||
587 | $! Create The AXP Linker Option File. | ||
588 | $! | ||
589 | $ CREATE 'OPT_FILE' | ||
590 | $DECK | ||
591 | ! | ||
592 | ! Default System Options File For AXP To Link Agianst | ||
593 | ! The Sharable C Runtime Library. | ||
594 | ! | ||
595 | SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE | ||
596 | SYS$SHARE:CMA$OPEN_RTL/SHARE | ||
597 | $EOD | ||
598 | $! | ||
599 | $! End The VAX/AXP DEC C Option File Check. | ||
600 | $! | ||
601 | $ ENDIF | ||
602 | $! | ||
603 | $! End The Option File Search. | ||
604 | $! | ||
605 | $ ENDIF | ||
606 | $! | ||
607 | $! End The DEC C Check. | ||
608 | $! | ||
609 | $ ENDIF | ||
610 | $! | ||
611 | $! Tell The User What Linker Option File We Are Using. | ||
612 | $! | ||
613 | $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"." | ||
614 | $! | ||
615 | $! Time To RETURN. | ||
616 | $! | ||
617 | $ RETURN | ||
618 | $! | ||
619 | $! Library Check. | ||
620 | $! | ||
621 | $ LIB_CHECK: | ||
622 | $! | ||
623 | $! Look For The Library LIBDES.OLB. | ||
624 | $! | ||
625 | $ IF (F$SEARCH(LIB_NAME).EQS."") | ||
626 | $ THEN | ||
627 | $! | ||
628 | $! Tell The User We Can't Find The [.xxx.CRYPTO.DES]LIBDES.OLB Library. | ||
629 | $! | ||
630 | $ WRITE SYS$OUTPUT "" | ||
631 | $ WRITE SYS$OUTPUT "Can't Find The Library ",LIB_NAME,"." | ||
632 | $ WRITE SYS$OUTPUT "We Can't Link Without It." | ||
633 | $ WRITE SYS$OUTPUT "" | ||
634 | $! | ||
635 | $! Since We Can't Link Without It, Exit. | ||
636 | $! | ||
637 | $ EXIT | ||
638 | $ ENDIF | ||
639 | $! | ||
640 | $! Time To Return. | ||
641 | $! | ||
642 | $ RETURN | ||
643 | $! | ||
644 | $! Check The User's Options. | ||
645 | $! | ||
646 | $ CHECK_OPTIONS: | ||
647 | $! | ||
648 | $! Check To See If We Are To "Just Build Everything". | ||
649 | $! | ||
650 | $ IF (P1.EQS."ALL") | ||
651 | $ THEN | ||
652 | $! | ||
653 | $! P1 Is "ALL", So Build Everything. | ||
654 | $! | ||
655 | $ BUILDALL = "TRUE" | ||
656 | $! | ||
657 | $! Else... | ||
658 | $! | ||
659 | $ ELSE | ||
660 | $! | ||
661 | $! Else, Check To See If P1 Has A Valid Arguement. | ||
662 | $! | ||
663 | $ IF (P1.EQS."LIBRARY").OR.(P1.EQS."DESTEST").OR.(P1.EQS."SPEED") - | ||
664 | .OR.(P1.EQS."RPW").OR.(P1.EQS."DES").OR.(P1.EQS."DES_OPTS") | ||
665 | $ THEN | ||
666 | $! | ||
667 | $! A Valid Arguement. | ||
668 | $! | ||
669 | $ BUILDALL = P1 | ||
670 | $! | ||
671 | $! Else... | ||
672 | $! | ||
673 | $ ELSE | ||
674 | $! | ||
675 | $! Tell The User We Don't Know What They Want. | ||
676 | $! | ||
677 | $ WRITE SYS$OUTPUT "" | ||
678 | $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:" | ||
679 | $ WRITE SYS$OUTPUT "" | ||
680 | $ WRITE SYS$OUTPUT " ALL : Just Build Everything. | ||
681 | $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO.DES]LIBDES.OLB Library." | ||
682 | $ WRITE SYS$OUTPUT " DESTEST : To Compile Just The [.xxx.EXE.CRYPTO.DES]DESTEST.EXE Program." | ||
683 | $ WRITE SYS$OUTPUT " SPEED : To Compile Just The [.xxx.EXE.CRYPTO.DES]SPEED.EXE Program." | ||
684 | $ WRITE SYS$OUTPUT " RPW : To Compile Just The [.xxx.EXE.CRYPTO.DES]RPW.EXE Program." | ||
685 | $ WRITE SYS$OUTPUT " DES : To Compile Just The [.xxx.EXE.CRYPTO.DES]DES.EXE Program." | ||
686 | $ WRITE SYS$OUTPUT " DES_OPTS : To Compile Just The [.xxx.EXE.CRYTPO.DES]DES_OPTS.EXE Program." | ||
687 | $ WRITE SYS$OUTPUT "" | ||
688 | $ WRITE SYS$OUTPUT " Where 'xxx' Stands For: " | ||
689 | $ WRITE SYS$OUTPUT "" | ||
690 | $ WRITE SYS$OUTPUT " AXP : Alpha Architecture." | ||
691 | $ WRITE SYS$OUTPUT " VAX : VAX Architecture." | ||
692 | $ WRITE SYS$OUTPUT "" | ||
693 | $! | ||
694 | $! Time To EXIT. | ||
695 | $! | ||
696 | $ EXIT | ||
697 | $! | ||
698 | $! End The Valid Arguement Check. | ||
699 | $! | ||
700 | $ ENDIF | ||
701 | $! | ||
702 | $! End The P1 Check. | ||
703 | $! | ||
704 | $ ENDIF | ||
705 | $! | ||
706 | $! Check To See If We Are To Compile Without Debugger Information. | ||
707 | $! | ||
708 | $ IF (P2.EQS."NODEBUG") | ||
709 | $ THEN | ||
710 | $! | ||
711 | $! P2 Is Blank, So Compile Without Debugger Information. | ||
712 | $! | ||
713 | $ DEBUGGER = "NODEBUG" | ||
714 | $ TRACEBACK = "NOTRACEBACK" | ||
715 | $ GCC_OPTIMIZE = "OPTIMIZE" | ||
716 | $ CC_OPTIMIZE = "OPTIMIZE" | ||
717 | $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile." | ||
718 | $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization." | ||
719 | $! | ||
720 | $! Else... | ||
721 | $! | ||
722 | $ ELSE | ||
723 | $! | ||
724 | $! Check To See If We Are To Compile With Debugger Information. | ||
725 | $! | ||
726 | $ IF (P2.EQS."DEBUG") | ||
727 | $ THEN | ||
728 | $! | ||
729 | $! Compile With Debugger Information. | ||
730 | $! | ||
731 | $ DEBUGGER = "DEBUG" | ||
732 | $ TRACEBACK = "TRACEBACK" | ||
733 | $ GCC_OPTIMIZE = "NOOPTIMIZE" | ||
734 | $ CC_OPTIMIZE = "NOOPTIMIZE" | ||
735 | $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile." | ||
736 | $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization." | ||
737 | $! | ||
738 | $! Else... | ||
739 | $! | ||
740 | $ ELSE | ||
741 | $! | ||
742 | $! Tell The User Entered An Invalid Option.. | ||
743 | $! | ||
744 | $ WRITE SYS$OUTPUT "" | ||
745 | $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:" | ||
746 | $ WRITE SYS$OUTPUT "" | ||
747 | $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information." | ||
748 | $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information." | ||
749 | $ WRITE SYS$OUTPUT "" | ||
750 | $! | ||
751 | $! Time To EXIT. | ||
752 | $! | ||
753 | $ EXIT | ||
754 | $! | ||
755 | $! End The Valid Arguement Check. | ||
756 | $! | ||
757 | $ ENDIF | ||
758 | $! | ||
759 | $! End The P2 Check. | ||
760 | $! | ||
761 | $ ENDIF | ||
762 | $! | ||
763 | $! Special Threads For OpenVMS v7.1 Or Later. | ||
764 | $! | ||
765 | $! Written By: Richard Levitte | ||
766 | $! richard@levitte.org | ||
767 | $! | ||
768 | $! | ||
769 | $! Check To See If We Have A Option For P4. | ||
770 | $! | ||
771 | $ IF (P4.EQS."") | ||
772 | $ THEN | ||
773 | $! | ||
774 | $! Get The Version Of VMS We Are Using. | ||
775 | $! | ||
776 | $ ISSEVEN := "" | ||
777 | $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION"))) | ||
778 | $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP)) | ||
779 | $! | ||
780 | $! Check To See If The VMS Version Is v7.1 Or Later. | ||
781 | $! | ||
782 | $ IF (TMP.GE.71) | ||
783 | $ THEN | ||
784 | $! | ||
785 | $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads. | ||
786 | $! | ||
787 | $ ISSEVEN := ,PTHREAD_USE_D4 | ||
788 | $! | ||
789 | $! End The VMS Version Check. | ||
790 | $! | ||
791 | $ ENDIF | ||
792 | $! | ||
793 | $! End The P4 Check. | ||
794 | $! | ||
795 | $ ENDIF | ||
796 | $! | ||
797 | $! Check To See If P3 Is Blank. | ||
798 | $! | ||
799 | $ IF (P3.EQS."") | ||
800 | $ THEN | ||
801 | $! | ||
802 | $! O.K., The User Didn't Specify A Compiler, Let's Try To | ||
803 | $! Find Out Which One To Use. | ||
804 | $! | ||
805 | $! Check To See If We Have GNU C. | ||
806 | $! | ||
807 | $ IF (F$TRNLNM("GNU_CC").NES."") | ||
808 | $ THEN | ||
809 | $! | ||
810 | $! Looks Like GNUC, Set To Use GNUC. | ||
811 | $! | ||
812 | $ P3 = "GNUC" | ||
813 | $! | ||
814 | $! Else... | ||
815 | $! | ||
816 | $ ELSE | ||
817 | $! | ||
818 | $! Check To See If We Have VAXC Or DECC. | ||
819 | $! | ||
820 | $ IF (ARCH.EQS."AXP").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."") | ||
821 | $ THEN | ||
822 | $! | ||
823 | $! Looks Like DECC, Set To Use DECC. | ||
824 | $! | ||
825 | $ P3 = "DECC" | ||
826 | $! | ||
827 | $! Else... | ||
828 | $! | ||
829 | $ ELSE | ||
830 | $! | ||
831 | $! Looks Like VAXC, Set To Use VAXC. | ||
832 | $! | ||
833 | $ P3 = "VAXC" | ||
834 | $! | ||
835 | $! End The VAXC Compiler Check. | ||
836 | $! | ||
837 | $ ENDIF | ||
838 | $! | ||
839 | $! End The DECC & VAXC Compiler Check. | ||
840 | $! | ||
841 | $ ENDIF | ||
842 | $! | ||
843 | $! End The Compiler Check. | ||
844 | $! | ||
845 | $ ENDIF | ||
846 | $! | ||
847 | $! Set Up Initial CC Definitions, Possibly With User Ones | ||
848 | $! | ||
849 | $ CCDEFS = "VMS=1" | ||
850 | $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS | ||
851 | $ CCEXTRAFLAGS = "" | ||
852 | $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS | ||
853 | $ CCDISABLEWARNINGS = "" | ||
854 | $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN - | ||
855 | CCDISABLEWARNINGS = USER_CCDISABLEWARNINGS | ||
856 | $! | ||
857 | $! Check To See If The User Entered A Valid Paramter. | ||
858 | $! | ||
859 | $ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC") | ||
860 | $ THEN | ||
861 | $! | ||
862 | $! Check To See If The User Wanted DECC. | ||
863 | $! | ||
864 | $ IF (P3.EQS."DECC") | ||
865 | $ THEN | ||
866 | $! | ||
867 | $! Looks Like DECC, Set To Use DECC. | ||
868 | $! | ||
869 | $ COMPILER = "DECC" | ||
870 | $! | ||
871 | $! Tell The User We Are Using DECC. | ||
872 | $! | ||
873 | $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler." | ||
874 | $! | ||
875 | $! Use DECC... | ||
876 | $! | ||
877 | $ CC = "CC" | ||
878 | $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" - | ||
879 | THEN CC = "CC/DECC" | ||
880 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + - | ||
881 | "/NOLIST/PREFIX=ALL" + CCEXTRAFLAGS | ||
882 | $! | ||
883 | $! Define The Linker Options File Name. | ||
884 | $! | ||
885 | $ OPT_FILE = "SYS$DISK:[]VAX_DECC_OPTIONS.OPT" | ||
886 | $! | ||
887 | $! End DECC Check. | ||
888 | $! | ||
889 | $ ENDIF | ||
890 | $! | ||
891 | $! Check To See If We Are To Use VAXC. | ||
892 | $! | ||
893 | $ IF (P3.EQS."VAXC") | ||
894 | $ THEN | ||
895 | $! | ||
896 | $! Looks Like VAXC, Set To Use VAXC. | ||
897 | $! | ||
898 | $ COMPILER = "VAXC" | ||
899 | $! | ||
900 | $! Tell The User We Are Using VAX C. | ||
901 | $! | ||
902 | $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler." | ||
903 | $! | ||
904 | $! Compile Using VAXC. | ||
905 | $! | ||
906 | $ CC = "CC" | ||
907 | $ IF ARCH.EQS."AXP" | ||
908 | $ THEN | ||
909 | $ WRITE SYS$OUTPUT "There is no VAX C on Alpha!" | ||
910 | $ EXIT | ||
911 | $ ENDIF | ||
912 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" | ||
913 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + CCEXTRAFLAGS | ||
914 | $ CCDEFS = """VAXC""," + CCDEFS | ||
915 | $! | ||
916 | $! Define <sys> As SYS$COMMON:[SYSLIB] | ||
917 | $! | ||
918 | $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB] | ||
919 | $! | ||
920 | $! Define The Linker Options File Name. | ||
921 | $! | ||
922 | $ OPT_FILE = "SYS$DISK:[]VAX_VAXC_OPTIONS.OPT" | ||
923 | $! | ||
924 | $! End VAXC Check | ||
925 | $! | ||
926 | $ ENDIF | ||
927 | $! | ||
928 | $! Check To See If We Are To Use GNU C. | ||
929 | $! | ||
930 | $ IF (P3.EQS."GNUC") | ||
931 | $ THEN | ||
932 | $! | ||
933 | $! Looks Like GNUC, Set To Use GNUC. | ||
934 | $! | ||
935 | $ COMPILER = "GNUC" | ||
936 | $! | ||
937 | $! Tell The User We Are Using GNUC. | ||
938 | $! | ||
939 | $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler." | ||
940 | $! | ||
941 | $! Use GNU C... | ||
942 | $! | ||
943 | $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + CCEXTRAFLAGS | ||
944 | $! | ||
945 | $! Define The Linker Options File Name. | ||
946 | $! | ||
947 | $ OPT_FILE = "SYS$DISK:[]VAX_GNUC_OPTIONS.OPT" | ||
948 | $! | ||
949 | $! End The GNU C Check. | ||
950 | $! | ||
951 | $ ENDIF | ||
952 | $! | ||
953 | $! Set up default defines | ||
954 | $! | ||
955 | $ CCDEFS = """FLAT_INC=1""," + CCDEFS | ||
956 | $! | ||
957 | $! Finish up the definition of CC. | ||
958 | $! | ||
959 | $ IF COMPILER .EQS. "DECC" | ||
960 | $ THEN | ||
961 | $ IF CCDISABLEWARNINGS .EQS. "" | ||
962 | $ THEN | ||
963 | $ CC4DISABLEWARNINGS = "DOLLARID" | ||
964 | $ ELSE | ||
965 | $ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID" | ||
966 | $ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))" | ||
967 | $ ENDIF | ||
968 | $ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))" | ||
969 | $ ELSE | ||
970 | $ CCDISABLEWARNINGS = "" | ||
971 | $ CC4DISABLEWARNINGS = "" | ||
972 | $ ENDIF | ||
973 | $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS | ||
974 | $! | ||
975 | $! Show user the result | ||
976 | $! | ||
977 | $ WRITE SYS$OUTPUT "Main Compiling Command: ",CC | ||
978 | $! | ||
979 | $! Else The User Entered An Invalid Arguement. | ||
980 | $! | ||
981 | $ ELSE | ||
982 | $! | ||
983 | $! Tell The User We Don't Know What They Want. | ||
984 | $! | ||
985 | $ WRITE SYS$OUTPUT "" | ||
986 | $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:" | ||
987 | $ WRITE SYS$OUTPUT "" | ||
988 | $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C." | ||
989 | $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C." | ||
990 | $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C." | ||
991 | $ WRITE SYS$OUTPUT "" | ||
992 | $! | ||
993 | $! Time To EXIT. | ||
994 | $! | ||
995 | $ EXIT | ||
996 | $! | ||
997 | $! End The P3 Check. | ||
998 | $! | ||
999 | $ ENDIF | ||
1000 | $! | ||
1001 | $! Time To RETURN... | ||
1002 | $! | ||
1003 | $ RETURN | ||
diff --git a/src/lib/libcrypto/des/des.pod b/src/lib/libcrypto/des/des.pod new file mode 100644 index 0000000000..bf479e83d2 --- /dev/null +++ b/src/lib/libcrypto/des/des.pod | |||
@@ -0,0 +1,217 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | des - encrypt or decrypt data using Data Encryption Standard | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<des> | ||
10 | ( | ||
11 | B<-e> | ||
12 | | | ||
13 | B<-E> | ||
14 | ) | ( | ||
15 | B<-d> | ||
16 | | | ||
17 | B<-D> | ||
18 | ) | ( | ||
19 | B<->[B<cC>][B<ckname>] | ||
20 | ) | | ||
21 | [ | ||
22 | B<-b3hfs> | ||
23 | ] [ | ||
24 | B<-k> | ||
25 | I<key> | ||
26 | ] | ||
27 | ] [ | ||
28 | B<-u>[I<uuname>] | ||
29 | [ | ||
30 | I<input-file> | ||
31 | [ | ||
32 | I<output-file> | ||
33 | ] ] | ||
34 | |||
35 | =head1 NOTE | ||
36 | |||
37 | This page describes the B<des> stand-alone program, not the B<openssl des> | ||
38 | command. | ||
39 | |||
40 | =head1 DESCRIPTION | ||
41 | |||
42 | B<des> | ||
43 | encrypts and decrypts data using the | ||
44 | Data Encryption Standard algorithm. | ||
45 | One of | ||
46 | B<-e>, B<-E> | ||
47 | (for encrypt) or | ||
48 | B<-d>, B<-D> | ||
49 | (for decrypt) must be specified. | ||
50 | It is also possible to use | ||
51 | B<-c> | ||
52 | or | ||
53 | B<-C> | ||
54 | in conjunction or instead of the a encrypt/decrypt option to generate | ||
55 | a 16 character hexadecimal checksum, generated via the | ||
56 | I<des_cbc_cksum>. | ||
57 | |||
58 | Two standard encryption modes are supported by the | ||
59 | B<des> | ||
60 | program, Cipher Block Chaining (the default) and Electronic Code Book | ||
61 | (specified with | ||
62 | B<-b>). | ||
63 | |||
64 | The key used for the DES | ||
65 | algorithm is obtained by prompting the user unless the | ||
66 | B<-k> | ||
67 | I<key> | ||
68 | option is given. | ||
69 | If the key is an argument to the | ||
70 | B<des> | ||
71 | command, it is potentially visible to users executing | ||
72 | ps(1) | ||
73 | or a derivative. To minimise this possibility, | ||
74 | B<des> | ||
75 | takes care to destroy the key argument immediately upon entry. | ||
76 | If your shell keeps a history file be careful to make sure it is not | ||
77 | world readable. | ||
78 | |||
79 | Since this program attempts to maintain compatibility with sunOS's | ||
80 | des(1) command, there are 2 different methods used to convert the user | ||
81 | supplied key to a des key. | ||
82 | Whenever and one or more of | ||
83 | B<-E>, B<-D>, B<-C> | ||
84 | or | ||
85 | B<-3> | ||
86 | options are used, the key conversion procedure will not be compatible | ||
87 | with the sunOS des(1) version but will use all the user supplied | ||
88 | character to generate the des key. | ||
89 | B<des> | ||
90 | command reads from standard input unless | ||
91 | I<input-file> | ||
92 | is specified and writes to standard output unless | ||
93 | I<output-file> | ||
94 | is given. | ||
95 | |||
96 | =head1 OPTIONS | ||
97 | |||
98 | =over 4 | ||
99 | |||
100 | =item B<-b> | ||
101 | |||
102 | Select ECB | ||
103 | (eight bytes at a time) encryption mode. | ||
104 | |||
105 | =item B<-3> | ||
106 | |||
107 | Encrypt using triple encryption. | ||
108 | By default triple cbc encryption is used but if the | ||
109 | B<-b> | ||
110 | option is used then triple ECB encryption is performed. | ||
111 | If the key is less than 8 characters long, the flag has no effect. | ||
112 | |||
113 | =item B<-e> | ||
114 | |||
115 | Encrypt data using an 8 byte key in a manner compatible with sunOS | ||
116 | des(1). | ||
117 | |||
118 | =item B<-E> | ||
119 | |||
120 | Encrypt data using a key of nearly unlimited length (1024 bytes). | ||
121 | This will product a more secure encryption. | ||
122 | |||
123 | =item B<-d> | ||
124 | |||
125 | Decrypt data that was encrypted with the B<-e> option. | ||
126 | |||
127 | =item B<-D> | ||
128 | |||
129 | Decrypt data that was encrypted with the B<-E> option. | ||
130 | |||
131 | =item B<-c> | ||
132 | |||
133 | Generate a 16 character hexadecimal cbc checksum and output this to | ||
134 | stderr. | ||
135 | If a filename was specified after the | ||
136 | B<-c> | ||
137 | option, the checksum is output to that file. | ||
138 | The checksum is generated using a key generated in a sunOS compatible | ||
139 | manner. | ||
140 | |||
141 | =item B<-C> | ||
142 | |||
143 | A cbc checksum is generated in the same manner as described for the | ||
144 | B<-c> | ||
145 | option but the DES key is generated in the same manner as used for the | ||
146 | B<-E> | ||
147 | and | ||
148 | B<-D> | ||
149 | options | ||
150 | |||
151 | =item B<-f> | ||
152 | |||
153 | Does nothing - allowed for compatibility with sunOS des(1) command. | ||
154 | |||
155 | =item B<-s> | ||
156 | |||
157 | Does nothing - allowed for compatibility with sunOS des(1) command. | ||
158 | |||
159 | =item B<-k> I<key> | ||
160 | |||
161 | Use the encryption | ||
162 | I<key> | ||
163 | specified. | ||
164 | |||
165 | =item B<-h> | ||
166 | |||
167 | The | ||
168 | I<key> | ||
169 | is assumed to be a 16 character hexadecimal number. | ||
170 | If the | ||
171 | B<-3> | ||
172 | option is used the key is assumed to be a 32 character hexadecimal | ||
173 | number. | ||
174 | |||
175 | =item B<-u> | ||
176 | |||
177 | This flag is used to read and write uuencoded files. If decrypting, | ||
178 | the input file is assumed to contain uuencoded, DES encrypted data. | ||
179 | If encrypting, the characters following the B<-u> are used as the name of | ||
180 | the uuencoded file to embed in the begin line of the uuencoded | ||
181 | output. If there is no name specified after the B<-u>, the name text.des | ||
182 | will be embedded in the header. | ||
183 | |||
184 | =head1 SEE ALSO | ||
185 | |||
186 | ps(1), | ||
187 | L<des_crypt(3)|des_crypt(3)> | ||
188 | |||
189 | =head1 BUGS | ||
190 | |||
191 | The problem with using the | ||
192 | B<-e> | ||
193 | option is the short key length. | ||
194 | It would be better to use a real 56-bit key rather than an | ||
195 | ASCII-based 56-bit pattern. Knowing that the key was derived from ASCII | ||
196 | radically reduces the time necessary for a brute-force cryptographic attack. | ||
197 | My attempt to remove this problem is to add an alternative text-key to | ||
198 | DES-key function. This alternative function (accessed via | ||
199 | B<-E>, B<-D>, B<-S> | ||
200 | and | ||
201 | B<-3>) | ||
202 | uses DES to help generate the key. | ||
203 | |||
204 | Be carefully when using the B<-u> option. Doing B<des -ud> I<filename> will | ||
205 | not decrypt filename (the B<-u> option will gobble the B<-d> option). | ||
206 | |||
207 | The VMS operating system operates in a world where files are always a | ||
208 | multiple of 512 bytes. This causes problems when encrypted data is | ||
209 | send from Unix to VMS since a 88 byte file will suddenly be padded | ||
210 | with 424 null bytes. To get around this problem, use the B<-u> option | ||
211 | to uuencode the data before it is send to the VMS system. | ||
212 | |||
213 | =head1 AUTHOR | ||
214 | |||
215 | Eric Young (eay@cryptsoft.com) | ||
216 | |||
217 | =cut | ||
diff --git a/src/lib/libcrypto/des/des_old.c b/src/lib/libcrypto/des/des_old.c new file mode 100644 index 0000000000..7e4cd7180d --- /dev/null +++ b/src/lib/libcrypto/des/des_old.c | |||
@@ -0,0 +1,271 @@ | |||
1 | /* crypto/des/des_old.c -*- mode:C; c-file-style: "eay" -*- */ | ||
2 | |||
3 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
4 | * | ||
5 | * The function names in here are deprecated and are only present to | ||
6 | * provide an interface compatible with libdes. OpenSSL now provides | ||
7 | * functions where "des_" has been replaced with "DES_" in the names, | ||
8 | * to make it possible to make incompatible changes that are needed | ||
9 | * for C type security and other stuff. | ||
10 | * | ||
11 | * Please consider starting to use the DES_ functions rather than the | ||
12 | * des_ ones. The des_ functions will dissapear completely before | ||
13 | * OpenSSL 1.0! | ||
14 | * | ||
15 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
16 | */ | ||
17 | |||
18 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
19 | * project 2001. | ||
20 | */ | ||
21 | /* ==================================================================== | ||
22 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. | ||
23 | * | ||
24 | * Redistribution and use in source and binary forms, with or without | ||
25 | * modification, are permitted provided that the following conditions | ||
26 | * are met: | ||
27 | * | ||
28 | * 1. Redistributions of source code must retain the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer. | ||
30 | * | ||
31 | * 2. Redistributions in binary form must reproduce the above copyright | ||
32 | * notice, this list of conditions and the following disclaimer in | ||
33 | * the documentation and/or other materials provided with the | ||
34 | * distribution. | ||
35 | * | ||
36 | * 3. All advertising materials mentioning features or use of this | ||
37 | * software must display the following acknowledgment: | ||
38 | * "This product includes software developed by the OpenSSL Project | ||
39 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
40 | * | ||
41 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
42 | * endorse or promote products derived from this software without | ||
43 | * prior written permission. For written permission, please contact | ||
44 | * openssl-core@openssl.org. | ||
45 | * | ||
46 | * 5. Products derived from this software may not be called "OpenSSL" | ||
47 | * nor may "OpenSSL" appear in their names without prior written | ||
48 | * permission of the OpenSSL Project. | ||
49 | * | ||
50 | * 6. Redistributions of any form whatsoever must retain the following | ||
51 | * acknowledgment: | ||
52 | * "This product includes software developed by the OpenSSL Project | ||
53 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
54 | * | ||
55 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
56 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
57 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
58 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
59 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
60 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
61 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
62 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
63 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
64 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
66 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
67 | * ==================================================================== | ||
68 | * | ||
69 | * This product includes cryptographic software written by Eric Young | ||
70 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
71 | * Hudson (tjh@cryptsoft.com). | ||
72 | * | ||
73 | */ | ||
74 | |||
75 | #define OPENSSL_DES_LIBDES_COMPATIBILITY | ||
76 | #include <openssl/des.h> | ||
77 | #include <openssl/rand.h> | ||
78 | |||
79 | const char *_ossl_old_des_options(void) | ||
80 | { | ||
81 | return DES_options(); | ||
82 | } | ||
83 | void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
84 | des_key_schedule ks1,des_key_schedule ks2, | ||
85 | des_key_schedule ks3, int enc) | ||
86 | { | ||
87 | DES_ecb3_encrypt((const_DES_cblock *)input, output, | ||
88 | (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
89 | (DES_key_schedule *)ks3, enc); | ||
90 | } | ||
91 | DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
92 | long length,des_key_schedule schedule,_ossl_old_des_cblock *ivec) | ||
93 | { | ||
94 | return DES_cbc_cksum((unsigned char *)input, output, length, | ||
95 | (DES_key_schedule *)schedule, ivec); | ||
96 | } | ||
97 | void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
98 | des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc) | ||
99 | { | ||
100 | DES_cbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
101 | length, (DES_key_schedule *)schedule, ivec, enc); | ||
102 | } | ||
103 | void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
104 | des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc) | ||
105 | { | ||
106 | DES_ncbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
107 | length, (DES_key_schedule *)schedule, ivec, enc); | ||
108 | } | ||
109 | void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
110 | des_key_schedule schedule,_ossl_old_des_cblock *ivec, | ||
111 | _ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc) | ||
112 | { | ||
113 | DES_xcbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
114 | length, (DES_key_schedule *)schedule, ivec, inw, outw, enc); | ||
115 | } | ||
116 | void _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, | ||
117 | long length,des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc) | ||
118 | { | ||
119 | DES_cfb_encrypt(in, out, numbits, length, | ||
120 | (DES_key_schedule *)schedule, ivec, enc); | ||
121 | } | ||
122 | void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
123 | des_key_schedule ks,int enc) | ||
124 | { | ||
125 | DES_ecb_encrypt(input, output, (DES_key_schedule *)ks, enc); | ||
126 | } | ||
127 | void _ossl_old_des_encrypt(DES_LONG *data,des_key_schedule ks, int enc) | ||
128 | { | ||
129 | DES_encrypt1(data, (DES_key_schedule *)ks, enc); | ||
130 | } | ||
131 | void _ossl_old_des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc) | ||
132 | { | ||
133 | DES_encrypt2(data, (DES_key_schedule *)ks, enc); | ||
134 | } | ||
135 | void _ossl_old_des_encrypt3(DES_LONG *data, des_key_schedule ks1, | ||
136 | des_key_schedule ks2, des_key_schedule ks3) | ||
137 | { | ||
138 | DES_encrypt3(data, (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
139 | (DES_key_schedule *)ks3); | ||
140 | } | ||
141 | void _ossl_old_des_decrypt3(DES_LONG *data, des_key_schedule ks1, | ||
142 | des_key_schedule ks2, des_key_schedule ks3) | ||
143 | { | ||
144 | DES_decrypt3(data, (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
145 | (DES_key_schedule *)ks3); | ||
146 | } | ||
147 | void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, | ||
148 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
149 | des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc) | ||
150 | { | ||
151 | DES_ede3_cbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
152 | length, (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
153 | (DES_key_schedule *)ks3, ivec, enc); | ||
154 | } | ||
155 | void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, | ||
156 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
157 | des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc) | ||
158 | { | ||
159 | DES_ede3_cfb64_encrypt(in, out, length, | ||
160 | (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
161 | (DES_key_schedule *)ks3, ivec, num, enc); | ||
162 | } | ||
163 | void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, | ||
164 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
165 | des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num) | ||
166 | { | ||
167 | DES_ede3_ofb64_encrypt(in, out, length, | ||
168 | (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
169 | (DES_key_schedule *)ks3, ivec, num); | ||
170 | } | ||
171 | |||
172 | void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white), | ||
173 | _ossl_old_des_cblock (*out_white)) | ||
174 | { | ||
175 | DES_xwhite_in2out(des_key, in_white, out_white); | ||
176 | } | ||
177 | |||
178 | int _ossl_old_des_enc_read(int fd,char *buf,int len,des_key_schedule sched, | ||
179 | _ossl_old_des_cblock *iv) | ||
180 | { | ||
181 | return DES_enc_read(fd, buf, len, (DES_key_schedule *)sched, iv); | ||
182 | } | ||
183 | int _ossl_old_des_enc_write(int fd,char *buf,int len,des_key_schedule sched, | ||
184 | _ossl_old_des_cblock *iv) | ||
185 | { | ||
186 | return DES_enc_write(fd, buf, len, (DES_key_schedule *)sched, iv); | ||
187 | } | ||
188 | char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret) | ||
189 | { | ||
190 | return DES_fcrypt(buf, salt, ret); | ||
191 | } | ||
192 | char *_ossl_old_des_crypt(const char *buf,const char *salt) | ||
193 | { | ||
194 | return DES_crypt(buf, salt); | ||
195 | } | ||
196 | char *_ossl_old_crypt(const char *buf,const char *salt) | ||
197 | { | ||
198 | return DES_crypt(buf, salt); | ||
199 | } | ||
200 | void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out, | ||
201 | int numbits,long length,des_key_schedule schedule,_ossl_old_des_cblock *ivec) | ||
202 | { | ||
203 | DES_ofb_encrypt(in, out, numbits, length, (DES_key_schedule *)schedule, | ||
204 | ivec); | ||
205 | } | ||
206 | void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
207 | des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc) | ||
208 | { | ||
209 | DES_pcbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
210 | length, (DES_key_schedule *)schedule, ivec, enc); | ||
211 | } | ||
212 | DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
213 | long length,int out_count,_ossl_old_des_cblock *seed) | ||
214 | { | ||
215 | return DES_quad_cksum((unsigned char *)input, output, length, | ||
216 | out_count, seed); | ||
217 | } | ||
218 | void _ossl_old_des_random_seed(_ossl_old_des_cblock key) | ||
219 | { | ||
220 | RAND_seed(key, sizeof(_ossl_old_des_cblock)); | ||
221 | } | ||
222 | void _ossl_old_des_random_key(_ossl_old_des_cblock ret) | ||
223 | { | ||
224 | DES_random_key((DES_cblock *)ret); | ||
225 | } | ||
226 | int _ossl_old_des_read_password(_ossl_old_des_cblock *key, const char *prompt, | ||
227 | int verify) | ||
228 | { | ||
229 | return DES_read_password(key, prompt, verify); | ||
230 | } | ||
231 | int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1, _ossl_old_des_cblock *key2, | ||
232 | const char *prompt, int verify) | ||
233 | { | ||
234 | return DES_read_2passwords(key1, key2, prompt, verify); | ||
235 | } | ||
236 | void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key) | ||
237 | { | ||
238 | DES_set_odd_parity(key); | ||
239 | } | ||
240 | int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key) | ||
241 | { | ||
242 | return DES_is_weak_key(key); | ||
243 | } | ||
244 | int _ossl_old_des_set_key(_ossl_old_des_cblock *key,des_key_schedule schedule) | ||
245 | { | ||
246 | return DES_set_key(key, (DES_key_schedule *)schedule); | ||
247 | } | ||
248 | int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,des_key_schedule schedule) | ||
249 | { | ||
250 | return DES_key_sched(key, (DES_key_schedule *)schedule); | ||
251 | } | ||
252 | void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key) | ||
253 | { | ||
254 | DES_string_to_key(str, key); | ||
255 | } | ||
256 | void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2) | ||
257 | { | ||
258 | DES_string_to_2keys(str, key1, key2); | ||
259 | } | ||
260 | void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
261 | des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc) | ||
262 | { | ||
263 | DES_cfb64_encrypt(in, out, length, (DES_key_schedule *)schedule, | ||
264 | ivec, num, enc); | ||
265 | } | ||
266 | void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
267 | des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num) | ||
268 | { | ||
269 | DES_ofb64_encrypt(in, out, length, (DES_key_schedule *)schedule, | ||
270 | ivec, num); | ||
271 | } | ||
diff --git a/src/lib/libcrypto/des/des_old.h b/src/lib/libcrypto/des/des_old.h new file mode 100644 index 0000000000..3778f93c15 --- /dev/null +++ b/src/lib/libcrypto/des/des_old.h | |||
@@ -0,0 +1,437 @@ | |||
1 | /* crypto/des/des_old.h -*- mode:C; c-file-style: "eay" -*- */ | ||
2 | |||
3 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
4 | * | ||
5 | * The function names in here are deprecated and are only present to | ||
6 | * provide an interface compatible with openssl 0.9.6 and older as | ||
7 | * well as libdes. OpenSSL now provides functions where "des_" has | ||
8 | * been replaced with "DES_" in the names, to make it possible to | ||
9 | * make incompatible changes that are needed for C type security and | ||
10 | * other stuff. | ||
11 | * | ||
12 | * This include files has two compatibility modes: | ||
13 | * | ||
14 | * - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API | ||
15 | * that is compatible with libdes and SSLeay. | ||
16 | * - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an | ||
17 | * API that is compatible with OpenSSL 0.9.5x to 0.9.6x. | ||
18 | * | ||
19 | * Note that these modes break earlier snapshots of OpenSSL, where | ||
20 | * libdes compatibility was the only available mode or (later on) the | ||
21 | * prefered compatibility mode. However, after much consideration | ||
22 | * (and more or less violent discussions with external parties), it | ||
23 | * was concluded that OpenSSL should be compatible with earlier versions | ||
24 | * of itself before anything else. Also, in all honesty, libdes is | ||
25 | * an old beast that shouldn't really be used any more. | ||
26 | * | ||
27 | * Please consider starting to use the DES_ functions rather than the | ||
28 | * des_ ones. The des_ functions will disappear completely before | ||
29 | * OpenSSL 1.0! | ||
30 | * | ||
31 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
32 | */ | ||
33 | |||
34 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
35 | * project 2001. | ||
36 | */ | ||
37 | /* ==================================================================== | ||
38 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | ||
39 | * | ||
40 | * Redistribution and use in source and binary forms, with or without | ||
41 | * modification, are permitted provided that the following conditions | ||
42 | * are met: | ||
43 | * | ||
44 | * 1. Redistributions of source code must retain the above copyright | ||
45 | * notice, this list of conditions and the following disclaimer. | ||
46 | * | ||
47 | * 2. Redistributions in binary form must reproduce the above copyright | ||
48 | * notice, this list of conditions and the following disclaimer in | ||
49 | * the documentation and/or other materials provided with the | ||
50 | * distribution. | ||
51 | * | ||
52 | * 3. All advertising materials mentioning features or use of this | ||
53 | * software must display the following acknowledgment: | ||
54 | * "This product includes software developed by the OpenSSL Project | ||
55 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
56 | * | ||
57 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
58 | * endorse or promote products derived from this software without | ||
59 | * prior written permission. For written permission, please contact | ||
60 | * openssl-core@openssl.org. | ||
61 | * | ||
62 | * 5. Products derived from this software may not be called "OpenSSL" | ||
63 | * nor may "OpenSSL" appear in their names without prior written | ||
64 | * permission of the OpenSSL Project. | ||
65 | * | ||
66 | * 6. Redistributions of any form whatsoever must retain the following | ||
67 | * acknowledgment: | ||
68 | * "This product includes software developed by the OpenSSL Project | ||
69 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
70 | * | ||
71 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
72 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
73 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
74 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
75 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
76 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
77 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
78 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
79 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
80 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
81 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
82 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
83 | * ==================================================================== | ||
84 | * | ||
85 | * This product includes cryptographic software written by Eric Young | ||
86 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
87 | * Hudson (tjh@cryptsoft.com). | ||
88 | * | ||
89 | */ | ||
90 | |||
91 | #ifndef HEADER_DES_OLD_H | ||
92 | #define HEADER_DES_OLD_H | ||
93 | |||
94 | #ifdef OPENSSL_NO_DES | ||
95 | #error DES is disabled. | ||
96 | #endif | ||
97 | |||
98 | #ifndef HEADER_DES_H | ||
99 | #error You must include des.h, not des_old.h directly. | ||
100 | #endif | ||
101 | |||
102 | #ifdef _KERBEROS_DES_H | ||
103 | #error <openssl/des_old.h> replaces <kerberos/des.h>. | ||
104 | #endif | ||
105 | |||
106 | #include <openssl/opensslconf.h> /* DES_LONG */ | ||
107 | #include <openssl/e_os2.h> /* OPENSSL_EXTERN */ | ||
108 | #include <openssl/symhacks.h> | ||
109 | |||
110 | #ifdef OPENSSL_BUILD_SHLIBCRYPTO | ||
111 | # undef OPENSSL_EXTERN | ||
112 | # define OPENSSL_EXTERN OPENSSL_EXPORT | ||
113 | #endif | ||
114 | |||
115 | #ifdef __cplusplus | ||
116 | extern "C" { | ||
117 | #endif | ||
118 | |||
119 | typedef unsigned char _ossl_old_des_cblock[8]; | ||
120 | typedef struct _ossl_old_des_ks_struct | ||
121 | { | ||
122 | union { | ||
123 | _ossl_old_des_cblock _; | ||
124 | /* make sure things are correct size on machines with | ||
125 | * 8 byte longs */ | ||
126 | DES_LONG pad[2]; | ||
127 | } ks; | ||
128 | } _ossl_old_des_key_schedule[16]; | ||
129 | |||
130 | #ifndef OPENSSL_DES_LIBDES_COMPATIBILITY | ||
131 | #define des_cblock DES_cblock | ||
132 | #define const_des_cblock const_DES_cblock | ||
133 | #define des_key_schedule DES_key_schedule | ||
134 | #define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ | ||
135 | DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e)) | ||
136 | #define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ | ||
137 | DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e)) | ||
138 | #define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\ | ||
139 | DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e)) | ||
140 | #define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ | ||
141 | DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e)) | ||
142 | #define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ | ||
143 | DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n)) | ||
144 | #define des_options()\ | ||
145 | DES_options() | ||
146 | #define des_cbc_cksum(i,o,l,k,iv)\ | ||
147 | DES_cbc_cksum((i),(o),(l),&(k),(iv)) | ||
148 | #define des_cbc_encrypt(i,o,l,k,iv,e)\ | ||
149 | DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e)) | ||
150 | #define des_ncbc_encrypt(i,o,l,k,iv,e)\ | ||
151 | DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e)) | ||
152 | #define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ | ||
153 | DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e)) | ||
154 | #define des_cfb_encrypt(i,o,n,l,k,iv,e)\ | ||
155 | DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e)) | ||
156 | #define des_ecb_encrypt(i,o,k,e)\ | ||
157 | DES_ecb_encrypt((i),(o),&(k),(e)) | ||
158 | #define des_encrypt1(d,k,e)\ | ||
159 | DES_encrypt1((d),&(k),(e)) | ||
160 | #define des_encrypt2(d,k,e)\ | ||
161 | DES_encrypt2((d),&(k),(e)) | ||
162 | #define des_encrypt3(d,k1,k2,k3)\ | ||
163 | DES_encrypt3((d),&(k1),&(k2),&(k3)) | ||
164 | #define des_decrypt3(d,k1,k2,k3)\ | ||
165 | DES_decrypt3((d),&(k1),&(k2),&(k3)) | ||
166 | #define des_xwhite_in2out(k,i,o)\ | ||
167 | DES_xwhite_in2out((k),(i),(o)) | ||
168 | #define des_enc_read(f,b,l,k,iv)\ | ||
169 | DES_enc_read((f),(b),(l),&(k),(iv)) | ||
170 | #define des_enc_write(f,b,l,k,iv)\ | ||
171 | DES_enc_write((f),(b),(l),&(k),(iv)) | ||
172 | #define des_fcrypt(b,s,r)\ | ||
173 | DES_fcrypt((b),(s),(r)) | ||
174 | #define des_crypt(b,s)\ | ||
175 | DES_crypt((b),(s)) | ||
176 | #if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) | ||
177 | #define crypt(b,s)\ | ||
178 | DES_crypt((b),(s)) | ||
179 | #endif | ||
180 | #define des_ofb_encrypt(i,o,n,l,k,iv)\ | ||
181 | DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv)) | ||
182 | #define des_pcbc_encrypt(i,o,l,k,iv,e)\ | ||
183 | DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e)) | ||
184 | #define des_quad_cksum(i,o,l,c,s)\ | ||
185 | DES_quad_cksum((i),(o),(l),(c),(s)) | ||
186 | #define des_random_seed(k)\ | ||
187 | _ossl_096_des_random_seed((k)) | ||
188 | #define des_random_key(r)\ | ||
189 | DES_random_key((r)) | ||
190 | #define des_read_password(k,p,v) \ | ||
191 | DES_read_password((k),(p),(v)) | ||
192 | #define des_read_2passwords(k1,k2,p,v) \ | ||
193 | DES_read_2passwords((k1),(k2),(p),(v)) | ||
194 | #define des_set_odd_parity(k)\ | ||
195 | DES_set_odd_parity((k)) | ||
196 | #define des_check_key_parity(k)\ | ||
197 | DES_check_key_parity((k)) | ||
198 | #define des_is_weak_key(k)\ | ||
199 | DES_is_weak_key((k)) | ||
200 | #define des_set_key(k,ks)\ | ||
201 | DES_set_key((k),&(ks)) | ||
202 | #define des_key_sched(k,ks)\ | ||
203 | DES_key_sched((k),&(ks)) | ||
204 | #define des_set_key_checked(k,ks)\ | ||
205 | DES_set_key_checked((k),&(ks)) | ||
206 | #define des_set_key_unchecked(k,ks)\ | ||
207 | DES_set_key_unchecked((k),&(ks)) | ||
208 | #define des_string_to_key(s,k)\ | ||
209 | DES_string_to_key((s),(k)) | ||
210 | #define des_string_to_2keys(s,k1,k2)\ | ||
211 | DES_string_to_2keys((s),(k1),(k2)) | ||
212 | #define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ | ||
213 | DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e)) | ||
214 | #define des_ofb64_encrypt(i,o,l,ks,iv,n)\ | ||
215 | DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n)) | ||
216 | |||
217 | |||
218 | #define des_ecb2_encrypt(i,o,k1,k2,e) \ | ||
219 | des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) | ||
220 | |||
221 | #define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ | ||
222 | des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) | ||
223 | |||
224 | #define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ | ||
225 | des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) | ||
226 | |||
227 | #define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ | ||
228 | des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) | ||
229 | |||
230 | #define des_check_key DES_check_key | ||
231 | #define des_rw_mode DES_rw_mode | ||
232 | #else /* libdes compatibility */ | ||
233 | /* Map all symbol names to _ossl_old_des_* form, so we avoid all | ||
234 | clashes with libdes */ | ||
235 | #define des_cblock _ossl_old_des_cblock | ||
236 | #define des_key_schedule _ossl_old_des_key_schedule | ||
237 | #define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ | ||
238 | _ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e)) | ||
239 | #define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ | ||
240 | _ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e)) | ||
241 | #define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ | ||
242 | _ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e)) | ||
243 | #define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ | ||
244 | _ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n)) | ||
245 | #define des_options()\ | ||
246 | _ossl_old_des_options() | ||
247 | #define des_cbc_cksum(i,o,l,k,iv)\ | ||
248 | _ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv)) | ||
249 | #define des_cbc_encrypt(i,o,l,k,iv,e)\ | ||
250 | _ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e)) | ||
251 | #define des_ncbc_encrypt(i,o,l,k,iv,e)\ | ||
252 | _ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e)) | ||
253 | #define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ | ||
254 | _ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e)) | ||
255 | #define des_cfb_encrypt(i,o,n,l,k,iv,e)\ | ||
256 | _ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e)) | ||
257 | #define des_ecb_encrypt(i,o,k,e)\ | ||
258 | _ossl_old_des_ecb_encrypt((i),(o),(k),(e)) | ||
259 | #define des_encrypt(d,k,e)\ | ||
260 | _ossl_old_des_encrypt((d),(k),(e)) | ||
261 | #define des_encrypt2(d,k,e)\ | ||
262 | _ossl_old_des_encrypt2((d),(k),(e)) | ||
263 | #define des_encrypt3(d,k1,k2,k3)\ | ||
264 | _ossl_old_des_encrypt3((d),(k1),(k2),(k3)) | ||
265 | #define des_decrypt3(d,k1,k2,k3)\ | ||
266 | _ossl_old_des_decrypt3((d),(k1),(k2),(k3)) | ||
267 | #define des_xwhite_in2out(k,i,o)\ | ||
268 | _ossl_old_des_xwhite_in2out((k),(i),(o)) | ||
269 | #define des_enc_read(f,b,l,k,iv)\ | ||
270 | _ossl_old_des_enc_read((f),(b),(l),(k),(iv)) | ||
271 | #define des_enc_write(f,b,l,k,iv)\ | ||
272 | _ossl_old_des_enc_write((f),(b),(l),(k),(iv)) | ||
273 | #define des_fcrypt(b,s,r)\ | ||
274 | _ossl_old_des_fcrypt((b),(s),(r)) | ||
275 | #define des_crypt(b,s)\ | ||
276 | _ossl_old_des_crypt((b),(s)) | ||
277 | #define crypt(b,s)\ | ||
278 | _ossl_old_crypt((b),(s)) | ||
279 | #define des_ofb_encrypt(i,o,n,l,k,iv)\ | ||
280 | _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv)) | ||
281 | #define des_pcbc_encrypt(i,o,l,k,iv,e)\ | ||
282 | _ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e)) | ||
283 | #define des_quad_cksum(i,o,l,c,s)\ | ||
284 | _ossl_old_des_quad_cksum((i),(o),(l),(c),(s)) | ||
285 | #define des_random_seed(k)\ | ||
286 | _ossl_old_des_random_seed((k)) | ||
287 | #define des_random_key(r)\ | ||
288 | _ossl_old_des_random_key((r)) | ||
289 | #define des_read_password(k,p,v) \ | ||
290 | _ossl_old_des_read_password((k),(p),(v)) | ||
291 | #define des_read_2passwords(k1,k2,p,v) \ | ||
292 | _ossl_old_des_read_2passwords((k1),(k2),(p),(v)) | ||
293 | #define des_set_odd_parity(k)\ | ||
294 | _ossl_old_des_set_odd_parity((k)) | ||
295 | #define des_is_weak_key(k)\ | ||
296 | _ossl_old_des_is_weak_key((k)) | ||
297 | #define des_set_key(k,ks)\ | ||
298 | _ossl_old_des_set_key((k),(ks)) | ||
299 | #define des_key_sched(k,ks)\ | ||
300 | _ossl_old_des_key_sched((k),(ks)) | ||
301 | #define des_string_to_key(s,k)\ | ||
302 | _ossl_old_des_string_to_key((s),(k)) | ||
303 | #define des_string_to_2keys(s,k1,k2)\ | ||
304 | _ossl_old_des_string_to_2keys((s),(k1),(k2)) | ||
305 | #define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ | ||
306 | _ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e)) | ||
307 | #define des_ofb64_encrypt(i,o,l,ks,iv,n)\ | ||
308 | _ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n)) | ||
309 | |||
310 | |||
311 | #define des_ecb2_encrypt(i,o,k1,k2,e) \ | ||
312 | des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) | ||
313 | |||
314 | #define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ | ||
315 | des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) | ||
316 | |||
317 | #define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ | ||
318 | des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) | ||
319 | |||
320 | #define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ | ||
321 | des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) | ||
322 | |||
323 | #define des_check_key DES_check_key | ||
324 | #define des_rw_mode DES_rw_mode | ||
325 | #endif | ||
326 | |||
327 | const char *_ossl_old_des_options(void); | ||
328 | void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
329 | _ossl_old_des_key_schedule ks1,_ossl_old_des_key_schedule ks2, | ||
330 | _ossl_old_des_key_schedule ks3, int enc); | ||
331 | DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
332 | long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec); | ||
333 | void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
334 | _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); | ||
335 | void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
336 | _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); | ||
337 | void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
338 | _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec, | ||
339 | _ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc); | ||
340 | void _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, | ||
341 | long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); | ||
342 | void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
343 | _ossl_old_des_key_schedule ks,int enc); | ||
344 | void _ossl_old_des_encrypt(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc); | ||
345 | void _ossl_old_des_encrypt2(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc); | ||
346 | void _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, | ||
347 | _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3); | ||
348 | void _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, | ||
349 | _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3); | ||
350 | void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, | ||
351 | long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, | ||
352 | _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc); | ||
353 | void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, | ||
354 | long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, | ||
355 | _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc); | ||
356 | void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, | ||
357 | long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, | ||
358 | _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num); | ||
359 | |||
360 | void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white), | ||
361 | _ossl_old_des_cblock (*out_white)); | ||
362 | |||
363 | int _ossl_old_des_enc_read(int fd,char *buf,int len,_ossl_old_des_key_schedule sched, | ||
364 | _ossl_old_des_cblock *iv); | ||
365 | int _ossl_old_des_enc_write(int fd,char *buf,int len,_ossl_old_des_key_schedule sched, | ||
366 | _ossl_old_des_cblock *iv); | ||
367 | char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret); | ||
368 | char *_ossl_old_des_crypt(const char *buf,const char *salt); | ||
369 | #if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) | ||
370 | char *_ossl_old_crypt(const char *buf,const char *salt); | ||
371 | #endif | ||
372 | void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out, | ||
373 | int numbits,long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec); | ||
374 | void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
375 | _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); | ||
376 | DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
377 | long length,int out_count,_ossl_old_des_cblock *seed); | ||
378 | void _ossl_old_des_random_seed(_ossl_old_des_cblock key); | ||
379 | void _ossl_old_des_random_key(_ossl_old_des_cblock ret); | ||
380 | int _ossl_old_des_read_password(_ossl_old_des_cblock *key,const char *prompt,int verify); | ||
381 | int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2, | ||
382 | const char *prompt,int verify); | ||
383 | void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key); | ||
384 | int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key); | ||
385 | int _ossl_old_des_set_key(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule); | ||
386 | int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule); | ||
387 | void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key); | ||
388 | void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2); | ||
389 | void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
390 | _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc); | ||
391 | void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
392 | _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num); | ||
393 | |||
394 | void _ossl_096_des_random_seed(des_cblock *key); | ||
395 | |||
396 | /* The following definitions provide compatibility with the MIT Kerberos | ||
397 | * library. The _ossl_old_des_key_schedule structure is not binary compatible. */ | ||
398 | |||
399 | #define _KERBEROS_DES_H | ||
400 | |||
401 | #define KRBDES_ENCRYPT DES_ENCRYPT | ||
402 | #define KRBDES_DECRYPT DES_DECRYPT | ||
403 | |||
404 | #ifdef KERBEROS | ||
405 | # define ENCRYPT DES_ENCRYPT | ||
406 | # define DECRYPT DES_DECRYPT | ||
407 | #endif | ||
408 | |||
409 | #ifndef NCOMPAT | ||
410 | # define C_Block des_cblock | ||
411 | # define Key_schedule des_key_schedule | ||
412 | # define KEY_SZ DES_KEY_SZ | ||
413 | # define string_to_key des_string_to_key | ||
414 | # define read_pw_string des_read_pw_string | ||
415 | # define random_key des_random_key | ||
416 | # define pcbc_encrypt des_pcbc_encrypt | ||
417 | # define set_key des_set_key | ||
418 | # define key_sched des_key_sched | ||
419 | # define ecb_encrypt des_ecb_encrypt | ||
420 | # define cbc_encrypt des_cbc_encrypt | ||
421 | # define ncbc_encrypt des_ncbc_encrypt | ||
422 | # define xcbc_encrypt des_xcbc_encrypt | ||
423 | # define cbc_cksum des_cbc_cksum | ||
424 | # define quad_cksum des_quad_cksum | ||
425 | # define check_parity des_check_key_parity | ||
426 | #endif | ||
427 | |||
428 | #define des_fixup_key_parity DES_fixup_key_parity | ||
429 | |||
430 | #ifdef __cplusplus | ||
431 | } | ||
432 | #endif | ||
433 | |||
434 | /* for DES_read_pw_string et al */ | ||
435 | #include <openssl/ui_compat.h> | ||
436 | |||
437 | #endif | ||
diff --git a/src/lib/libcrypto/des/des_old2.c b/src/lib/libcrypto/des/des_old2.c new file mode 100644 index 0000000000..c8fa3ee135 --- /dev/null +++ b/src/lib/libcrypto/des/des_old2.c | |||
@@ -0,0 +1,82 @@ | |||
1 | /* crypto/des/des_old.c -*- mode:C; c-file-style: "eay" -*- */ | ||
2 | |||
3 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
4 | * | ||
5 | * The function names in here are deprecated and are only present to | ||
6 | * provide an interface compatible with OpenSSL 0.9.6c. OpenSSL now | ||
7 | * provides functions where "des_" has been replaced with "DES_" in | ||
8 | * the names, to make it possible to make incompatible changes that | ||
9 | * are needed for C type security and other stuff. | ||
10 | * | ||
11 | * Please consider starting to use the DES_ functions rather than the | ||
12 | * des_ ones. The des_ functions will dissapear completely before | ||
13 | * OpenSSL 1.0! | ||
14 | * | ||
15 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
16 | */ | ||
17 | |||
18 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
19 | * project 2001. | ||
20 | */ | ||
21 | /* ==================================================================== | ||
22 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. | ||
23 | * | ||
24 | * Redistribution and use in source and binary forms, with or without | ||
25 | * modification, are permitted provided that the following conditions | ||
26 | * are met: | ||
27 | * | ||
28 | * 1. Redistributions of source code must retain the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer. | ||
30 | * | ||
31 | * 2. Redistributions in binary form must reproduce the above copyright | ||
32 | * notice, this list of conditions and the following disclaimer in | ||
33 | * the documentation and/or other materials provided with the | ||
34 | * distribution. | ||
35 | * | ||
36 | * 3. All advertising materials mentioning features or use of this | ||
37 | * software must display the following acknowledgment: | ||
38 | * "This product includes software developed by the OpenSSL Project | ||
39 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
40 | * | ||
41 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
42 | * endorse or promote products derived from this software without | ||
43 | * prior written permission. For written permission, please contact | ||
44 | * openssl-core@openssl.org. | ||
45 | * | ||
46 | * 5. Products derived from this software may not be called "OpenSSL" | ||
47 | * nor may "OpenSSL" appear in their names without prior written | ||
48 | * permission of the OpenSSL Project. | ||
49 | * | ||
50 | * 6. Redistributions of any form whatsoever must retain the following | ||
51 | * acknowledgment: | ||
52 | * "This product includes software developed by the OpenSSL Project | ||
53 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
54 | * | ||
55 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
56 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
57 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
58 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
59 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
60 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
61 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
62 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
63 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
64 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
66 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
67 | * ==================================================================== | ||
68 | * | ||
69 | * This product includes cryptographic software written by Eric Young | ||
70 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
71 | * Hudson (tjh@cryptsoft.com). | ||
72 | * | ||
73 | */ | ||
74 | |||
75 | #undef OPENSSL_DES_LIBDES_COMPATIBILITY | ||
76 | #include <openssl/des.h> | ||
77 | #include <openssl/rand.h> | ||
78 | |||
79 | void _ossl_096_des_random_seed(DES_cblock *key) | ||
80 | { | ||
81 | RAND_seed(key, sizeof(DES_cblock)); | ||
82 | } | ||