1 1.1 christos Fixed the weak key values which were wrong :-( 2 1.1 christos Defining SIGACTION causes sigaction() to be used instead of signal(). 3 1.1 christos SIGUSR1/SIGUSR2 are no longer mapped in the read tty stuff because it 4 1.1 christos can cause problems. This should hopefully not affect normal 5 1.1 christos applications. 6 1.1 christos 7 1.1 christos Version 4.04 8 1.1 christos Fixed a few tests in destest. Also added x86 assember for 9 1.1 christos des_ncbc_encrypt() which is the standard cbc mode function. 10 1.1 christos This makes a very very large performace difference. 11 1.1 christos Ariel Glenn ariel (a] columbia.edu reports that the terminal 12 1.1 christos 'turn echo off' can return (errno == EINVAL) under solaris 13 1.1 christos when redirection is used. So I now catch that as well as ENOTTY. 14 1.1 christos 15 1.1 christos 16 1.1 christos Version 4.03 17 1.1 christos Left a static out of enc_write.c, which caused to buffer to be 18 1.1 christos continiously malloc()ed. Does anyone use these functions? I keep 19 1.1 christos on feeling like removing them since I only had these in there 20 1.1 christos for a version of kerberised login. Anyway, this was pointed out 21 1.1 christos by Theo de Raadt <deraadt (a] cvs.openbsd.org> 22 1.1 christos The 'n' bit ofb code was wrong, it was not shifting the shift 23 1.1 christos register. It worked correctly for n == 64. Thanks to 24 1.1 christos Gigi Ankeny <Gigi.Ankeny (a] Eng.Sun.COM> for pointing this one out. 25 1.1 christos 26 1.1 christos Version 4.02 27 1.1 christos I was doing 'if (memcmp(weak_keys[i],key,sizeof(key)) == 0)' 28 1.1 christos when checking for weak keys which is wrong :-(, pointed out by 29 1.1 christos Markus F.X.J. Oberhumer <markus.oberhumer (a] jk.uni-linz.ac.at>. 30 1.1 christos 31 1.1 christos Version 4.01 32 1.1 christos Even faster inner loop in the DES assembler for x86 and a modification 33 1.1 christos for IP/FP which is faster on x86. Both of these changes are 34 1.1 christos from Svend Olaf Mikkelsen <svolaf (a] inet.uni-c.dk>. His 35 1.1 christos changes make the assembler run %40 faster on a pentium. This is just 36 1.1 christos a case of getting the instruction sequence 'just right'. 37 1.1 christos All credit to 'Svend' :-) 38 1.1 christos Quite a few special x86 'make' targets. 39 1.1 christos A libdes-l (lite) distribution. 40 1.1 christos 41 1.1 christos Version 4.00 42 1.1 christos After a bit of a pause, I'll up the major version number since this 43 1.1 christos is mostly a performace release. I've added x86 assembler and 44 1.1 christos added more options for performance. A %28 speedup for gcc 45 1.1 christos on a pentium and the assembler is a %50 speedup. 46 1.1 christos MIPS CPU's, sparc and Alpha are the main CPU's with speedups. 47 1.1 christos Run des_opts to work out which options should be used. 48 1.1 christos DES_RISC1/DES_RISC2 use alternative inner loops which use 49 1.1 christos more registers but should give speedups on any CPU that does 50 1.1 christos dual issue (pentium). DES_UNROLL unrolls the inner loop, 51 1.1 christos which costs in code size. 52 1.1 christos 53 1.1 christos Version 3.26 54 1.1 christos I've finally removed one of the shifts in D_ENCRYPT. This 55 1.1 christos meant I've changed the des_SPtrans table (spr.h), the set_key() 56 1.1 christos function and some things in des_enc.c. This has definitly 57 1.1 christos made things faster :-). I've known about this one for some 58 1.1 christos time but I've been too lazy to follow it up :-). 59 1.1 christos Noticed that in the D_ENCRYPT() macro, we can just do L^=(..)^(..)^.. 60 1.1 christos instead of L^=((..)|(..)|(..).. This should save a register at 61 1.1 christos least. 62 1.1 christos Assember for x86. The file to replace is des_enc.c, which is replaced 63 1.1 christos by one of the assembler files found in asm. Look at des/asm/readme 64 1.1 christos for more info. 65 1.1 christos 66 1.1 christos /* Modification to fcrypt so it can be compiled to support 67 1.1 christos HPUX 10.x's long password format, define -DLONGCRYPT to use this. 68 1.1 christos Thanks to Jens Kupferschmidt <bt1cu (a] hpboot.rz.uni-leipzig.de>. */ 69 1.1 christos 70 1.1 christos SIGWINCH case put in des_read_passwd() so the function does not 71 1.1 christos 'exit' if this function is recieved. 72 1.1 christos 73 1.1 christos Version 3.25 17/07/96 74 1.1 christos Modified read_pwd.c so that stdin can be read if not a tty. 75 1.1 christos Thanks to Jeff Barber <jeffb (a] issl.atl.hp.com> for the patches. 76 1.1 christos des_init_random_number_generator() shortened due to VMS linker 77 1.1 christos limits. 78 1.1 christos Added RSA's DESX cbc mode. It is a form of cbc encryption, with 2 79 1.1 christos 8 byte quantites xored before and after encryption. 80 1.1 christos des_xcbc_encryption() - the name is funny to preserve the des_ 81 1.1 christos prefix on all functions. 82 1.1 christos 83 1.1 christos Version 3.24 20/04/96 84 1.1 christos The DES_PTR macro option checked and used by SSLeay configuration 85 1.1 christos 86 1.1 christos Version 3.23 11/04/96 87 1.1 christos Added DES_LONG. If defined to 'unsigned int' on the DEC Alpha, 88 1.1 christos it gives a %20 speedup :-) 89 1.1 christos Fixed the problem with des.pl under perl5. The patches were 90 1.1 christos sent by Ed Kubaitis (ejk (a] uiuc.edu). 91 1.1 christos if fcrypt.c, changed values to handle illegal salt values the way 92 1.1 christos normal crypt() implementations do. Some programs apparently use 93 1.1 christos them :-(. The patch was sent by Bjorn Gronvall <bg (a] sics.se> 94 1.1 christos 95 1.1 christos Version 3.22 29/11/95 96 1.1 christos Bug in des(1), an error with the uuencoding stuff when the 97 1.1 christos 'data' is small, thanks to Geoff Keating <keagchon (a] mehta.anu.edu.au> 98 1.1 christos for the patch. 99 1.1 christos 100 1.1 christos Version 3.21 22/11/95 101 1.1 christos After some emailing back and forth with 102 1.1 christos Colin Plumb <colin (a] nyx10.cs.du.edu>, I've tweaked a few things 103 1.1 christos and in a future version I will probably put in some of the 104 1.1 christos optimisation he suggested for use with the DES_USE_PTR option. 105 1.1 christos Extra routines from Mark Murray <mark (a] grondar.za> for use in 106 1.1 christos freeBSD. They mostly involve random number generation for use 107 1.1 christos with kerberos. They involve evil machine specific system calls 108 1.1 christos etc so I would normally suggest pushing this stuff into the 109 1.1 christos application and/or using RAND_seed()/RAND_bytes() if you are 110 1.1 christos using this DES library as part of SSLeay. 111 1.1 christos Redone the read_pw() function so that it is cleaner and 112 1.1 christos supports termios, thanks to Sameer Parekh <sameer (a] c2.org> 113 1.1 christos for the initial patches for this. 114 1.1 christos Renamed 3ecb_encrypt() to ecb3_encrypt(). This has been 115 1.1 christos done just to make things more consistent. 116 1.1 christos I have also now added triple DES versions of cfb and ofb. 117 1.1 christos 118 1.1 christos Version 3.20 119 1.1 christos Damn, Damn, Damn, as pointed out by Mike_Spreitzer.PARC (a] xerox.com, 120 1.1 christos my des_random_seed() function was only copying 4 bytes of the 121 1.1 christos passed seed into the init structure. It is now fixed to copy 8. 122 1.1 christos My own suggestion is to used something like MD5 :-) 123 1.1 christos 124 1.1 christos Version 3.19 125 1.1 christos While looking at my code one day, I though, why do I keep on 126 1.1 christos calling des_encrypt(in,out,ks,enc) when every function that 127 1.1 christos calls it has in and out the same. So I dropped the 'out' 128 1.1 christos parameter, people should not be using this function. 129 1.1 christos 130 1.1 christos Version 3.18 30/08/95 131 1.1 christos Fixed a few bit with the distribution and the filenames. 132 1.1 christos 3.17 had been munged via a move to DOS and back again. 133 1.1 christos NO CODE CHANGES 134 1.1 christos 135 1.1 christos Version 3.17 14/07/95 136 1.1 christos Fixed ede3 cbc which I had broken in 3.16. I have also 137 1.1 christos removed some unneeded variables in 7-8 of the routines. 138 1.1 christos 139 1.1 christos Version 3.16 26/06/95 140 1.1 christos Added des_encrypt2() which does not use IP/FP, used by triple 141 1.1 christos des routines. Tweaked things a bit elsewhere. %13 speedup on 142 1.1 christos sparc and %6 on a R4400 for ede3 cbc mode. 143 1.1 christos 144 1.1 christos Version 3.15 06/06/95 145 1.1 christos Added des_ncbc_encrypt(), it is des_cbc mode except that it is 146 1.1 christos 'normal' and copies the new iv value back over the top of the 147 1.1 christos passed parameter. 148 1.1 christos CHANGED des_ede3_cbc_encrypt() so that it too now overwrites 149 1.1 christos the iv. THIS WILL BREAK EXISTING CODE, but since this function 150 1.1 christos only new, I feel I can change it, not so with des_cbc_encrypt :-(. 151 1.1 christos I need to update the documentation. 152 1.1 christos 153 1.1 christos Version 3.14 31/05/95 154 1.1 christos New release upon the world, as part of my SSL implementation. 155 1.1 christos New copyright and usage stuff. Basically free for all to use 156 1.1 christos as long as you say it came from me :-) 157 1.1 christos 158 1.1 christos Version 3.13 31/05/95 159 1.1 christos A fix in speed.c, if HZ is not defined, I set it to 100.0 160 1.1 christos which is reasonable for most unixes except SunOS 4.x. 161 1.1 christos I now have a #ifdef sun but timing for SunOS 4.x looked very 162 1.1 christos good :-(. At my last job where I used SunOS 4.x, it was 163 1.1 christos defined to be 60.0 (look at the old INSTALL documentation), at 164 1.1 christos the last release had it changed to 100.0 since I now work with 165 1.1 christos Solaris2 and SVR4 boxes. 166 1.1 christos Thanks to Rory Chisholm <rchishol (a] math.ethz.ch> for pointing this 167 1.1 christos one out. 168 1.1 christos 169 1.1 christos Version 3.12 08/05/95 170 1.1 christos As pointed out by The Crypt Keeper <tck (a] bend.UCSD.EDU>, 171 1.1 christos my D_ENCRYPT macro in crypt() had an un-necessary variable. 172 1.1 christos It has been removed. 173 1.1 christos 174 1.1 christos Version 3.11 03/05/95 175 1.1 christos Added des_ede3_cbc_encrypt() which is cbc mode des with 3 keys 176 1.1 christos and one iv. It is a standard and I needed it for my SSL code. 177 1.1 christos It makes more sense to use this for triple DES than 178 1.1 christos 3cbc_encrypt(). I have also added (or should I say tested :-) 179 1.1 christos cfb64_encrypt() which is cfb64 but it will encrypt a partial 180 1.1 christos number of bytes - 3 bytes in 3 bytes out. Again this is for 181 1.1 christos my SSL library, as a form of encryption to use with SSL 182 1.1 christos telnet. 183 1.1 christos 184 1.1 christos Version 3.10 22/03/95 185 1.1 christos Fixed a bug in 3cbc_encrypt() :-(. When making repeated calls 186 1.1 christos to cbc3_encrypt, the 2 iv values that were being returned to 187 1.1 christos be used in the next call were reversed :-(. 188 1.1 christos Many thanks to Bill Wade <wade (a] Stoner.COM> for pointing out 189 1.1 christos this error. 190 1.1 christos 191 1.1 christos Version 3.09 01/02/95 192 1.1 christos Fixed des_random_key to far more random, it was rather feeble 193 1.1 christos with regards to picking the initial seed. The problem was 194 1.1 christos pointed out by Olaf Kirch <okir (a] monad.swb.de>. 195 1.1 christos 196 1.1 christos Version 3.08 14/12/94 197 1.1 christos Added Makefile.PL so libdes can be built into perl5. 198 1.1 christos Changed des_locl.h so RAND is always defined. 199 1.1 christos 200 1.1 christos Version 3.07 05/12/94 201 1.1 christos Added GNUmake and stuff so the library can be build with 202 1.1 christos glibc. 203 1.1 christos 204 1.1 christos Version 3.06 30/08/94 205 1.1 christos Added rpc_enc.c which contains _des_crypt. This is for use in 206 1.1 christos secure_rpc v 4.0 207 1.1 christos Finally fixed the cfb_enc problems. 208 1.1 christos Fixed a few parameter parsing bugs in des (-3 and -b), thanks 209 1.1 christos to Rob McMillan <R.McMillan (a] its.gu.edu.au> 210 1.1 christos 211 1.1 christos Version 3.05 21/04/94 212 1.1 christos for unsigned long l; gcc does not produce ((l>>34) == 0) 213 1.1 christos This causes bugs in cfb_enc. 214 1.1 christos Thanks to Hadmut Danisch <danisch (a] ira.uka.de> 215 1.1 christos 216 1.1 christos Version 3.04 20/04/94 217 1.1 christos Added a version number to des.c and libdes.a 218 1.1 christos 219 1.1 christos Version 3.03 12/01/94 220 1.1 christos Fixed a bug in non zero iv in 3cbc_enc. 221 1.1 christos 222 1.1 christos Version 3.02 29/10/93 223 1.1 christos I now work in a place where there are 6+ architectures and 14+ 224 1.1 christos OS versions :-). 225 1.1 christos Fixed TERMIO definition so the most sys V boxes will work :-) 226 1.1 christos 227 1.1 christos Release upon comp.sources.misc 228 1.1 christos Version 3.01 08/10/93 229 1.1 christos Added des_3cbc_encrypt() 230 1.1 christos 231 1.1 christos Version 3.00 07/10/93 232 1.1 christos Fixed up documentation. 233 1.1 christos quad_cksum definitely compatible with MIT's now. 234 1.1 christos 235 1.1 christos Version 2.30 24/08/93 236 1.1 christos Triple DES now defaults to triple cbc but can do triple ecb 237 1.1 christos with the -b flag. 238 1.1 christos Fixed some MSDOS uuen/uudecoding problems, thanks to 239 1.1 christos Added prototypes. 240 1.1 christos 241 1.1 christos Version 2.22 29/06/93 242 1.1 christos Fixed a bug in des_is_weak_key() which stopped it working :-( 243 1.1 christos thanks to engineering (a] MorningStar.Com. 244 1.1 christos 245 1.1 christos Version 2.21 03/06/93 246 1.1 christos des(1) with no arguments gives quite a bit of help. 247 1.1 christos Added -c (generate ckecksum) flag to des(1). 248 1.1 christos Added -3 (triple DES) flag to des(1). 249 1.1 christos Added cfb and ofb routines to the library. 250 1.1 christos 251 1.1 christos Version 2.20 11/03/93 252 1.1 christos Added -u (uuencode) flag to des(1). 253 1.1 christos I have been playing with byte order in quad_cksum to make it 254 1.1 christos compatible with MIT's version. All I can say is avid this 255 1.1 christos function if possible since MIT's output is endian dependent. 256 1.1 christos 257 1.1 christos Version 2.12 14/10/92 258 1.1 christos Added MSDOS specific macro in ecb_encrypt which gives a %70 259 1.1 christos speed up when the code is compiled with turbo C. 260 1.1 christos 261 1.1 christos Version 2.11 12/10/92 262 1.1 christos Speedup in set_key (recoding of PC-1) 263 1.1 christos I now do it in 47 simple operations, down from 60. 264 1.1 christos Thanks to John Fletcher (john_fletcher (a] lccmail.ocf.llnl.gov) 265 1.1 christos for motivating me to look for a faster system :-) 266 1.1 christos The speedup is probably less that 1% but it is still 13 267 1.1 christos instructions less :-). 268 1.1 christos 269 1.1 christos Version 2.10 06/10/92 270 1.1 christos The code now works on the 64bit ETA10 and CRAY without modifications or 271 1.1 christos #defines. I believe the code should work on any machine that 272 1.1 christos defines long, int or short to be 8 bytes long. 273 1.1 christos Thanks to Shabbir J. Safdar (shabby (a] mentor.cc.purdue.edu) 274 1.1 christos for helping me fix the code to run on 64bit machines (he had 275 1.1 christos access to an ETA10). 276 1.1 christos Thanks also to John Fletcher <john_fletcher (a] lccmail.ocf.llnl.gov> 277 1.1 christos for testing the routines on a CRAY. 278 1.1 christos read_password.c has been renamed to read_passwd.c 279 1.1 christos string_to_key.c has been renamed to string2key.c 280 1.1 christos 281 1.1 christos Version 2.00 14/09/92 282 1.1 christos Made mods so that the library should work on 64bit CPU's. 283 1.1 christos Removed all my uchar and ulong defs. To many different 284 1.1 christos versions of unix define them in their header files in too many 285 1.1 christos different combinations :-) 286 1.1 christos IRIX - Sillicon Graphics mods (mostly in read_password.c). 287 1.1 christos Thanks to Andrew Daviel (advax (a] erich.triumf.ca) 288 1.1 christos 289 1.1 christos Version 1.99 26/08/92 290 1.1 christos Fixed a bug or 2 in enc_read.c 291 1.1 christos Fixed a bug in enc_write.c 292 1.1 christos Fixed a pseudo bug in fcrypt.c (very obscure). 293 1.1 christos 294 1.1 christos Version 1.98 31/07/92 295 1.1 christos Support for the ETA10. This is a strange machine that defines 296 1.1 christos longs and ints as 8 bytes and shorts as 4 bytes. 297 1.1 christos Since I do evil things with long * that assume that they are 4 298 1.1 christos bytes. Look in the Makefile for the option to compile for 299 1.1 christos this machine. quad_cksum appears to have problems but I 300 1.1 christos will don't have the time to fix it right now, and this is not 301 1.1 christos a function that uses DES and so will not effect the main uses 302 1.1 christos of the library. 303 1.1 christos 304 1.1 christos Version 1.97 20/05/92 eay 305 1.1 christos Fixed the Imakefile and made some changes to des.h to fix some 306 1.1 christos problems when building this package with Kerberos v 4. 307 1.1 christos 308 1.1 christos Version 1.96 18/05/92 eay 309 1.1 christos Fixed a small bug in string_to_key() where problems could 310 1.1 christos occur if des_check_key was set to true and the string 311 1.1 christos generated a weak key. 312 1.1 christos 313 1.1 christos Patch2 posted to comp.sources.misc 314 1.1 christos Version 1.95 13/05/92 eay 315 1.1 christos Added an alternative version of the D_ENCRYPT macro in 316 1.1 christos ecb_encrypt and fcrypt. Depending on the compiler, one version or the 317 1.1 christos other will be faster. This was inspired by 318 1.1 christos Dana How <how (a] isl.stanford.edu>, and her pointers about doing the 319 1.1 christos *(ulong *)((uchar *)ptr+(value&0xfc)) 320 1.1 christos vs 321 1.1 christos ptr[value&0x3f] 322 1.1 christos to stop the C compiler doing a <<2 to convert the long array index. 323 1.1 christos 324 1.1 christos Version 1.94 05/05/92 eay 325 1.1 christos Fixed an incompatibility between my string_to_key and the MIT 326 1.1 christos version. When the key is longer than 8 chars, I was wrapping 327 1.1 christos with a different method. To use the old version, define 328 1.1 christos OLD_STR_TO_KEY in the makefile. Thanks to 329 1.1 christos viktor (a] newsu.shearson.com (Viktor Dukhovni). 330 1.1 christos 331 1.1 christos Version 1.93 28/04/92 eay 332 1.1 christos Fixed the VMS mods so that echo is now turned off in 333 1.1 christos read_password. Thanks again to brennan (a] coco.cchs.su.oz.AU. 334 1.1 christos MSDOS support added. The routines can be compiled with 335 1.1 christos Turbo C (v2.0) and MSC (v5.1). Make sure MSDOS is defined. 336 1.1 christos 337 1.1 christos Patch1 posted to comp.sources.misc 338 1.1 christos Version 1.92 13/04/92 eay 339 1.1 christos Changed D_ENCRYPT so that the rotation of R occurs outside of 340 1.1 christos the loop. This required rotating all the longs in sp.h (now 341 1.1 christos called spr.h). Thanks to Richard Outerbridge <71755.204 (a] CompuServe.COM> 342 1.1 christos speed.c has been changed so it will work without SIGALRM. If 343 1.1 christos times(3) is not present it will try to use ftime() instead. 344 1.1 christos 345 1.1 christos Version 1.91 08/04/92 eay 346 1.1 christos Added -E/-D options to des(1) so it can use string_to_key. 347 1.1 christos Added SVR4 mods suggested by witr (a] rwwa.COM 348 1.1 christos Added VMS mods suggested by brennan (a] coco.cchs.su.oz.AU. If 349 1.1 christos anyone knows how to turn of tty echo in VMS please tell me or 350 1.1 christos implement it yourself :-). 351 1.1 christos Changed FILE *IN/*OUT to *DES_IN/*DES_OUT since it appears VMS 352 1.1 christos does not like IN/OUT being used. 353 1.1 christos 354 1.1 christos Libdes posted to comp.sources.misc 355 1.1 christos Version 1.9 24/03/92 eay 356 1.1 christos Now contains a fast small crypt replacement. 357 1.1 christos Added des(1) command. 358 1.1 christos Added des_rw_mode so people can use cbc encryption with 359 1.1 christos enc_read and enc_write. 360 1.1 christos 361 1.1 christos Version 1.8 15/10/91 eay 362 1.1 christos Bug in cbc_cksum. 363 1.1 christos Many thanks to Keith Reynolds (keithr (a] sco.COM) for pointing this 364 1.1 christos one out. 365 1.1 christos 366 1.1 christos Version 1.7 24/09/91 eay 367 1.1 christos Fixed set_key :-) 368 1.1 christos set_key is 4 times faster and takes less space. 369 1.1 christos There are a few minor changes that could be made. 370 1.1 christos 371 1.1 christos Version 1.6 19/09/1991 eay 372 1.1 christos Finally go IP and FP finished. 373 1.1 christos Now I need to fix set_key. 374 1.1 christos This version is quite a bit faster that 1.51 375 1.1 christos 376 1.1 christos Version 1.52 15/06/1991 eay 377 1.1 christos 20% speedup in ecb_encrypt by changing the E bit selection 378 1.1 christos to use 2 32bit words. This also required modification of the 379 1.1 christos sp table. There is still a way to speedup the IP and IP-1 380 1.1 christos (hints from outer (a] sq.com) still working on this one :-(. 381 1.1 christos 382 1.1 christos Version 1.51 07/06/1991 eay 383 1.1 christos Faster des_encrypt by loop unrolling 384 1.1 christos Fixed bug in quad_cksum.c (thanks to hughes (a] logos.ucs.indiana.edu) 385 1.1 christos 386 1.1 christos Version 1.50 28/05/1991 eay 387 1.1 christos Optimised the code a bit more for the sparc. I have improved the 388 1.1 christos speed of the inner des_encrypt by speeding up the initial and 389 1.1 christos final permutations. 390 1.1 christos 391 1.1 christos Version 1.40 23/10/1990 eay 392 1.1 christos Fixed des_random_key, it did not produce a random key :-( 393 1.1 christos 394 1.1 christos Version 1.30 2/10/1990 eay 395 1.1 christos Have made des_quad_cksum the same as MIT's, the full package 396 1.1 christos should be compatible with MIT's 397 1.1 christos Have tested on a DECstation 3100 398 1.1 christos Still need to fix des_set_key (make it faster). 399 1.1 christos Does des_cbc_encrypts at 70.5k/sec on a 3100. 400 1.1 christos 401 1.1 christos Version 1.20 18/09/1990 eay 402 1.1 christos Fixed byte order dependencies. 403 1.1 christos Fixed (I hope) all the word alignment problems. 404 1.1 christos Speedup in des_ecb_encrypt. 405 1.1 christos 406 1.1 christos Version 1.10 11/09/1990 eay 407 1.1 christos Added des_enc_read and des_enc_write. 408 1.1 christos Still need to fix des_quad_cksum. 409 1.1 christos Still need to document des_enc_read and des_enc_write. 410 1.1 christos 411 1.1 christos Version 1.00 27/08/1990 eay 412 1.1 christos 413