summaryrefslogtreecommitdiffstats
path: root/crypto/des
diff options
context:
space:
mode:
authorRalf S. Engelschall <rse@openssl.org>1998-12-21 10:52:47 +0000
committerRalf S. Engelschall <rse@openssl.org>1998-12-21 10:52:47 +0000
commitd02b48c63a58ea4367a0e905979f140b7d090f86 (patch)
tree504f62ed3d84799f785b9cd9fab255a21b0e1b0e /crypto/des
Import of old SSLeay release: SSLeay 0.8.1b
Diffstat (limited to 'crypto/des')
-rw-r--r--crypto/des/COPYRIGHT50
-rw-r--r--crypto/des/DES.pm19
-rw-r--r--crypto/des/DES.pod16
-rw-r--r--crypto/des/DES.xs268
-rw-r--r--crypto/des/FILES96
-rw-r--r--crypto/des/INSTALL69
-rw-r--r--crypto/des/Imakefile35
-rw-r--r--crypto/des/KERBEROS41
-rw-r--r--crypto/des/MODES.DES84
-rw-r--r--crypto/des/Makefile.PL14
-rw-r--r--crypto/des/Makefile.lit249
-rw-r--r--crypto/des/Makefile.ssl135
-rw-r--r--crypto/des/Makefile.uni249
-rw-r--r--crypto/des/PC128
-rw-r--r--crypto/des/PC257
-rw-r--r--crypto/des/README54
-rw-r--r--crypto/des/VERSION387
-rw-r--r--crypto/des/asm/c-win32.asm929
-rw-r--r--crypto/des/asm/c-win32.uu99
-rw-r--r--crypto/des/asm/crypt.pl240
-rw-r--r--crypto/des/asm/cx86-cpp.s932
-rw-r--r--crypto/des/asm/cx86unix.cpp35
-rw-r--r--crypto/des/asm/d-win32.asm2765
-rw-r--r--crypto/des/asm/d-win32.uu319
-rw-r--r--crypto/des/asm/des-som2.pl308
-rw-r--r--crypto/des/asm/des-som3.pl266
-rw-r--r--crypto/des/asm/des586.pl210
-rw-r--r--crypto/des/asm/des686.pl230
-rw-r--r--crypto/des/asm/desboth.pl67
-rw-r--r--crypto/des/asm/dx86-cpp.s2780
-rw-r--r--crypto/des/asm/dx86unix.cpp41
-rw-r--r--crypto/des/asm/readme131
-rw-r--r--crypto/des/cbc3_enc.c99
-rw-r--r--crypto/des/cbc_cksm.c103
-rw-r--r--crypto/des/cbc_enc.c135
-rw-r--r--crypto/des/cfb64ede.c151
-rw-r--r--crypto/des/cfb64enc.c128
-rw-r--r--crypto/des/cfb_enc.c171
-rw-r--r--crypto/des/des305
-rw-r--r--crypto/des/des.c960
-rw-r--r--crypto/des/des.h305
-rw-r--r--crypto/des/des.man186
-rw-r--r--crypto/des/des.org305
-rw-r--r--crypto/des/des.pl552
-rw-r--r--crypto/des/des_crypt.man508
-rw-r--r--crypto/des/des_enc.c301
-rw-r--r--crypto/des/des_locl.h516
-rw-r--r--crypto/des/des_locl.org516
-rw-r--r--crypto/des/des_opts.c620
-rw-r--r--crypto/des/des_ver.h60
-rw-r--r--crypto/des/destest.c856
-rw-r--r--crypto/des/doIP46
-rw-r--r--crypto/des/doPC1110
-rw-r--r--crypto/des/doPC294
-rw-r--r--crypto/des/ecb3_enc.c87
-rw-r--r--crypto/des/ecb_enc.c124
-rw-r--r--crypto/des/ede_enc.c189
-rw-r--r--crypto/des/enc_read.c214
-rw-r--r--crypto/des/enc_writ.c160
-rw-r--r--crypto/des/fcrypt.c153
-rw-r--r--crypto/des/fcrypt_b.c148
-rw-r--r--crypto/des/makefile.bc50
-rw-r--r--crypto/des/ncbc_enc.c141
-rw-r--r--crypto/des/ofb64ede.c131
-rw-r--r--crypto/des/ofb64enc.c114
-rw-r--r--crypto/des/ofb_enc.c122
-rw-r--r--crypto/des/options.txt39
-rw-r--r--crypto/des/pcbc_enc.c126
-rw-r--r--crypto/des/podd.h75
-rw-r--r--crypto/des/qud_cksm.c144
-rw-r--r--crypto/des/rand_key.c118
-rw-r--r--crypto/des/read2pwd.c90
-rw-r--r--crypto/des/read_pwd.c419
-rw-r--r--crypto/des/rpc_des.h131
-rw-r--r--crypto/des/rpc_enc.c107
-rw-r--r--crypto/des/rpw.c101
-rw-r--r--crypto/des/set_key.c246
-rw-r--r--crypto/des/shifts.pl198
-rw-r--r--crypto/des/sk.h204
-rw-r--r--crypto/des/speed.c329
-rw-r--r--crypto/des/spr.h204
-rw-r--r--crypto/des/str2key.c171
-rw-r--r--crypto/des/supp.c109
-rw-r--r--crypto/des/t/test27
-rw-r--r--crypto/des/testdes.pl167
-rw-r--r--crypto/des/times/486-50.sol16
-rw-r--r--crypto/des/times/586-100.lnx20
-rw-r--r--crypto/des/times/686-200.fre18
-rw-r--r--crypto/des/times/aix.cc26
-rw-r--r--crypto/des/times/alpha.cc18
-rw-r--r--crypto/des/times/hpux.cc17
-rw-r--r--crypto/des/times/sparc.gcc17
-rw-r--r--crypto/des/times/usparc.cc31
-rw-r--r--crypto/des/typemap34
-rwxr-xr-xcrypto/des/vms.com90
-rw-r--r--crypto/des/xcbc_enc.c206
96 files changed, 23361 insertions, 0 deletions
diff --git a/crypto/des/COPYRIGHT b/crypto/des/COPYRIGHT
new file mode 100644
index 0000000000..5469e1e469
--- /dev/null
+++ b/crypto/des/COPYRIGHT
@@ -0,0 +1,50 @@
+Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+All rights reserved.
+
+This package is an DES implementation written by Eric Young (eay@cryptsoft.com).
+The implementation was written so as to conform with MIT's libdes.
+
+This library is free for commercial and non-commercial use as long as
+the following conditions are aheared to. The following conditions
+apply to all code found in this distribution.
+
+Copyright remains Eric Young's, and as such any Copyright notices in
+the code are not to be removed.
+If this package is used in a product, Eric Young should be given attribution
+as the author of that the SSL library. This can be in the form of a textual
+message at program startup or in documentation (online or textual) provided
+with the package.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by Eric Young (eay@cryptsoft.com)
+
+THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+The license and distribution terms for any publically available version or
+derivative of this code cannot be changed. i.e. this code cannot simply be
+copied and put under another distrubution license
+[including the GNU Public License.]
+
+The reason behind this being stated in this direct manner is past
+experience in code simply being copied and the attribution removed
+from it and then being distributed as part of other packages. This
+implementation was a non-trivial and unpaid effort.
diff --git a/crypto/des/DES.pm b/crypto/des/DES.pm
new file mode 100644
index 0000000000..6a175b6ca4
--- /dev/null
+++ b/crypto/des/DES.pm
@@ -0,0 +1,19 @@
+package DES;
+
+require Exporter;
+require DynaLoader;
+@ISA = qw(Exporter DynaLoader);
+# Items to export into callers namespace by default
+# (move infrequently used names to @EXPORT_OK below)
+@EXPORT = qw(
+);
+# Other items we are prepared to export if requested
+@EXPORT_OK = qw(
+crypt
+);
+
+# Preloaded methods go here. Autoload methods go after __END__, and are
+# processed by the autosplit program.
+bootstrap DES;
+1;
+__END__
diff --git a/crypto/des/DES.pod b/crypto/des/DES.pod
new file mode 100644
index 0000000000..8a739e7ca0
--- /dev/null
+++ b/crypto/des/DES.pod
@@ -0,0 +1,16 @@
+crypt <= crypt(buf,salt)
+key <= set_odd_parity(key)
+int <= is_weak_key(key)
+keysched<= set_key(key)
+key <= ecb_encrypt(string8,ks,enc)
+key <= ecb3_encrypt(input,ks1,ks2,enc)
+string <= cbc_encrypt(input,ks,ivec,enc) => ivec
+string <= cbc3_encrypt(input,ks1,ks2,ivec1,ivec2,enc) => ivec1&ivec2
+ck1,ck2 <= cbc_cksum(input,ks,ivec) => ivec
+string <= pcbc_encrypt(input,ks,ivec,enc) => ivec
+string <= ofb_encrypt(input,numbits,ks,ivec) => ivec
+string <= cfb_encrypt(input,numbits,ks,ivec,enc) => ivec
+key <= random_key()
+key <= string_to_key(string)
+key1,key2<= string_to_2keys(string)
+
diff --git a/crypto/des/DES.xs b/crypto/des/DES.xs
new file mode 100644
index 0000000000..b8050b9edf
--- /dev/null
+++ b/crypto/des/DES.xs
@@ -0,0 +1,268 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+#include "des.h"
+
+#define deschar char
+static STRLEN len;
+
+static int
+not_here(s)
+char *s;
+{
+ croak("%s not implemented on this architecture", s);
+ return -1;
+}
+
+MODULE = DES PACKAGE = DES PREFIX = des_
+
+char *
+des_crypt(buf,salt)
+ char * buf
+ char * salt
+
+void
+des_set_odd_parity(key)
+ des_cblock * key
+PPCODE:
+ {
+ SV *s;
+
+ s=sv_newmortal();
+ sv_setpvn(s,(char *)key,8);
+ des_set_odd_parity((des_cblock *)SvPV(s,na));
+ PUSHs(s);
+ }
+
+int
+des_is_weak_key(key)
+ des_cblock * key
+
+des_key_schedule
+des_set_key(key)
+ des_cblock * key
+CODE:
+ des_set_key(key,RETVAL);
+OUTPUT:
+RETVAL
+
+des_cblock
+des_ecb_encrypt(input,ks,encrypt)
+ des_cblock * input
+ des_key_schedule * ks
+ int encrypt
+CODE:
+ des_ecb_encrypt(input,&RETVAL,*ks,encrypt);
+OUTPUT:
+RETVAL
+
+void
+des_cbc_encrypt(input,ks,ivec,encrypt)
+ char * input
+ des_key_schedule * ks
+ des_cblock * ivec
+ int encrypt
+PPCODE:
+ {
+ SV *s;
+ STRLEN len,l;
+ char *c;
+
+ l=SvCUR(ST(0));
+ len=((((unsigned long)l)+7)/8)*8;
+ s=sv_newmortal();
+ sv_setpvn(s,"",0);
+ SvGROW(s,len);
+ SvCUR_set(s,len);
+ c=(char *)SvPV(s,na);
+ des_cbc_encrypt((des_cblock *)input,(des_cblock *)c,
+ l,*ks,ivec,encrypt);
+ sv_setpvn(ST(2),(char *)c[len-8],8);
+ PUSHs(s);
+ }
+
+void
+des_cbc3_encrypt(input,ks1,ks2,ivec1,ivec2,encrypt)
+ char * input
+ des_key_schedule * ks1
+ des_key_schedule * ks2
+ des_cblock * ivec1
+ des_cblock * ivec2
+ int encrypt
+PPCODE:
+ {
+ SV *s;
+ STRLEN len,l;
+
+ l=SvCUR(ST(0));
+ len=((((unsigned long)l)+7)/8)*8;
+ s=sv_newmortal();
+ sv_setpvn(s,"",0);
+ SvGROW(s,len);
+ SvCUR_set(s,len);
+ des_3cbc_encrypt((des_cblock *)input,(des_cblock *)SvPV(s,na),
+ l,*ks1,*ks2,ivec1,ivec2,encrypt);
+ sv_setpvn(ST(3),(char *)ivec1,8);
+ sv_setpvn(ST(4),(char *)ivec2,8);
+ PUSHs(s);
+ }
+
+void
+des_cbc_cksum(input,ks,ivec)
+ char * input
+ des_key_schedule * ks
+ des_cblock * ivec
+PPCODE:
+ {
+ SV *s1,*s2;
+ STRLEN len,l;
+ des_cblock c;
+ unsigned long i1,i2;
+
+ s1=sv_newmortal();
+ s2=sv_newmortal();
+ l=SvCUR(ST(0));
+ des_cbc_cksum((des_cblock *)input,(des_cblock *)c,
+ l,*ks,ivec);
+ i1=c[4]|(c[5]<<8)|(c[6]<<16)|(c[7]<<24);
+ i2=c[0]|(c[1]<<8)|(c[2]<<16)|(c[3]<<24);
+ sv_setiv(s1,i1);
+ sv_setiv(s2,i2);
+ sv_setpvn(ST(2),(char *)c,8);
+ PUSHs(s1);
+ PUSHs(s2);
+ }
+
+void
+des_cfb_encrypt(input,numbits,ks,ivec,encrypt)
+ char * input
+ int numbits
+ des_key_schedule * ks
+ des_cblock * ivec
+ int encrypt
+PPCODE:
+ {
+ SV *s;
+ STRLEN len;
+ char *c;
+
+ len=SvCUR(ST(0));
+ s=sv_newmortal();
+ sv_setpvn(s,"",0);
+ SvGROW(s,len);
+ SvCUR_set(s,len);
+ c=(char *)SvPV(s,na);
+ des_cfb_encrypt((unsigned char *)input,(unsigned char *)c,
+ (int)numbits,(long)len,*ks,ivec,encrypt);
+ sv_setpvn(ST(3),(char *)ivec,8);
+ PUSHs(s);
+ }
+
+des_cblock *
+des_ecb3_encrypt(input,ks1,ks2,encrypt)
+ des_cblock * input
+ des_key_schedule * ks1
+ des_key_schedule * ks2
+ int encrypt
+CODE:
+ {
+ des_cblock c;
+
+ des_ecb3_encrypt((des_cblock *)input,(des_cblock *)&c,
+ *ks1,*ks2,encrypt);
+ RETVAL= &c;
+ }
+OUTPUT:
+RETVAL
+
+void
+des_ofb_encrypt(input,numbits,ks,ivec)
+ unsigned char * input
+ int numbits
+ des_key_schedule * ks
+ des_cblock * ivec
+PPCODE:
+ {
+ SV *s;
+ STRLEN len,l;
+ unsigned char *c;
+
+ len=SvCUR(ST(0));
+ s=sv_newmortal();
+ sv_setpvn(s,"",0);
+ SvGROW(s,len);
+ SvCUR_set(s,len);
+ c=(unsigned char *)SvPV(s,na);
+ des_ofb_encrypt((unsigned char *)input,(unsigned char *)c,
+ numbits,len,*ks,ivec);
+ sv_setpvn(ST(3),(char *)ivec,8);
+ PUSHs(s);
+ }
+
+void
+des_pcbc_encrypt(input,ks,ivec,encrypt)
+ char * input
+ des_key_schedule * ks
+ des_cblock * ivec
+ int encrypt
+PPCODE:
+ {
+ SV *s;
+ STRLEN len,l;
+ char *c;
+
+ l=SvCUR(ST(0));
+ len=((((unsigned long)l)+7)/8)*8;
+ s=sv_newmortal();
+ sv_setpvn(s,"",0);
+ SvGROW(s,len);
+ S