Updated to libdes 4.01
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1925 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
|
||||
Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
All rights reserved.
|
||||
|
||||
This package is an DES implementation written by Eric Young (eay@mincom.oz.au).
|
||||
|
@@ -58,7 +58,7 @@ des_locl.h - Internal libdes.a header file.
|
||||
podd.h - Odd parity tables - used in des_set_key().
|
||||
sk.h - Lookup tables used in des_set_key().
|
||||
spr.h - What is left of the S tables - used in ecb_encrypt().
|
||||
version.h - header file for the external definition of the
|
||||
des_ver.h - header file for the external definition of the
|
||||
version string.
|
||||
des.doc - SSLeay documentation for the library.
|
||||
|
||||
|
@@ -9,12 +9,34 @@ be 100.0.
|
||||
|
||||
If possible use gcc v 2.7.?
|
||||
Turn on the maximum optimising (normally '-O3 -fomit-frame-pointer' for gcc)
|
||||
In recent times, some system compilers give better performace.
|
||||
|
||||
type 'make'
|
||||
|
||||
run './destest' to check things are ok.
|
||||
run './rpw' to check the tty code for reading passwords works.
|
||||
run './speed' to see how fast those optimisations make the library run :-)
|
||||
run './des_opts' to determin the best compile time options.
|
||||
|
||||
The output from des_opts should be put in the makefile options and des_enc.c
|
||||
should be rebuilt. For 64 bit computers, do not use the DES_PTR option.
|
||||
For the DEC Alpha, edit des.h and change DES_LONG to 'unsigned int'
|
||||
and then you can use the 'DES_PTR' option.
|
||||
|
||||
The file options.txt has the options listed for best speed on quite a
|
||||
few systems. Look and the options (UNROLL, PTR, RISC2 etc) and then
|
||||
turn on the relevent option in the Makefile
|
||||
|
||||
There are some special Makefile targets that make life easier.
|
||||
make cc - standard cc build
|
||||
make gcc - standard gcc build
|
||||
make x86-elf - x86 assember (elf), linux-elf.
|
||||
make x86-out - x86 assember (a.out), FreeBSD
|
||||
make x86-solaris- x86 assember
|
||||
make x86-bsdi - x86 assember (a.out with primative assember).
|
||||
|
||||
If at all possible use the assember (for Windows NT/95, use
|
||||
asm/win32.obj to link with). The x86 assember is very very fast.
|
||||
|
||||
A make install will by default install
|
||||
libdes.a in /usr/local/lib/libdes.a
|
||||
@@ -36,22 +58,12 @@ decrypted the files on a SparcStation.
|
||||
I have been able to compile and test the routines with
|
||||
Microsoft C v 5.1 and Turbo C v 2.0.
|
||||
The code in this library is in no way optimised for the 16bit
|
||||
operation of MSDOS. Microsoft C generates code that is 40% slower
|
||||
than Turbo C's code. I believe this is due to problems it has with
|
||||
code generation with the 32bit shift operation in the IP and FP
|
||||
sections. I have added some 16bit optimization in ecb_encrypt.c
|
||||
and this generated a %70 speedup under Turbo C. Such are the
|
||||
limitations of DOS compilers :-(.
|
||||
|
||||
For Turbo C v 2.0, make sure to define MSDOS, in the relevant menu.
|
||||
|
||||
There is an alternative version of the D_ENCRYPT macro that can be
|
||||
enabled with the -DDES_USE_PTR option in the makefile. This alternative
|
||||
macro can make a +-%20 speed difference to the DES encryption speed,
|
||||
depending on the compiler/CPU combinations.
|
||||
It has its greatest effect on Sparc machines when using the sun compiler.
|
||||
If in doubt, try enable/disable it and running speed. It does not
|
||||
seem to affect gcc much.
|
||||
operation of MSDOS.
|
||||
|
||||
When building for glibc, ignore all of the above and just unpack into
|
||||
glibc-1.??/des and then gmake as per normal.
|
||||
|
||||
As a final note on performace. Certain CPUs like sparcs and Alpha often give
|
||||
a %10 speed difference depending on the link order. It is rather anoying
|
||||
when one program reports 'x' DES encrypts a second and another reports
|
||||
'x*0.9' the speed.
|
||||
|
@@ -4,12 +4,12 @@
|
||||
SRCS= cbc_cksm.c cbc_enc.c ecb_enc.c pcbc_enc.c \
|
||||
qud_cksm.c rand_key.c read_pwd.c set_key.c str2key.c \
|
||||
enc_read.c enc_writ.c fcrypt.c cfb_enc.c \
|
||||
3ecb_enc.c ofb_enc.c ofb64enc.c
|
||||
ecb3_enc.c ofb_enc.c ofb64enc.c
|
||||
|
||||
OBJS= cbc_cksm.o cbc_enc.o ecb_enc.o pcbc_enc.o \
|
||||
qud_cksm.o rand_key.o read_pwd.o set_key.o str2key.o \
|
||||
enc_read.o enc_writ.o fcrypt.o cfb_enc.o \
|
||||
3ecb_enc.o ofb_enc.o ofb64enc.o
|
||||
ecb3_enc.o ofb_enc.o ofb64enc.o
|
||||
|
||||
GENERAL=COPYRIGHT FILES INSTALL Imakefile README VERSION makefile times \
|
||||
vms.com KERBEROS
|
||||
|
@@ -10,5 +10,5 @@ use ExtUtils::MakeMaker;
|
||||
'OBJECT' => 'DES.o cbc_cksm.o cbc_enc.o ecb_enc.o pcbc_enc.o \
|
||||
rand_key.o set_key.o str2key.o \
|
||||
enc_read.o enc_writ.o fcrypt.o cfb_enc.o \
|
||||
ecb3_enc.o ofb_enc.o cbc3_enc.o',
|
||||
ecb3_enc.o ofb_enc.o cbc3_enc.o des_enc.o',
|
||||
);
|
||||
|
@@ -43,15 +43,15 @@ LIB = $(LIBNAME).$(LIBEXT)
|
||||
|
||||
# Generated with lorder *.o | tsort | xargs echo
|
||||
|
||||
LIBSRC = cbc3_enc.c cbc_enc.c cfb64ede.c cfb64enc.c cfb_enc.c \
|
||||
LIBSRC = des_enc.c cbc3_enc.c cbc_enc.c cfb64ede.c cfb64enc.c cfb_enc.c \
|
||||
ecb3_enc.c ede_enc.c fcrypt.c key_par.c ncbc_enc.c ofb64ede.c \
|
||||
ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c read_pwd.c rnd_keys.c \
|
||||
str2key.c cbc_cksm.c ecb_enc.c set_key.c md4.c md5.c sha.c
|
||||
str2key.c cbc_cksm.c ecb_enc.c set_key.c xcbc_enc.c md4.c md5.c sha.c
|
||||
|
||||
LIBOBJ = cbc3_enc.o cbc_enc.o cfb64ede.o cfb64enc.o cfb_enc.o \
|
||||
LIBOBJ = des_enc.o cbc3_enc.o cbc_enc.o cfb64ede.o cfb64enc.o cfb_enc.o \
|
||||
ecb3_enc.o ede_enc.o fcrypt.o key_par.o ncbc_enc.o ofb64ede.o \
|
||||
ofb64enc.o ofb_enc.o pcbc_enc.o qud_cksm.o read_pwd.o rnd_keys.o \
|
||||
str2key.o cbc_cksm.o ecb_enc.o set_key.o md4.o md5.o sha.o
|
||||
str2key.o cbc_cksm.o ecb_enc.o set_key.o xcbc_enc.o md4.o md5.o sha.o
|
||||
|
||||
all: $(LIB) $(PROGS)
|
||||
|
||||
@@ -112,6 +112,7 @@ $(LIBNAME).$(SHLIBEXT): $(LIBOBJ)
|
||||
# rule, so we might as well put them here.
|
||||
|
||||
mdtest.o: mdtest.c
|
||||
des_opts.o: des_opts.c
|
||||
destest.o: destest.c
|
||||
des.o: des.c
|
||||
rpw.o: rpw.c
|
||||
@@ -120,6 +121,9 @@ speed.o: speed.c
|
||||
mdtest$(EXECSUFFIX): mdtest.o $(LIB)
|
||||
$(CC) $(LD_FLAGS) $(LDFLAGS) -o $@ mdtest.o -L. -ldes
|
||||
|
||||
des_opts$(EXECSUFFIX): des_opts.o $(LIB)
|
||||
$(CC) $(LD_FLAGS) $(LDFLAGS) -o $@ des_opts.o -L. -ldes
|
||||
|
||||
destest$(EXECSUFFIX): destest.o $(LIB)
|
||||
$(CC) $(LD_FLAGS) $(LDFLAGS) -o $@ destest.o -L. -ldes
|
||||
|
||||
|
@@ -5,12 +5,14 @@
|
||||
DIR= des
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
CPP= cc -E
|
||||
INCLUDES=
|
||||
CFLAG=-g
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= makedepend -fMakefile.ssl
|
||||
MAKEFILE= Makefile.ssl
|
||||
DES_ENC= des_enc.o
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
@@ -23,18 +25,20 @@ LIBSRC= cbc3_enc.c cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \
|
||||
ecb3_enc.c ecb_enc.c ede_enc.c enc_read.c enc_writ.c \
|
||||
fcrypt.c ncbc_enc.c ofb64enc.c ofb_enc.c pcbc_enc.c \
|
||||
qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c \
|
||||
xcbc_enc.c des_enc.c \
|
||||
str2key.c cfb64ede.c ofb64ede.c supp.c
|
||||
|
||||
LIBOBJ= set_key.o ecb_enc.o ede_enc.o cbc_enc.o cbc3_enc.o \
|
||||
ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \
|
||||
enc_read.o enc_writ.o fcrypt.o ncbc_enc.o ofb64enc.o \
|
||||
ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \
|
||||
xcbc_enc.o ${DES_ENC} \
|
||||
read_pwd.o rpc_enc.o cbc_cksm.o supp.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= des.h
|
||||
HEADER= des_locl.h rpc_des.h podd.h sk.h spr.h version.h $(EXHEADER)
|
||||
HEADER= des_locl.h rpc_des.h podd.h sk.h spr.h des_ver.h $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
@@ -45,14 +49,29 @@ all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
ar r $(LIB) $(LIBOBJ)
|
||||
$(TOP)/util/ranlib.sh $(LIB)
|
||||
sh $(TOP)/util/ranlib.sh $(LIB)
|
||||
@touch lib
|
||||
|
||||
asm/dx86-elf.o: asm/dx86-cpp.s asm/dx86unix.cpp
|
||||
$(CPP) -DELF asm/dx86unix.cpp | as -o asm/dx86-elf.o
|
||||
|
||||
asm/dx86-sol.o: asm/dx86-cpp.s asm/dx86unix.cpp
|
||||
$(CPP) -DSOL asm/dx86unix.cpp | as -o asm/dx86-sol.o
|
||||
|
||||
asm/dx86-out.o: asm/dx86-cpp.s asm/dx86unix.cpp
|
||||
$(CPP) -DOUT asm/dx86unix.cpp | as -o asm/dx86-out.o
|
||||
|
||||
asm/dx86bsdi.o: asm/dx86-cpp.s asm/dx86unix.cpp
|
||||
$(CPP) -DBSDI asm/dx86unix.cpp | as -o asm/dx86bsdi.o
|
||||
|
||||
files:
|
||||
perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
/bin/rm -f Makefile
|
||||
$(TOP)/util/point.sh Makefile.ssl Makefile ;
|
||||
/bin/rm -f des.doc
|
||||
$(TOP)/util/point.sh ../../doc/des.doc . ;
|
||||
$(TOP)/util/point.sh ../../doc/des.doc des.doc ;
|
||||
$(TOP)/util/mklink.sh ../../include $(EXHEADER)
|
||||
$(TOP)/util/mklink.sh ../../test $(TEST)
|
||||
$(TOP)/util/mklink.sh ../../apps $(APPS)
|
||||
@@ -78,110 +97,12 @@ depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
sed -e '/^# DO NOT DELETE THIS LINE/ q' $(MAKEFILE) >Makefile.new
|
||||
perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
/bin/rm -f *.o *.obj lib tags core .nfs* *.old *.bak fluff
|
||||
/bin/rm -f *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
errors:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
cbc3_enc.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
cbc3_enc.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
cbc3_enc.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
cbc3_enc.o: /usr/include/sys/unistd.h des.h
|
||||
cbc_cksm.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
cbc_cksm.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
cbc_cksm.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
cbc_cksm.o: /usr/include/sys/unistd.h des.h
|
||||
cbc_enc.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
cbc_enc.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
cbc_enc.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
cbc_enc.o: /usr/include/sys/unistd.h des.h
|
||||
cfb64enc.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
cfb64enc.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
cfb64enc.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
cfb64enc.o: /usr/include/sys/unistd.h des.h
|
||||
cfb_enc.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
cfb_enc.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
cfb_enc.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
cfb_enc.o: /usr/include/sys/unistd.h des.h
|
||||
ecb3_enc.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
ecb3_enc.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
ecb3_enc.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
ecb3_enc.o: /usr/include/sys/unistd.h des.h
|
||||
ecb_enc.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
ecb_enc.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
ecb_enc.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
ecb_enc.o: /usr/include/sys/unistd.h des.h spr.h
|
||||
ede_enc.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
ede_enc.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
ede_enc.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
ede_enc.o: /usr/include/sys/unistd.h des.h
|
||||
enc_read.o: /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
enc_read.o: /usr/include/errno.h /usr/include/sys/errno.h des_locl.h
|
||||
enc_read.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
enc_read.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
enc_read.o: /usr/include/sys/unistd.h des.h
|
||||
enc_writ.o: /usr/include/errno.h /usr/include/sys/errno.h /usr/include/time.h
|
||||
enc_writ.o: /usr/include/sys/feature_tests.h des_locl.h /usr/include/stdio.h
|
||||
enc_writ.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
enc_writ.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
enc_writ.o: /usr/include/sys/unistd.h des.h
|
||||
fcrypt.o: /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
ncbc_enc.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
ncbc_enc.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
ncbc_enc.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
ncbc_enc.o: /usr/include/sys/unistd.h des.h
|
||||
ofb64enc.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
ofb64enc.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
ofb64enc.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
ofb64enc.o: /usr/include/sys/unistd.h des.h
|
||||
ofb_enc.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
ofb_enc.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
ofb_enc.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
ofb_enc.o: /usr/include/sys/unistd.h des.h
|
||||
pcbc_enc.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
pcbc_enc.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
pcbc_enc.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
pcbc_enc.o: /usr/include/sys/unistd.h des.h
|
||||
qud_cksm.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
qud_cksm.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
qud_cksm.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
qud_cksm.o: /usr/include/sys/unistd.h des.h
|
||||
rand_key.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
rand_key.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
rand_key.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
rand_key.o: /usr/include/sys/unistd.h des.h /usr/include/time.h
|
||||
read_pwd.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
read_pwd.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
read_pwd.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
read_pwd.o: /usr/include/sys/unistd.h des.h /usr/include/signal.h
|
||||
read_pwd.o: /usr/include/sys/signal.h /usr/include/string.h
|
||||
read_pwd.o: /usr/include/setjmp.h
|
||||
rpc_enc.o: rpc_des.h des_locl.h /usr/include/stdio.h
|
||||
rpc_enc.o: /usr/include/sys/feature_tests.h /usr/include/stdlib.h
|
||||
rpc_enc.o: /usr/include/unistd.h /usr/include/sys/types.h
|
||||
rpc_enc.o: /usr/include/sys/machtypes.h /usr/include/sys/unistd.h des.h
|
||||
rpc_enc.o: version.h
|
||||
set_key.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
set_key.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
set_key.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
set_key.o: /usr/include/sys/unistd.h des.h podd.h sk.h
|
||||
str2key.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
str2key.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
str2key.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
str2key.o: /usr/include/sys/unistd.h des.h
|
||||
cfb64ede.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
cfb64ede.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
cfb64ede.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
cfb64ede.o: /usr/include/sys/unistd.h des.h
|
||||
ofb64ede.o: des_locl.h /usr/include/stdio.h /usr/include/sys/feature_tests.h
|
||||
ofb64ede.o: /usr/include/stdlib.h /usr/include/unistd.h
|
||||
ofb64ede.o: /usr/include/sys/types.h /usr/include/sys/machtypes.h
|
||||
ofb64ede.o: /usr/include/sys/unistd.h des.h
|
||||
supp.o: /usr/include/stdio.h /usr/include/sys/feature_tests.h des_locl.h
|
||||
supp.o: /usr/include/stdlib.h /usr/include/unistd.h /usr/include/sys/types.h
|
||||
supp.o: /usr/include/sys/machtypes.h /usr/include/sys/unistd.h des.h
|
||||
|
@@ -18,28 +18,32 @@ OPTS0= -DRAND -DTERMIO #-DNOCONST
|
||||
# This will affect the -E/-D options on des(1).
|
||||
#OPTS1= -DOLD_STR_TO_KEY
|
||||
|
||||
# This #define specifies the use of an alternative D_ENCRYPT macro in
|
||||
# ecb_encrypt. The choice of macro can make a %20 difference in the
|
||||
# speed. Unfortunatly the choise of the best macro appears to be very
|
||||
# dependant on the compiler and the machine in question.
|
||||
# For the following combinations use the ALT_ECB option.
|
||||
# Sparc 2 (cc -O4), sun 3/260 (cc -O4)
|
||||
# For the following combinations do not use the ALT_ECB option.
|
||||
# Sparc 2 (gcc2 -O2), sun 3/260 (cc -O2), mvax2 (cc -O), MSDOS (Turbo Cv2)
|
||||
# For other machines, experiment with changing the option and run
|
||||
# ./speed to see which is faster.
|
||||
# DO NOT TURN THIS OPTION ON WHEN COMPILING THIS CODE ON A 64 BIT MACHINE
|
||||
# 12-Apr-1996 - It appears to be broken and I'm not bothering to fix
|
||||
# it right now, so don't use this option :-)
|
||||
#OPTS2= -DDES_PTR
|
||||
# There are 4 possible performance options
|
||||
# -DDES_PTR
|
||||
# -DDES_RISC1
|
||||
# -DDES_RISC2 (only one of DES_RISC1 and DES_RISC2)
|
||||
# -DDES_UNROLL
|
||||
# after the initial build, run 'des_opts' to see which options are best
|
||||
# for your platform. There are some listed in options.txt
|
||||
#OPTS2= -DDES_PTR
|
||||
#OPTS3= -DDES_RISC1 # or DES_RISC2
|
||||
OPTS4= -DDES_UNROLL
|
||||
|
||||
OPTS= $(OPTS0) $(OPTS1) $(OPTS2)
|
||||
OPTS= $(OPTS0) $(OPTS1) $(OPTS2) $(OPTS3) $(OPTS4)
|
||||
|
||||
#CC=cc
|
||||
#CFLAGS= -O $(OPTS) $(CFLAG)
|
||||
CC=cc
|
||||
CFLAGS= -D_HPUX_SOURCE -Aa +O2 $(OPTS) $(CFLAG)
|
||||
|
||||
CC=gcc
|
||||
CFLAGS= -O3 -fomit-frame-pointer $(OPTS) $(CFLAG)
|
||||
#CC=gcc
|
||||
#CFLAGS= -O3 -fomit-frame-pointer $(OPTS) $(CFLAG)
|
||||
|
||||
CPP=$(CC) -E
|
||||
|
||||
DES_ENC=des_enc.o # normal C version
|
||||
#DES_ENC=asm/dx86-elf.o # elf format x86
|
||||
#DES_ENC=asm/dx86-out.o # a.out format x86
|
||||
#DES_ENC=asm/dx86-sol.o # solaris format x86
|
||||
#DES_ENC=asm/dx86bsdi.o # bsdi format x86
|
||||
|
||||
LIBDIR=/usr/local/lib
|
||||
BINDIR=/usr/local/bin
|
||||
@@ -51,28 +55,65 @@ SHELL=/bin/sh
|
||||
OBJS= cbc3_enc.o cbc_cksm.o cbc_enc.o ncbc_enc.o pcbc_enc.o qud_cksm.o \
|
||||
cfb64ede.o cfb64enc.o cfb_enc.o ecb3_enc.o ecb_enc.o ede_enc.o \
|
||||
enc_read.o enc_writ.o fcrypt.o ofb64ede.o ofb64enc.o ofb_enc.o \
|
||||
rand_key.o read_pwd.o set_key.o rpc_enc.o str2key.o supp.o
|
||||
rand_key.o read_pwd.o set_key.o rpc_enc.o str2key.o supp.o \
|
||||
$(DES_ENC) xcbc_enc.o
|
||||
|
||||
GENERAL=COPYRIGHT FILES INSTALL Imakefile README VERSION Makefile \
|
||||
times vms.com KERBEROS MODES.DES GNUmakefile des.man \
|
||||
DES.pm DES.pod DES.xs Makefile.PL Makefile.uni typemap t \
|
||||
des_crypt.man Makefile.ssl des.doc makefile.bc des.org \
|
||||
des_locl.org
|
||||
GENERAL=$(GENERAL_LIT) FILES Imakefile times vms.com KERBEROS MODES.DES \
|
||||
GNUmakefile des.man DES.pm DES.pod DES.xs Makefile.PL \
|
||||
Makefile.uni typemap t Makefile.ssl makefile.bc Makefile.lit \
|
||||
des.org des_locl.org
|
||||
DES= des.c
|
||||
TESTING=destest.c speed.c rpw.c
|
||||
HEADERS=version.h des.h des_locl.h podd.h sk.h spr.h rpc_des.h
|
||||
LIBDES= cbc3_enc.c cbc_cksm.c cbc_enc.c ncbc_enc.c pcbc_enc.c qud_cksm.c \
|
||||
cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c ecb_enc.c ede_enc.c \
|
||||
enc_read.c enc_writ.c fcrypt.c ofb64ede.c ofb64enc.c ofb_enc.c \
|
||||
rand_key.c read_pwd.c set_key.c rpc_enc.c str2key.c supp.c
|
||||
TESTING=rpw.c $(TESTING_LIT)
|
||||
HEADERS= $(HEADERS_LIT) rpc_des.h
|
||||
LIBDES= cbc_cksm.c pcbc_enc.c qud_cksm.c \
|
||||
cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c cbc3_enc.c \
|
||||
enc_read.c enc_writ.c ofb64ede.c ofb64enc.c ofb_enc.c \
|
||||
rand_key.c rpc_enc.c str2key.c supp.c \
|
||||
xcbc_enc.c $(LIBDES_LIT) read_pwd.c
|
||||
|
||||
PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl
|
||||
TESTING_LIT=destest.c speed.c des_opts.c
|
||||
GENERAL_LIT=COPYRIGHT INSTALL README VERSION Makefile des_crypt.man \
|
||||
des.doc options.txt asm
|
||||
HEADERS_LIT=des_ver.h des.h des_locl.h podd.h sk.h spr.h
|
||||
LIBDES_LIT=ede_enc.c cbc_enc.c ncbc_enc.c ecb_enc.c fcrypt.c set_key.c des_enc.c
|
||||
|
||||
PERL= des.pl testdes.pl doIP doIP2 doPC1 doPC2 PC1 PC2 shifts.pl
|
||||
|
||||
ALL= $(GENERAL) $(DES) $(TESTING) $(LIBDES) $(PERL) $(HEADERS)
|
||||
|
||||
DLIB= libdes.a
|
||||
|
||||
all: $(DLIB) destest rpw des speed
|
||||
all: $(DLIB) destest rpw des speed des_opts
|
||||
|
||||
cc:
|
||||
make CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all
|
||||
|
||||
gcc:
|
||||
make CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all
|
||||
|
||||
x86-elf:
|
||||
make DES_ENC=asm/dx86-elf.o CC=gcc CFLAGS="-DELF -O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all
|
||||
|
||||
x86-out:
|
||||
make DES_ENC=asm/dx86-out.o CC=gcc CFLAGS="-DOUT -O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all
|
||||
|
||||
x86-solaris:
|
||||
make DES_ENC=asm/dx86-sol.o CFLAGS="-DSOL -O $(OPTS) $(CFLAG)" all
|
||||
|
||||
x86-bsdi:
|
||||
make DES_ENC=asm/dx86bsdi.o CC=gcc CFLAGS="-DBSDI -O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all
|
||||
|
||||
asm/dx86-elf.o: asm/dx86-cpp.s asm/dx86unix.cpp
|
||||
$(CPP) -DELF asm/dx86unix.cpp | as -o asm/dx86-elf.o
|
||||
|
||||
asm/dx86-sol.o: asm/dx86-cpp.s asm/dx86unix.cpp
|
||||
$(CPP) -DSOL asm/dx86unix.cpp | as -o asm/dx86-sol.o
|
||||
|
||||
asm/dx86-out.o: asm/dx86-cpp.s asm/dx86unix.cpp
|
||||
$(CPP) -DOUT asm/dx86unix.cpp | as -o asm/dx86-out.o
|
||||
|
||||
asm/dx86bsdi.o: asm/dx86-cpp.s asm/dx86unix.cpp
|
||||
$(CPP) -DBSDI asm/dx86unix.cpp | as -o asm/dx86bsdi.o
|
||||
|
||||
test: all
|
||||
./destest
|
||||
@@ -84,6 +125,9 @@ $(DLIB): $(OBJS)
|
||||
else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(DLIB); \
|
||||
else exit 0; fi; fi
|
||||
|
||||
des_opts: des_opts.o libdes.a
|
||||
$(CC) $(CFLAGS) -o des_opts des_opts.o libdes.a
|
||||
|
||||
destest: destest.o libdes.a
|
||||
$(CC) $(CFLAGS) -o destest destest.o libdes.a
|
||||
|
||||
@@ -99,6 +143,14 @@ des: des.o libdes.a
|
||||
tags:
|
||||
ctags $(DES) $(TESTING) $(LIBDES)
|
||||
|
||||
tar_lit:
|
||||
/bin/mv Makefile Makefile.tmp
|
||||
/bin/cp Makefile.lit Makefile
|
||||
tar chf libdes-l.tar $(LIBDES_LIT) $(HEADERS_LIT) \
|
||||
$(GENERAL_LIT) $(TESTING_LIT)
|
||||
/bin/rm -f Makefile
|
||||
/bin/mv Makefile.tmp Makefile
|
||||
|
||||
tar:
|
||||
tar chf libdes.tar $(ALL)
|
||||
|
||||
@@ -110,7 +162,7 @@ depend:
|
||||
|
||||
clean:
|
||||
/bin/rm -f *.o tags core rpw destest des speed $(DLIB) .nfs* *.old \
|
||||
*.bak destest rpw des speed
|
||||
*.bak destest rpw des_opts asm/*.o
|
||||
|
||||
dclean:
|
||||
sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new
|
||||
|
@@ -1,7 +1,7 @@
|
||||
|
||||
libdes, Version 3.21 21/11/95
|
||||
libdes, Version 4.01 13-Jan-97
|
||||
|
||||
Copyright (c) 1995, Eric Young
|
||||
Copyright (c) 1997, Eric Young
|
||||
All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -11,13 +11,13 @@
|
||||
The primary ftp site for this library is
|
||||
ftp://ftp.psy.uq.oz.au/pub/Crypto/DES/libdes-x.xx.tar.gz
|
||||
libdes is now also shipped with SSLeay. Primary ftp site of
|
||||
ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL/SSLeay-x.xx.tar.gz
|
||||
ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL/SSLeay-x.x.x.tar.gz
|
||||
|
||||
The best way to build this library is to build it as part of SSLeay.
|
||||
|
||||
This kit builds a DES encryption library and a DES encryption program.
|
||||
It supports ecb, cbc, ofb, cfb, triple ecb, triple cbc, triple ofb,
|
||||
triple cfb, and MIT's pcbc encryption modes and also has a fast
|
||||
triple cfb, desx, and MIT's pcbc encryption modes and also has a fast
|
||||
implementation of crypt(3).
|
||||
It contains support routines to read keys from a terminal,
|
||||
generate a random key, generate a key from an arbitrary length string,
|
||||
@@ -43,6 +43,12 @@ routines that use small lookup tables (4.5k) that are publicly available.
|
||||
The fcrypt routine is faster than ufc's fcrypt (when compiling with
|
||||
gcc2 -O2) on the sparc 2 (1410 vs 1270) but is not so good on other machines
|
||||
(on a sun3/260 168 vs 336). It is a function of CPU on chip cache size.
|
||||
[ 10-Jan-97 and a function of an incorrect speed testing program in
|
||||
ufc which gave much better test figures that reality ].
|
||||
|
||||
Eric Young (eay@mincom.oz.au or eay@psych.psy.uq.oz.au)
|
||||
It is worth noting that on sparc and Alpha CPUs, performance of the DES
|
||||
library can vary by upto %10 due to the positioning of files after application
|
||||
linkage.
|
||||
|
||||
Eric Young (eay@mincom.oz.au)
|
||||
|
||||
|
@@ -1,4 +1,59 @@
|
||||
Version 3.23 11/04/95
|
||||
Version 4.01 14/01/97
|
||||
Even faster inner loop in the DES assember for x86 and a modification
|
||||
for IP/FP which is faster on x86. Both of these changes are
|
||||
from Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk>. His
|
||||
changes make the assember run %40 faster on a pentium. This is just
|
||||
a case of getting the instruction sequence 'just right'.
|
||||
All credit to 'Svend' :-)
|
||||
Quite a few special x86 'make' targets.
|
||||
A libdes-l (lite) distribution.
|
||||
|
||||
Version 4.00
|
||||
After a bit of a pause, I'll up the major version number since this
|
||||
is mostly a performace release. I've added x86 assember and
|
||||
added more options for performance. A %28 speedup for gcc
|
||||
on a pentium and the assember is a %50 speedup.
|
||||
MIPS CPU's, sparc and Alpha are the main CPU's with speedups.
|
||||
Run des_opts to work out which options should be used.
|
||||
DES_RISC1/DES_RISC2 use alternative inner loops which use
|
||||
more registers but should give speedups on any CPU that does
|
||||
dual issue (pentium). DES_UNROLL unrolls the inner loop,
|
||||
which costs in code size.
|
||||
|
||||
Version 3.26
|
||||
I've finally removed one of the shifts in D_ENCRYPT. This
|
||||
meant I've changed the des_SPtrans table (spr.h), the set_key()
|
||||
function and some things in des_enc.c. This has definitly
|
||||
made things faster :-). I've known about this one for some
|
||||
time but I've been too lazy to follow it up :-).
|
||||
Noticed that in the D_ENCRYPT() macro, we can just do L^=(..)^(..)^..
|
||||
instead of L^=((..)|(..)|(..).. This should save a register at
|
||||
least.
|
||||
Assember for x86. The file to replace is des_enc.c, which is replaced
|
||||
by one of the assember files found in asm. Look at des/asm/readme
|
||||
for more info.
|
||||
|
||||
/* Modification to fcrypt so it can be compiled to support
|
||||
HPUX 10.x's long password format, define -DLONGCRYPT to use this.
|
||||
Thanks to Jens Kupferschmidt <bt1cu@hpboot.rz.uni-leipzig.de>. */
|
||||
|
||||
SIGWINCH case put in des_read_passwd() so the function does not
|
||||
'exit' if this function is recieved.
|
||||
|
||||
Version 3.25 17/07/96
|
||||
Modified read_pwd.c so that stdin can be read if not a tty.
|
||||
Thanks to Jeff Barber <jeffb@issl.atl.hp.com> for the patches.
|
||||
des_init_random_number_generator() shortened due to VMS linker
|
||||
limits.
|
||||
Added RSA's DESX cbc mode. It is a form of cbc encryption, with 2
|
||||
8 byte quantites xored before and after encryption.
|
||||
des_xcbc_encryption() - the name is funny to preserve the des_
|
||||
prefix on all functions.
|
||||
|
||||
Version 3.24 20/04/96
|
||||
The DES_PTR macro option checked and used by SSLeay configuration
|
||||
|
||||
Version 3.23 11/04/96
|
||||
Added DES_LONG. If defined to 'unsigned int' on the DEC Alpha,
|
||||
it gives a %20 speedup :-)
|
||||
Fixed the problem with des.pl under perl5. The patches were
|
||||
|
@@ -146,6 +146,20 @@ int enc);
|
||||
des_cbc_encrypt accept that ivec is updates with the correct value
|
||||
to pass in subsequent calls to des_ncbc_encrypt(). I advise using
|
||||
des_ncbc_encrypt() instead of des_cbc_encrypt();
|
||||
|
||||
void des_xcbc_encrypt(
|
||||
des_cblock *input,
|
||||
des_cblock *output,
|
||||
long length,
|
||||
des_key_schedule sk,
|
||||
des_cblock *ivec,
|
||||
des_cblock *inw,
|
||||
des_cblock *outw,
|
||||
int enc);
|
||||
This is RSA's DESX mode of DES. It uses inw and outw to
|
||||
'whiten' the encryption. inw and outw are secret (unlike the iv)
|
||||
and are as such, part of the key. So the key is sort of 24 bytes.
|
||||
This is much better than cbc des.
|
||||
|
||||
void des_3cbc_encrypt(
|
||||
des_cblock *input,
|
||||
@@ -303,12 +317,23 @@ des_cblock *ivec);
|
||||
function is used by Kerberos v4 so that is why it stays in the
|
||||
library.
|
||||
|
||||
char *des_fcrypt(
|
||||
const char *buf,
|
||||
const char *salt
|
||||
char *ret);
|
||||
This is my fast version of the unix crypt(3) function. This version
|
||||
takes only a small amount of space relative to other fast
|
||||
crypt() implementations. This is different to the normal crypt
|
||||
in that the third parameter is the buffer that the return value
|
||||
is written into. It needs to be at least 14 bytes long. This
|
||||
function is thread safe, unlike the normal crypt.
|
||||
|
||||
char *crypt(
|
||||
const char *buf,
|
||||
const char *salt);
|
||||
This is my fast version of the unix crypt(3) function. This version
|
||||
takes only a small amount of space relative to other fast
|
||||
crypt() implementations.
|
||||
This function calls des_fcrypt() with a static array passed as the
|
||||
third parameter. This emulates the normal non-thread safe semantics
|
||||
of crypt(3).
|
||||
|
||||
void des_string_to_key(
|
||||
char *str,
|
||||
|
@@ -1,17 +1,22 @@
|
||||
/* lib/des/des.h */
|
||||
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
|
||||
/* crypto/des/des.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file is part of an SSL implementation written
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@mincom.oz.au).
|
||||
* The implementation was written so as to conform with Netscapes SSL
|
||||
* specification. This library and applications are
|
||||
* FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
|
||||
* as long as the following conditions are aheared to.
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* 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, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed. If this code is used in a product,
|
||||
* Eric Young should be given attribution as the author of the parts used.
|
||||
* 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 the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
@@ -25,7 +30,13 @@
|
||||
* 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@mincom.oz.au)
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@mincom.oz.au)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -48,6 +59,10 @@
|
||||
#ifndef HEADER_DES_H
|
||||
#define HEADER_DES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
|
||||
@@ -96,8 +111,10 @@ typedef struct des_ks_struct
|
||||
|
||||
#define C_Block des_cblock
|
||||
#define Key_schedule des_key_schedule
|
||||
#ifdef KERBEROS
|
||||
#define ENCRYPT DES_ENCRYPT
|
||||
#define DECRYPT DES_DECRYPT
|
||||
#endif
|
||||
#define KEY_SZ DES_KEY_SZ
|
||||
#define string_to_key des_string_to_key
|
||||
#define read_pw_string des_read_pw_string
|
||||
@@ -108,6 +125,7 @@ typedef struct des_ks_struct
|
||||
#define ecb_encrypt des_ecb_encrypt
|
||||
#define cbc_encrypt des_cbc_encrypt
|
||||
#define ncbc_encrypt des_ncbc_encrypt
|
||||
#define xcbc_encrypt des_xcbc_encrypt
|
||||
#define cbc_cksum des_cbc_cksum
|
||||
#define quad_cksum des_quad_cksum
|
||||
|
||||
@@ -130,6 +148,7 @@ extern "C" {
|
||||
#undef NOPROTO
|
||||
#endif
|
||||
#ifndef NOPROTO
|
||||
char *des_options(void);
|
||||
void des_ecb3_encrypt(des_cblock *input,des_cblock *output,
|
||||
des_key_schedule ks1,des_key_schedule ks2,
|
||||
des_key_schedule ks3, int enc);
|
||||
@@ -139,6 +158,9 @@ void des_cbc_encrypt(des_cblock *input,des_cblock *output,long length,
|
||||
des_key_schedule schedule,des_cblock *ivec,int enc);
|
||||
void des_ncbc_encrypt(des_cblock *input,des_cblock *output,long length,
|
||||
des_key_schedule schedule,des_cblock *ivec,int enc);
|
||||
void des_xcbc_encrypt(des_cblock *input,des_cblock *output,long length,
|
||||
des_key_schedule schedule,des_cblock *ivec,
|
||||
des_cblock *inw,des_cblock *outw,int enc);
|
||||
void des_3cbc_encrypt(des_cblock *input,des_cblock *output,long length,
|
||||
des_key_schedule sk1,des_key_schedule sk2,
|
||||
des_cblock *ivec1,des_cblock *ivec2,int enc);
|
||||
@@ -148,6 +170,10 @@ void des_ecb_encrypt(des_cblock *input,des_cblock *output,
|
||||
des_key_schedule ks,int enc);
|
||||
void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc);
|
||||
void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc);
|
||||
void des_encrypt3(DES_LONG *data, des_key_schedule ks1,
|
||||
des_key_schedule ks2, des_key_schedule ks3);
|
||||
void des_decrypt3(DES_LONG *data, des_key_schedule ks1,
|
||||
des_key_schedule ks2, des_key_schedule ks3);
|
||||
void des_ede3_cbc_encrypt(des_cblock *input, des_cblock *output,
|
||||
long length, des_key_schedule ks1, des_key_schedule ks2,
|
||||
des_key_schedule ks3, des_cblock *ivec, int enc);
|
||||
@@ -162,6 +188,7 @@ int des_enc_read(int fd,char *buf,int len,des_key_schedule sched,
|
||||
des_cblock *iv);
|
||||
int des_enc_write(int fd,char *buf,int len,des_key_schedule sched,
|
||||
des_cblock *iv);
|
||||
char *des_fcrypt(const char *buf,const char *salt, char *ret);
|
||||
#ifdef PERL5
|
||||
char *des_crypt(const char *buf,const char *salt);
|
||||
#else
|
||||
@@ -210,10 +237,12 @@ void des_rand_data(unsigned char *data, int size);
|
||||
|
||||
#else
|
||||
|
||||
char *des_options();
|
||||
void des_ecb3_encrypt();
|
||||
DES_LONG des_cbc_cksum();
|
||||
void des_cbc_encrypt();
|
||||
void des_ncbc_encrypt();
|
||||
void des_xcbc_encrypt();
|
||||
void des_3cbc_encrypt();
|
||||
void des_cfb_encrypt();
|
||||
void des_ede3_cfb64_encrypt();
|
||||
@@ -221,9 +250,12 @@ void des_ede3_ofb64_encrypt();
|
||||
void des_ecb_encrypt();
|
||||
void des_encrypt();
|
||||
void des_encrypt2();
|
||||
void des_encrypt3();
|
||||
void des_decrypt3();
|
||||
void des_ede3_cbc_encrypt();
|
||||
int des_enc_read();
|
||||
int des_enc_write();
|
||||
char *des_fcrypt();
|
||||
#ifdef PERL5
|
||||
char *des_crypt();
|
||||
#else
|
||||
|
@@ -1,17 +1,22 @@
|
||||
/* lib/des/des.h */
|
||||
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
|
||||
/* crypto/des/des.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file is part of an SSL implementation written
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@mincom.oz.au).
|
||||
* The implementation was written so as to conform with Netscapes SSL
|
||||
* specification. This library and applications are
|
||||
* FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
|
||||
* as long as the following conditions are aheared to.
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* 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, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed. If this code is used in a product,
|
||||
* Eric Young should be given attribution as the author of the parts used.
|
||||
* 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 the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
@@ -25,7 +30,13 @@
|
||||
* 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@mincom.oz.au)
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@mincom.oz.au)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -48,6 +59,10 @@
|
||||
#ifndef HEADER_DES_H
|
||||
#define HEADER_DES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
|
||||
@@ -92,8 +107,10 @@ typedef struct des_ks_struct
|
||||
|
||||
#define C_Block des_cblock
|
||||
#define Key_schedule des_key_schedule
|
||||
#ifdef KERBEROS
|
||||
#define ENCRYPT DES_ENCRYPT
|
||||
#define DECRYPT DES_DECRYPT
|
||||
#endif
|
||||
#define KEY_SZ DES_KEY_SZ
|
||||
#define string_to_key des_string_to_key
|
||||
#define read_pw_string des_read_pw_string
|
||||
@@ -104,6 +121,7 @@ typedef struct des_ks_struct
|
||||
#define ecb_encrypt des_ecb_encrypt
|
||||
#define cbc_encrypt des_cbc_encrypt
|
||||
#define ncbc_encrypt des_ncbc_encrypt
|
||||
#define xcbc_encrypt des_xcbc_encrypt
|
||||
#define cbc_cksum des_cbc_cksum
|
||||
#define quad_cksum des_quad_cksum
|
||||
|
||||
@@ -122,6 +140,7 @@ extern int des_rw_mode; /* defaults to DES_PCBC_MODE */
|
||||
#undef NOPROTO
|
||||
#endif
|
||||
#ifndef NOPROTO
|
||||
char *des_options(void);
|
||||
void des_ecb3_encrypt(des_cblock *input,des_cblock *output,
|
||||
des_key_schedule ks1,des_key_schedule ks2,
|
||||
des_key_schedule ks3, int enc);
|
||||
@@ -131,6 +150,9 @@ void des_cbc_encrypt(des_cblock *input,des_cblock *output,long length,
|
||||
des_key_schedule schedule,des_cblock *ivec,int enc);
|
||||
void des_ncbc_encrypt(des_cblock *input,des_cblock *output,long length,
|
||||
des_key_schedule schedule,des_cblock *ivec,int enc);
|
||||
void des_xcbc_encrypt(des_cblock *input,des_cblock *output,long length,
|
||||
des_key_schedule schedule,des_cblock *ivec,
|
||||
des_cblock *inw,des_cblock *outw,int enc);
|
||||
void des_3cbc_encrypt(des_cblock *input,des_cblock *output,long length,
|
||||
des_key_schedule sk1,des_key_schedule sk2,
|
||||
des_cblock *ivec1,des_cblock *ivec2,int enc);
|
||||
@@ -140,6 +162,10 @@ void des_ecb_encrypt(des_cblock *input,des_cblock *output,
|
||||
des_key_schedule ks,int enc);
|
||||
void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc);
|
||||
void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc);
|
||||
void des_encrypt3(DES_LONG *data, des_key_schedule ks1,
|
||||
des_key_schedule ks2, des_key_schedule ks3);
|
||||
void des_decrypt3(DES_LONG *data, des_key_schedule ks1,
|
||||
des_key_schedule ks2, des_key_schedule ks3);
|
||||
void des_ede3_cbc_encrypt(des_cblock *input, des_cblock *output,
|
||||
long length, des_key_schedule ks1, des_key_schedule ks2,
|
||||
des_key_schedule ks3, des_cblock *ivec, int enc);
|
||||
@@ -154,6 +180,7 @@ int des_enc_read(int fd,char *buf,int len,des_key_schedule sched,
|
||||
des_cblock *iv);
|
||||
int des_enc_write(int fd,char *buf,int len,des_key_schedule sched,
|
||||
des_cblock *iv);
|
||||
char *des_fcrypt(const char *buf,const char *salt, char *ret);
|
||||
#ifdef PERL5
|
||||
char *des_crypt(const char *buf,const char *salt);
|
||||
#else
|
||||
@@ -201,10 +228,12 @@ void des_generate_random_block(des_cblock *block);
|
||||
|
||||
#else
|
||||
|
||||
char *des_options();
|
||||
void des_ecb3_encrypt();
|
||||
DES_LONG des_cbc_cksum();
|
||||
void des_cbc_encrypt();
|
||||
void des_ncbc_encrypt();
|
||||
void des_xcbc_encrypt();
|
||||
void des_3cbc_encrypt();
|
||||
void des_cfb_encrypt();
|
||||
void des_ede3_cfb64_encrypt();
|
||||
@@ -212,9 +241,12 @@ void des_ede3_ofb64_encrypt();
|
||||
void des_ecb_encrypt();
|
||||
void des_encrypt();
|
||||
void des_encrypt2();
|
||||
void des_encrypt3();
|
||||
void des_decrypt3();
|
||||
void des_ede3_cbc_encrypt();
|
||||
int des_enc_read();
|
||||
int des_enc_write();
|
||||
char *des_fcrypt();
|
||||
#ifdef PERL5
|
||||
char *des_crypt();
|
||||
#else
|
||||
@@ -242,11 +274,18 @@ void des_cblock_print_file();
|
||||
/* The following functions are not in the normal unix build or the
|
||||
* SSLeay build. When using the SSLeay build, use RAND_seed()
|
||||
* and RAND_bytes() instead. */
|
||||
#ifdef FreeBSD
|
||||
int des_new_random_key();
|
||||
void des_init_random_number_generator();
|
||||
void des_set_random_generator_seed();
|
||||
void des_set_sequence_number();
|
||||
void des_generate_random_block();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -34,6 +34,8 @@
|
||||
|
||||
package des;
|
||||
|
||||
eval("usr integer;") if (int($]) > 4);
|
||||
|
||||
# The following 8 arrays are used in des_set_key
|
||||
@skb0=(
|
||||
# for C bits (numbered as per FIPS 46) 1 2 3 4 5 6
|
||||
@@ -408,9 +410,9 @@ sub doPC1
|
||||
$t=(($b<<24)^$b)&0xff000000;
|
||||
$b=$b^$t^(($t>>24)&0x000000ff);
|
||||
$t=(($b<< 8)^$b)&0x00ff0000;
|
||||
$b=$b^$t^($t>> 8);
|
||||
$b=$b^$t^(($t>> 8)&0x00ffffff);
|
||||
$t=(($b<<14)^$b)&0x33330000;
|
||||
$b=$b^$t^($t>>14);
|
||||
$b=$b^$t^(($t>>14)&0x0003ffff);
|
||||
$b=(($b&0x00aa00aa)<<7)|(($b&0x55005500)>>7)|($b&0xaa55aa55);
|
||||
$b=(($b>>8)&0x00ffffff)|((($a&0xf0000000)>>4)&0x0fffffff);
|
||||
$a&=0x0fffffff;
|
||||
@@ -478,10 +480,12 @@ sub main'des_ecb_encrypt
|
||||
{
|
||||
for ($i=0; $i<32; $i+=4)
|
||||
{
|
||||
$t=(($r<<1)|(($r>>31)&0x1))&0xffffffff;
|
||||
$t=((($r&0x7fffffff)<<1)|(($r>>31)&0x00000001));
|
||||
$u=$t^$ks[$i ];
|
||||
$t=$t^$ks[$i+1];
|
||||
$t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff;
|
||||
$t2=(($t&0x0000000f)<<28);
|
||||
|
||||
$t=((($t>>4)&0x0fffffff)|(($t&0x0000000f)<<28));
|
||||
$l^= $SP1[ $t &0x3f]|
|
||||
$SP3[($t>> 8)&0x3f]|
|
||||
$SP5[($t>>16)&0x3f]|
|
||||
|
@@ -59,20 +59,25 @@
|
||||
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
/* lib/des/des_locl.h */
|
||||
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
|
||||
/* crypto/des/des_locl.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file is part of an SSL implementation written
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@mincom.oz.au).
|
||||
* The implementation was written so as to conform with Netscapes SSL
|
||||
* specification. This library and applications are
|
||||
* FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
|
||||
* as long as the following conditions are aheared to.
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* 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, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed. If this code is used in a product,
|
||||
* Eric Young should be given attribution as the author of the parts used.
|
||||
* 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 the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
@@ -86,7 +91,13 @@
|
||||
* 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@mincom.oz.au)
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@mincom.oz.au)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -106,8 +117,23 @@
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
*
|
||||
* Always modify des_locl.org since des_locl.h is automatically generated from
|
||||
* it during SSLeay configuration.
|
||||
*
|
||||
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DES_LOCL_H
|
||||
#define HEADER_DES_LOCL_H
|
||||
|
||||
#if defined(WIN32) || defined(WIN16)
|
||||
#ifndef MSDOS
|
||||
#define MSDOS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
@@ -118,22 +144,79 @@
|
||||
#endif
|
||||
#include "des.h"
|
||||
|
||||
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
*
|
||||
* Always modify des_locl.org since des_locl.h is automatically generated from
|
||||
* it during SSLeay configuration.
|
||||
*
|
||||
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
*/
|
||||
|
||||
#ifndef DES_DEFAULT_OPTIONS
|
||||
/* the following is tweaked from a config script, that is why it is a
|
||||
* protected undef/define */
|
||||
#ifndef DES_PTR
|
||||
#undef DES_PTR
|
||||
#endif
|
||||
|
||||
/* This helps C compiler generate the correct code for multiple functional
|
||||
* units. It reduces register dependancies at the expense of 2 more
|
||||
* registers */
|
||||
#ifndef DES_RISC1
|
||||
#undef DES_RISC1
|
||||
#endif
|
||||
|
||||
#ifndef DES_RISC2
|
||||
#undef DES_RISC2
|
||||
#endif
|
||||
|
||||
#if defined(DES_RISC1) && defined(DES_RISC2)
|
||||
YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
|
||||
#endif
|
||||
|
||||
/* Unroll the inner loop, this sometimes helps, sometimes hinders.
|
||||
* Very mucy CPU dependant */
|
||||
#ifndef DES_UNROLL
|
||||
#undef DES_UNROLL
|
||||
#endif
|
||||
|
||||
/* These default values were supplied by
|
||||
* Peter Gutman <pgut001@cs.auckland.ac.nz>
|
||||
* They are only used if nothing else has been defined */
|
||||
#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
|
||||
/* Special defines which change the way the code is built depending on the
|
||||
CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
|
||||
even newer MIPS CPU's, but at the moment one size fits all for
|
||||
optimization options. Older Sparc's work better with only UNROLL, but
|
||||
there's no way to tell at compile time what it is you're running on */
|
||||
|
||||
#if defined( sun ) /* Newer Sparc's */
|
||||
#define DES_PTR
|
||||
#define DES_RISC1
|
||||
#define DES_UNROLL
|
||||
#elif defined( __ultrix ) /* Older MIPS */
|
||||
#define DES_PTR
|
||||
#define DES_RISC2
|
||||
#define DES_UNROLL
|
||||
#elif defined( __osf1__ ) /* Alpha */
|
||||
#define DES_PTR
|
||||
#define DES_RISC2
|
||||
#elif defined ( _AIX ) /* RS6000 */
|
||||
/* Unknown */
|
||||
#elif defined( __hpux ) /* HP-PA */
|
||||
#define DES_UNROLL
|
||||
#elif defined( __aux ) /* 68K */
|
||||
/* Unknown */
|
||||
#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
|
||||
#define DES_UNROLL
|
||||
#elif defined( __sgi ) /* Newer MIPS */
|
||||
#define DES_PTR
|
||||
#define DES_RISC2
|
||||
#define DES_UNROLL
|
||||
#elif defined( i386 ) /* x86 boxes, should be gcc */
|
||||
#define DES_PTR
|
||||
#define DES_RISC1
|
||||
#define DES_UNROLL
|
||||
#endif /* Systems-specific speed defines */
|
||||
#endif
|
||||
|
||||
#endif /* DES_DEFAULT_OPTIONS */
|
||||
|
||||
#ifdef MSDOS /* Visual C++ 2.1 (Windows NT/95) */
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <io.h>
|
||||
#ifndef RAND
|
||||
@@ -156,7 +239,6 @@
|
||||
|
||||
#ifdef MSDOS
|
||||
#define getpid() 2
|
||||
extern int errno;
|
||||
#define RAND
|
||||
#undef NOPROTO
|
||||
#endif
|
||||
@@ -236,6 +318,32 @@ extern int errno;
|
||||
} \
|
||||
}
|
||||
|
||||
#if defined(WIN32)
|
||||
#define ROTATE(a,n) (_lrotr(a,n))
|
||||
#else
|
||||
#define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n))))
|
||||
#endif
|
||||
|
||||
/* Don't worry about the LOAD_DATA() stuff, that is used by
|
||||
* fcrypt() to add it's little bit to the front */
|
||||
|
||||
#ifdef DES_FCRYPT
|
||||
|
||||
#define LOAD_DATA_tmp(R,S,u,t,E0,E1) \
|
||||
{ DES_LONG tmp; LOAD_DATA(R,S,u,t,E0,E1,tmp); }
|
||||
|
||||
#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \
|
||||
t=R^(R>>16L); \
|
||||
u=t&E0; t&=E1; \
|
||||
tmp=(u<<16); u^=R^s[S ]; u^=tmp; \
|
||||
tmp=(t<<16); t^=R^s[S+1]; t^=tmp
|
||||
#else
|
||||
#define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g)
|
||||
#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \
|
||||
u=R^s[S ]; \
|
||||
t=R^s[S+1]
|
||||
#endif
|
||||
|
||||
/* The changes to this macro may help or hinder, depending on the
|
||||
* compiler and the achitecture. gcc2 always seems to do well :-).
|
||||
* Inspired by Dana How <how@isl.stanford.edu>
|
||||
@@ -244,47 +352,158 @@ extern int errno;
|
||||
* bytes, probably an issue of accessing non-word aligned objects :-( */
|
||||
#ifdef DES_PTR
|
||||
|
||||
#define D_ENCRYPT(L,R,S) { \
|
||||
u=((R^s[S ])<<2); \
|
||||
t= R^s[S+1]; \
|
||||
t=((t>>2)+(t<<30)); \
|
||||
L^= (\
|
||||
*(DES_LONG *)(&(des_SPtrans[1][0])+((t )&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[3][0])+((t>> 8)&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[5][0])+((t>>16)&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[7][0])+((t>>24)&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[0][0])+((u )&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[2][0])+((u>> 8)&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[4][0])+((u>>16)&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[6][0])+((u>>24)&0xfc))); }
|
||||
#else /* original version */
|
||||
#ifdef MSDOS
|
||||
#define D_ENCRYPT(L,R,S) \
|
||||
U.l=R^s[S+1]; \
|
||||
T.s[0]=((U.s[0]>>4)|(U.s[1]<<12))&0x3f3f; \
|
||||
T.s[1]=((U.s[1]>>4)|(U.s[0]<<12))&0x3f3f; \
|
||||
U.l=(R^s[S ])&0x3f3f3f3fL; \
|
||||
L^= des_SPtrans[1][(T.c[0])]| \
|
||||
des_SPtrans[3][(T.c[1])]| \
|
||||
des_SPtrans[5][(T.c[2])]| \
|
||||
des_SPtrans[7][(T.c[3])]| \
|
||||
des_SPtrans[0][(U.c[0])]| \
|
||||
des_SPtrans[2][(U.c[1])]| \
|
||||
des_SPtrans[4][(U.c[2])]| \
|
||||
des_SPtrans[6][(U.c[3])];
|
||||
/* It recently occured to me that 0^0^0^0^0^0^0 == 0, so there
|
||||
* is no reason to not xor all the sub items together. This potentially
|
||||
* saves a register since things can be xored directly into L */
|
||||
|
||||
#if defined(DES_RISC1) || defined(DES_RISC2)
|
||||
#ifdef DES_RISC1
|
||||
#define D_ENCRYPT(LL,R,S) { \
|
||||
unsigned int u1,u2,u3; \
|
||||
LOAD_DATA(R,S,u,t,E0,E1,u1); \
|
||||
u2=(int)u>>8L; \
|
||||
u1=(int)u&0xfc; \
|
||||
u2&=0xfc; \
|
||||
t=ROTATE(t,4); \
|
||||
u>>=16L; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \
|
||||
u3=(int)(u>>8L); \
|
||||
u1=(int)u&0xfc; \
|
||||
u3&=0xfc; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+u1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+u3); \
|
||||
u2=(int)t>>8L; \
|
||||
u1=(int)t&0xfc; \
|
||||
u2&=0xfc; \
|
||||
t>>=16L; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \
|
||||
u3=(int)t>>8L; \
|
||||
u1=(int)t&0xfc; \
|
||||
u3&=0xfc; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+u1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+u3); }
|
||||
#endif
|
||||
#ifdef DES_RISC2
|
||||
#define D_ENCRYPT(LL,R,S) { \
|
||||
unsigned int u1,u2,s1,s2; \
|
||||
LOAD_DATA(R,S,u,t,E0,E1,u1); \
|
||||
u2=(int)u>>8L; \
|
||||
u1=(int)u&0xfc; \
|
||||
u2&=0xfc; \
|
||||
t=ROTATE(t,4); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \
|
||||
s1=(int)(u>>16L); \
|
||||
s2=(int)(u>>24L); \
|
||||
s1&=0xfc; \
|
||||
s2&=0xfc; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+s1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+s2); \
|
||||
u2=(int)t>>8L; \
|
||||
u1=(int)t&0xfc; \
|
||||
u2&=0xfc; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \
|
||||
s1=(int)(t>>16L); \
|
||||
s2=(int)(t>>24L); \
|
||||
s1&=0xfc; \
|
||||
s2&=0xfc; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+s1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+s2); }
|
||||
#endif
|
||||
#else
|
||||
#define D_ENCRYPT(Q,R,S) {\
|
||||
u=(R^s[S ]); \
|
||||
t=R^s[S+1]; \
|
||||
t=((t>>4L)+(t<<28L)); \
|
||||
Q^= des_SPtrans[1][(t )&0x3f]| \
|
||||
des_SPtrans[3][(t>> 8L)&0x3f]| \
|
||||
des_SPtrans[5][(t>>16L)&0x3f]| \
|
||||
des_SPtrans[7][(t>>24L)&0x3f]| \
|
||||
des_SPtrans[0][(u )&0x3f]| \
|
||||
des_SPtrans[2][(u>> 8L)&0x3f]| \
|
||||
des_SPtrans[4][(u>>16L)&0x3f]| \
|
||||
des_SPtrans[6][(u>>24L)&0x3f]; }
|
||||
#define D_ENCRYPT(LL,R,S) { \
|
||||
LOAD_DATA_tmp(R,S,u,t,E0,E1); \
|
||||
t=ROTATE(t,4); \
|
||||
LL^= \
|
||||
*(DES_LONG *)((unsigned char *)des_SP +((u )&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x200+((u>> 8L)&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x400+((u>>16L)&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x600+((u>>24L)&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x100+((t )&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x300+((t>> 8L)&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x500+((t>>16L)&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x700+((t>>24L)&0xfc)); }
|
||||
#endif
|
||||
|
||||
#else /* original version */
|
||||
|
||||
#if defined(DES_RISC1) || defined(DES_RISC2)
|
||||
#ifdef DES_RISC1
|
||||
#define D_ENCRYPT(LL,R,S) {\
|
||||
unsigned int u1,u2,u3; \
|
||||
LOAD_DATA(R,S,u,t,E0,E1,u1); \
|
||||
u>>=2L; \
|
||||
t=ROTATE(t,6); \
|
||||
u2=(int)u>>8L; \
|
||||
u1=(int)u&0x3f; \
|
||||
u2&=0x3f; \
|
||||
u>>=16L; \
|
||||
LL^=des_SPtrans[0][u1]; \
|
||||
LL^=des_SPtrans[2][u2]; \
|
||||
u3=(int)u>>8L; \
|
||||
u1=(int)u&0x3f; \
|
||||
u3&=0x3f; \
|
||||
LL^=des_SPtrans[4][u1]; \
|
||||
LL^=des_SPtrans[6][u3]; \
|
||||
u2=(int)t>>8L; \
|
||||
u1=(int)t&0x3f; \
|
||||
u2&=0x3f; \
|
||||
t>>=16L; \
|
||||
LL^=des_SPtrans[1][u1]; \
|
||||
LL^=des_SPtrans[3][u2]; \
|
||||
u3=(int)t>>8L; \
|
||||
u1=(int)t&0x3f; \
|
||||
u3&=0x3f; \
|
||||
LL^=des_SPtrans[5][u1]; \
|
||||
LL^=des_SPtrans[7][u3]; }
|
||||
#endif
|
||||
#ifdef DES_RISC2
|
||||
#define D_ENCRYPT(LL,R,S) {\
|
||||
unsigned int u1,u2,s1,s2; \
|
||||
LOAD_DATA(R,S,u,t,E0,E1,u1); \
|
||||
u>>=2L; \
|
||||
t=ROTATE(t,6); \
|
||||
u2=(int)u>>8L; \
|
||||
u1=(int)u&0x3f; \
|
||||
u2&=0x3f; \
|
||||
LL^=des_SPtrans[0][u1]; \
|
||||
LL^=des_SPtrans[2][u2]; \
|
||||
s1=(int)u>>16L; \
|
||||
s2=(int)u>>24L; \
|
||||
s1&=0x3f; \
|
||||
s2&=0x3f; \
|
||||
LL^=des_SPtrans[4][s1]; \
|
||||
LL^=des_SPtrans[6][s2]; \
|
||||
u2=(int)t>>8L; \
|
||||
u1=(int)t&0x3f; \
|
||||
u2&=0x3f; \
|
||||
LL^=des_SPtrans[1][u1]; \
|
||||
LL^=des_SPtrans[3][u2]; \
|
||||
s1=(int)t>>16; \
|
||||
s2=(int)t>>24L; \
|
||||
s1&=0x3f; \
|
||||
s2&=0x3f; \
|
||||
LL^=des_SPtrans[5][s1]; \
|
||||
LL^=des_SPtrans[7][s2]; }
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define D_ENCRYPT(LL,R,S) {\
|
||||
LOAD_DATA_tmp(R,S,u,t,E0,E1); \
|
||||
t=ROTATE(t,4); \
|
||||
LL^=\
|
||||
des_SPtrans[0][(u>> 2L)&0x3f]^ \
|
||||
des_SPtrans[2][(u>>10L)&0x3f]^ \
|
||||
des_SPtrans[4][(u>>18L)&0x3f]^ \
|
||||
des_SPtrans[6][(u>>26L)&0x3f]^ \
|
||||
des_SPtrans[1][(t>> 2L)&0x3f]^ \
|
||||
des_SPtrans[3][(t>>10L)&0x3f]^ \
|
||||
des_SPtrans[5][(t>>18L)&0x3f]^ \
|
||||
des_SPtrans[7][(t>>26L)&0x3f]; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -348,4 +567,7 @@ extern int errno;
|
||||
PERM_OP(r,l,tt,16,0x0000ffffL); \
|
||||
PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \
|
||||
}
|
||||
|
||||
extern const DES_LONG des_SPtrans[8][64];
|
||||
|
||||
#endif
|
||||
|
@@ -1,17 +1,22 @@
|
||||
/* lib/des/des_locl.h */
|
||||
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
|
||||
/* crypto/des/des_locl.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file is part of an SSL implementation written
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@mincom.oz.au).
|
||||
* The implementation was written so as to conform with Netscapes SSL
|
||||
* specification. This library and applications are
|
||||
* FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
|
||||
* as long as the following conditions are aheared to.
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* 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, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed. If this code is used in a product,
|
||||
* Eric Young should be given attribution as the author of the parts used.
|
||||
* 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 the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
@@ -25,7 +30,13 @@
|
||||
* 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@mincom.oz.au)
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@mincom.oz.au)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -45,15 +56,6 @@
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DES_LOCL_H
|
||||
#define HEADER_DES_LOCL_H
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef MSDOS
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "des.h"
|
||||
|
||||
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
*
|
||||
* Always modify des_locl.org since des_locl.h is automatically generated from
|
||||
@@ -62,14 +64,95 @@
|
||||
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DES_LOCL_H
|
||||
#define HEADER_DES_LOCL_H
|
||||
|
||||
#if defined(WIN32) || defined(WIN16)
|
||||
#ifndef MSDOS
|
||||
#define MSDOS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef MSDOS
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "des.h"
|
||||
|
||||
#ifndef DES_DEFAULT_OPTIONS
|
||||
/* the following is tweaked from a config script, that is why it is a
|
||||
* protected undef/define */
|
||||
#ifndef DES_PTR
|
||||
#undef DES_PTR
|
||||
#endif
|
||||
|
||||
/* This helps C compiler generate the correct code for multiple functional
|
||||
* units. It reduces register dependancies at the expense of 2 more
|
||||
* registers */
|
||||
#ifndef DES_RISC1
|
||||
#undef DES_RISC1
|
||||
#endif
|
||||
|
||||
#ifndef DES_RISC2
|
||||
#undef DES_RISC2
|
||||
#endif
|
||||
|
||||
#if defined(DES_RISC1) && defined(DES_RISC2)
|
||||
YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
|
||||
#endif
|
||||
|
||||
/* Unroll the inner loop, this sometimes helps, sometimes hinders.
|
||||
* Very mucy CPU dependant */
|
||||
#ifndef DES_UNROLL
|
||||
#undef DES_UNROLL
|
||||
#endif
|
||||
|
||||
/* These default values were supplied by
|
||||
* Peter Gutman <pgut001@cs.auckland.ac.nz>
|
||||
* They are only used if nothing else has been defined */
|
||||
#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
|
||||
/* Special defines which change the way the code is built depending on the
|
||||
CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
|
||||
even newer MIPS CPU's, but at the moment one size fits all for
|
||||
optimization options. Older Sparc's work better with only UNROLL, but
|
||||
there's no way to tell at compile time what it is you're running on */
|
||||
|
||||
#if defined( sun ) /* Newer Sparc's */
|
||||
#define DES_PTR
|
||||
#define DES_RISC1
|
||||
#define DES_UNROLL
|
||||
#elif defined( __ultrix ) /* Older MIPS */
|
||||
#define DES_PTR
|
||||
#define DES_RISC2
|
||||
#define DES_UNROLL
|
||||
#elif defined( __osf1__ ) /* Alpha */
|
||||
#define DES_PTR
|
||||
#define DES_RISC2
|
||||
#elif defined ( _AIX ) /* RS6000 */
|
||||
/* Unknown */
|
||||
#elif defined( __hpux ) /* HP-PA */
|
||||
/* Unknown */
|
||||
#elif defined( __aux ) /* 68K */
|
||||
/* Unknown */
|
||||
#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
|
||||
#define DES_UNROLL
|
||||
#elif defined( __sgi ) /* Newer MIPS */
|
||||
#define DES_PTR
|
||||
#define DES_RISC2
|
||||
#define DES_UNROLL
|
||||
#elif defined( i386 ) /* x86 boxes, should be gcc */
|
||||
#define DES_PTR
|
||||
#define DES_RISC1
|
||||
#define DES_UNROLL
|
||||
#endif /* Systems-specific speed defines */
|
||||
#endif
|
||||
|
||||
#endif /* DES_DEFAULT_OPTIONS */
|
||||
|
||||
#ifdef MSDOS /* Visual C++ 2.1 (Windows NT/95) */
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <io.h>
|
||||
#ifndef RAND
|
||||
@@ -92,7 +175,6 @@
|
||||
|
||||
#ifdef MSDOS
|
||||
#define getpid() 2
|
||||
extern int errno;
|
||||
#define RAND
|
||||
#undef NOPROTO
|
||||
#endif
|
||||
@@ -172,6 +254,32 @@ extern int errno;
|
||||
} \
|
||||
}
|
||||
|
||||
#if defined(WIN32)
|
||||
#define ROTATE(a,n) (_lrotr(a,n))
|
||||
#else
|
||||
#define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n))))
|
||||
#endif
|
||||
|
||||
/* Don't worry about the LOAD_DATA() stuff, that is used by
|
||||
* fcrypt() to add it's little bit to the front */
|
||||
|
||||
#ifdef DES_FCRYPT
|
||||
|
||||
#define LOAD_DATA_tmp(R,S,u,t,E0,E1) \
|
||||
{ DES_LONG tmp; LOAD_DATA(R,S,u,t,E0,E1,tmp); }
|
||||
|
||||
#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \
|
||||
t=R^(R>>16L); \
|
||||
u=t&E0; t&=E1; \
|
||||
tmp=(u<<16); u^=R^s[S ]; u^=tmp; \
|
||||
tmp=(t<<16); t^=R^s[S+1]; t^=tmp
|
||||
#else
|
||||
#define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g)
|
||||
#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \
|
||||
u=R^s[S ]; \
|
||||
t=R^s[S+1]
|
||||
#endif
|
||||
|
||||
/* The changes to this macro may help or hinder, depending on the
|
||||
* compiler and the achitecture. gcc2 always seems to do well :-).
|
||||
* Inspired by Dana How <how@isl.stanford.edu>
|
||||
@@ -180,47 +288,158 @@ extern int errno;
|
||||
* bytes, probably an issue of accessing non-word aligned objects :-( */
|
||||
#ifdef DES_PTR
|
||||
|
||||
#define D_ENCRYPT(L,R,S) { \
|
||||
u=((R^s[S ])<<2); \
|
||||
t= R^s[S+1]; \
|
||||
t=((t>>2)+(t<<30)); \
|
||||
L^= (\
|
||||
*(DES_LONG *)(&(des_SPtrans[1])+((t )&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[3])+((t>> 8)&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[5])+((t>>16)&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[7])+((t>>24)&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[0])+((u )&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[2])+((u>> 8)&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[4])+((u>>16)&0xfc))+ \
|
||||
*(DES_LONG *)(&(des_SPtrans[6])+((u>>24)&0xfc))); }
|
||||
#else /* original version */
|
||||
#ifdef MSDOS
|
||||
#define D_ENCRYPT(L,R,S) \
|
||||
U.l=R^s[S+1]; \
|
||||
T.s[0]=((U.s[0]>>4)|(U.s[1]<<12))&0x3f3f; \
|
||||
T.s[1]=((U.s[1]>>4)|(U.s[0]<<12))&0x3f3f; \
|
||||
U.l=(R^s[S ])&0x3f3f3f3fL; \
|
||||
L^= des_SPtrans[1][(T.c[0])]| \
|
||||
des_SPtrans[3][(T.c[1])]| \
|
||||
des_SPtrans[5][(T.c[2])]| \
|
||||
des_SPtrans[7][(T.c[3])]| \
|
||||
des_SPtrans[0][(U.c[0])]| \
|
||||
des_SPtrans[2][(U.c[1])]| \
|
||||
des_SPtrans[4][(U.c[2])]| \
|
||||
des_SPtrans[6][(U.c[3])];
|
||||
/* It recently occured to me that 0^0^0^0^0^0^0 == 0, so there
|
||||
* is no reason to not xor all the sub items together. This potentially
|
||||
* saves a register since things can be xored directly into L */
|
||||
|
||||
#if defined(DES_RISC1) || defined(DES_RISC2)
|
||||
#ifdef DES_RISC1
|
||||
#define D_ENCRYPT(LL,R,S) { \
|
||||
unsigned int u1,u2,u3; \
|
||||
LOAD_DATA(R,S,u,t,E0,E1,u1); \
|
||||
u2=(int)u>>8L; \
|
||||
u1=(int)u&0xfc; \
|
||||
u2&=0xfc; \
|
||||
t=ROTATE(t,4); \
|
||||
u>>=16L; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \
|
||||
u3=(int)(u>>8L); \
|
||||
u1=(int)u&0xfc; \
|
||||
u3&=0xfc; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+u1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+u3); \
|
||||
u2=(int)t>>8L; \
|
||||
u1=(int)t&0xfc; \
|
||||
u2&=0xfc; \
|
||||
t>>=16L; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \
|
||||
u3=(int)t>>8L; \
|
||||
u1=(int)t&0xfc; \
|
||||
u3&=0xfc; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+u1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+u3); }
|
||||
#endif
|
||||
#ifdef DES_RISC2
|
||||
#define D_ENCRYPT(LL,R,S) { \
|
||||
unsigned int u1,u2,s1,s2; \
|
||||
LOAD_DATA(R,S,u,t,E0,E1,u1); \
|
||||
u2=(int)u>>8L; \
|
||||
u1=(int)u&0xfc; \
|
||||
u2&=0xfc; \
|
||||
t=ROTATE(t,4); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \
|
||||
s1=(int)(u>>16L); \
|
||||
s2=(int)(u>>24L); \
|
||||
s1&=0xfc; \
|
||||
s2&=0xfc; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+s1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+s2); \
|
||||
u2=(int)t>>8L; \
|
||||
u1=(int)t&0xfc; \
|
||||
u2&=0xfc; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \
|
||||
s1=(int)(t>>16L); \
|
||||
s2=(int)(t>>24L); \
|
||||
s1&=0xfc; \
|
||||
s2&=0xfc; \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+s1); \
|
||||
LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+s2); }
|
||||
#endif
|
||||
#else
|
||||
#define D_ENCRYPT(Q,R,S) {\
|
||||
u=(R^s[S ]); \
|
||||
t=R^s[S+1]; \
|
||||
t=((t>>4L)+(t<<28L)); \
|
||||
Q^= des_SPtrans[1][(t )&0x3f]| \
|
||||
des_SPtrans[3][(t>> 8L)&0x3f]| \
|
||||
des_SPtrans[5][(t>>16L)&0x3f]| \
|
||||
des_SPtrans[7][(t>>24L)&0x3f]| \
|
||||
des_SPtrans[0][(u )&0x3f]| \
|
||||
des_SPtrans[2][(u>> 8L)&0x3f]| \
|
||||
des_SPtrans[4][(u>>16L)&0x3f]| \
|
||||
des_SPtrans[6][(u>>24L)&0x3f]; }
|
||||
#define D_ENCRYPT(LL,R,S) { \
|
||||
LOAD_DATA_tmp(R,S,u,t,E0,E1); \
|
||||
t=ROTATE(t,4); \
|
||||
LL^= \
|
||||
*(DES_LONG *)((unsigned char *)des_SP +((u )&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x200+((u>> 8L)&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x400+((u>>16L)&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x600+((u>>24L)&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x100+((t )&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x300+((t>> 8L)&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x500+((t>>16L)&0xfc))^ \
|
||||
*(DES_LONG *)((unsigned char *)des_SP+0x700+((t>>24L)&0xfc)); }
|
||||
#endif
|
||||
|
||||
#else /* original version */
|
||||
|
||||
#if defined(DES_RISC1) || defined(DES_RISC2)
|
||||
#ifdef DES_RISC1
|
||||
#define D_ENCRYPT(LL,R,S) {\
|
||||
unsigned int u1,u2,u3; \
|
||||
LOAD_DATA(R,S,u,t,E0,E1,u1); \
|
||||
u>>=2L; \
|
||||
t=ROTATE(t,6); \
|
||||
u2=(int)u>>8L; \
|
||||
u1=(int)u&0x3f; \
|
||||
u2&=0x3f; \
|
||||
u>>=16L; \
|
||||
LL^=des_SPtrans[0][u1]; \
|
||||
LL^=des_SPtrans[2][u2]; \
|
||||
u3=(int)u>>8L; \
|
||||
u1=(int)u&0x3f; \
|
||||
u3&=0x3f; \
|
||||
LL^=des_SPtrans[4][u1]; \
|
||||
LL^=des_SPtrans[6][u3]; \
|
||||
u2=(int)t>>8L; \
|
||||
u1=(int)t&0x3f; \
|
||||
u2&=0x3f; \
|
||||
t>>=16L; \
|
||||
LL^=des_SPtrans[1][u1]; \
|
||||
LL^=des_SPtrans[3][u2]; \
|
||||
u3=(int)t>>8L; \
|
||||
u1=(int)t&0x3f; \
|
||||
u3&=0x3f; \
|
||||
LL^=des_SPtrans[5][u1]; \
|
||||
LL^=des_SPtrans[7][u3]; }
|
||||
#endif
|
||||
#ifdef DES_RISC2
|
||||
#define D_ENCRYPT(LL,R,S) {\
|
||||
unsigned int u1,u2,s1,s2; \
|
||||
LOAD_DATA(R,S,u,t,E0,E1,u1); \
|
||||
u>>=2L; \
|
||||
t=ROTATE(t,6); \
|
||||
u2=(int)u>>8L; \
|
||||
u1=(int)u&0x3f; \
|
||||
u2&=0x3f; \
|
||||
LL^=des_SPtrans[0][u1]; \
|
||||
LL^=des_SPtrans[2][u2]; \
|
||||
s1=(int)u>>16L; \
|
||||
s2=(int)u>>24L; \
|
||||
s1&=0x3f; \
|
||||
s2&=0x3f; \
|
||||
LL^=des_SPtrans[4][s1]; \
|
||||
LL^=des_SPtrans[6][s2]; \
|
||||
u2=(int)t>>8L; \
|
||||
u1=(int)t&0x3f; \
|
||||
u2&=0x3f; \
|
||||
LL^=des_SPtrans[1][u1]; \
|
||||
LL^=des_SPtrans[3][u2]; \
|
||||
s1=(int)t>>16; \
|
||||
s2=(int)t>>24L; \
|
||||
s1&=0x3f; \
|
||||
s2&=0x3f; \
|
||||
LL^=des_SPtrans[5][s1]; \
|
||||
LL^=des_SPtrans[7][s2]; }
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define D_ENCRYPT(LL,R,S) {\
|
||||
LOAD_DATA_tmp(R,S,u,t,E0,E1); \
|
||||
t=ROTATE(t,4); \
|
||||
LL^=\
|
||||
des_SPtrans[0][(u>> 2L)&0x3f]^ \
|
||||
des_SPtrans[2][(u>>10L)&0x3f]^ \
|
||||
des_SPtrans[4][(u>>18L)&0x3f]^ \
|
||||
des_SPtrans[6][(u>>26L)&0x3f]^ \
|
||||
des_SPtrans[1][(t>> 2L)&0x3f]^ \
|
||||
des_SPtrans[3][(t>>10L)&0x3f]^ \
|
||||
des_SPtrans[5][(t>>18L)&0x3f]^ \
|
||||
des_SPtrans[7][(t>>26L)&0x3f]; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -284,4 +503,7 @@ extern int errno;
|
||||
PERM_OP(r,l,tt,16,0x0000ffffL); \
|
||||
PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \
|
||||
}
|
||||
|
||||
extern const DES_LONG des_SPtrans[8][64];
|
||||
|
||||
#endif
|
||||
|
@@ -1,17 +1,22 @@
|
||||
/* lib/des/podd.h */
|
||||
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
|
||||
/* crypto/des/podd.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file is part of an SSL implementation written
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@mincom.oz.au).
|
||||
* The implementation was written so as to conform with Netscapes SSL
|
||||
* specification. This library and applications are
|
||||
* FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
|
||||
* as long as the following conditions are aheared to.
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* 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, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed. If this code is used in a product,
|
||||
* Eric Young should be given attribution as the author of the parts used.
|
||||
* 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 the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
@@ -25,7 +30,13 @@
|
||||
* 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@mincom.oz.au)
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@mincom.oz.au)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
|
@@ -1,17 +1,22 @@
|
||||
/* lib/des/rpc_des.h */
|
||||
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
|
||||
/* crypto/des/rpc_des.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file is part of an SSL implementation written
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@mincom.oz.au).
|
||||
* The implementation was written so as to conform with Netscapes SSL
|
||||
* specification. This library and applications are
|
||||
* FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
|
||||
* as long as the following conditions are aheared to.
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* 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, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed. If this code is used in a product,
|
||||
* Eric Young should be given attribution as the author of the parts used.
|
||||
* 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 the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
@@ -25,7 +30,13 @@
|
||||
* 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@mincom.oz.au)
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@mincom.oz.au)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -83,6 +94,11 @@
|
||||
#define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */
|
||||
#define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */
|
||||
|
||||
#ifdef HEADER_DES_H
|
||||
#undef ENCRYPT
|
||||
#undef DECRYPT
|
||||
#endif
|
||||
|
||||
enum desdir { ENCRYPT, DECRYPT };
|
||||
enum desmode { CBC, ECB };
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
#/usr/local/bin/perl
|
||||
|
||||
sub lab_shift
|
||||
{
|
||||
local(*a,$n)=@_;
|
||||
@@ -37,6 +39,42 @@ sub shift
|
||||
return(@f);
|
||||
}
|
||||
|
||||
sub rotate
|
||||
{
|
||||
local(*a,$n)=@_;
|
||||
local(@f);
|
||||
|
||||
if ($n > 0)
|
||||
{ @f=&rotatel(*a,$n); }
|
||||
else
|
||||
{ @f=&rotater(*a,-$n); }
|
||||
return(@f);
|
||||
}
|
||||
|
||||
sub rotater
|
||||
{
|
||||
local(*a,$n)=@_;
|
||||
local(@f,@g);
|
||||
|
||||
@f=&shiftr(*a,$n);
|
||||
@g=&shiftl(*a,32-$n);
|
||||
$#f=31;
|
||||
$#g=31;
|
||||
return(&or(*f,*g));
|
||||
}
|
||||
|
||||
sub rotatel
|
||||
{
|
||||
local(*a,$n)=@_;
|
||||
local(@f,@g);
|
||||
|
||||
@f=&shiftl(*a,$n);
|
||||
@g=&shiftr(*a,32-$n);
|
||||
$#f=31;
|
||||
$#g=31;
|
||||
return(&or(*f,*g));
|
||||
}
|
||||
|
||||
sub shiftr
|
||||
{
|
||||
local(*a,$n)=@_;
|
||||
|
33
lib/des/sk.h
33
lib/des/sk.h
@@ -1,17 +1,22 @@
|
||||
/* lib/des/sk.h */
|
||||
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
|
||||
/* crypto/des/sk.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file is part of an SSL implementation written
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@mincom.oz.au).
|
||||
* The implementation was written so as to conform with Netscapes SSL
|
||||
* specification. This library and applications are
|
||||
* FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
|
||||
* as long as the following conditions are aheared to.
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* 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, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed. If this code is used in a product,
|
||||
* Eric Young should be given attribution as the author of the parts used.
|
||||
* 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 the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
@@ -25,7 +30,13 @@
|
||||
* 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@mincom.oz.au)
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@mincom.oz.au)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
|
291
lib/des/spr.h
291
lib/des/spr.h
@@ -1,17 +1,22 @@
|
||||
/* lib/des/spr.h */
|
||||
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
|
||||
/* crypto/des/spr.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file is part of an SSL implementation written
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@mincom.oz.au).
|
||||
* The implementation was written so as to conform with Netscapes SSL
|
||||
* specification. This library and applications are
|
||||
* FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
|
||||
* as long as the following conditions are aheared to.
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* 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, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed. If this code is used in a product,
|
||||
* Eric Young should be given attribution as the author of the parts used.
|
||||
* 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 the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
@@ -25,7 +30,13 @@
|
||||
* 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@mincom.oz.au)
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@mincom.oz.au)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -45,149 +56,149 @@
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
static const DES_LONG des_SPtrans[8][64]={
|
||||
const DES_LONG des_SPtrans[8][64]={
|
||||
{
|
||||
/* nibble 0 */
|
||||
0x00820200L, 0x00020000L, 0x80800000L, 0x80820200L,
|
||||
0x00800000L, 0x80020200L, 0x80020000L, 0x80800000L,
|
||||
0x80020200L, 0x00820200L, 0x00820000L, 0x80000200L,
|
||||
0x80800200L, 0x00800000L, 0x00000000L, 0x80020000L,
|
||||
0x00020000L, 0x80000000L, 0x00800200L, 0x00020200L,
|
||||
0x80820200L, 0x00820000L, 0x80000200L, 0x00800200L,
|
||||
0x80000000L, 0x00000200L, 0x00020200L, 0x80820000L,
|
||||
0x00000200L, 0x80800200L, 0x80820000L, 0x00000000L,
|
||||
0x00000000L, 0x80820200L, 0x00800200L, 0x80020000L,
|
||||
0x00820200L, 0x00020000L, 0x80000200L, 0x00800200L,
|
||||
0x80820000L, 0x00000200L, 0x00020200L, 0x80800000L,
|
||||
0x80020200L, 0x80000000L, 0x80800000L, 0x00820000L,
|
||||
0x80820200L, 0x00020200L, 0x00820000L, 0x80800200L,
|
||||
0x00800000L, 0x80000200L, 0x80020000L, 0x00000000L,
|
||||
0x00020000L, 0x00800000L, 0x80800200L, 0x00820200L,
|
||||
0x80000000L, 0x80820000L, 0x00000200L, 0x80020200L,
|
||||
0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L,
|
||||
0x02000000L, 0x00080802L, 0x00080002L, 0x02000002L,
|
||||
0x00080802L, 0x02080800L, 0x02080000L, 0x00000802L,
|
||||
0x02000802L, 0x02000000L, 0x00000000L, 0x00080002L,
|
||||
0x00080000L, 0x00000002L, 0x02000800L, 0x00080800L,
|
||||
0x02080802L, 0x02080000L, 0x00000802L, 0x02000800L,
|
||||
0x00000002L, 0x00000800L, 0x00080800L, 0x02080002L,
|
||||
0x00000800L, 0x02000802L, 0x02080002L, 0x00000000L,
|
||||
0x00000000L, 0x02080802L, 0x02000800L, 0x00080002L,
|
||||
0x02080800L, 0x00080000L, 0x00000802L, 0x02000800L,
|
||||
0x02080002L, 0x00000800L, 0x00080800L, 0x02000002L,
|
||||
0x00080802L, 0x00000002L, 0x02000002L, 0x02080000L,
|
||||
0x02080802L, 0x00080800L, 0x02080000L, 0x02000802L,
|
||||
0x02000000L, 0x00000802L, 0x00080002L, 0x00000000L,
|
||||
0x00080000L, 0x02000000L, 0x02000802L, 0x02080800L,
|
||||
0x00000002L, 0x02080002L, 0x00000800L, 0x00080802L,
|
||||
},{
|
||||
/* nibble 1 */
|
||||
0x10042004L, 0x00000000L, 0x00042000L, 0x10040000L,
|
||||
0x10000004L, 0x00002004L, 0x10002000L, 0x00042000L,
|
||||
0x00002000L, 0x10040004L, 0x00000004L, 0x10002000L,
|
||||
0x00040004L, 0x10042000L, 0x10040000L, 0x00000004L,
|
||||
0x00040000L, 0x10002004L, 0x10040004L, 0x00002000L,
|
||||
0x00042004L, 0x10000000L, 0x00000000L, 0x00040004L,
|
||||
0x10002004L, 0x00042004L, 0x10042000L, 0x10000004L,
|
||||
0x10000000L, 0x00040000L, 0x00002004L, 0x10042004L,
|
||||
0x00040004L, 0x10042000L, 0x10002000L, 0x00042004L,
|
||||
0x10042004L, 0x00040004L, 0x10000004L, 0x00000000L,
|
||||
0x10000000L, 0x00002004L, 0x00040000L, 0x10040004L,
|
||||
0x00002000L, 0x10000000L, 0x00042004L, 0x10002004L,
|
||||
0x10042000L, 0x00002000L, 0x00000000L, 0x10000004L,
|
||||
0x00000004L, 0x10042004L, 0x00042000L, 0x10040000L,
|
||||
0x10040004L, 0x00040000L, 0x00002004L, 0x10002000L,
|
||||
0x10002004L, 0x00000004L, 0x10040000L, 0x00042000L,
|
||||
0x40108010L, 0x00000000L, 0x00108000L, 0x40100000L,
|
||||
0x40000010L, 0x00008010L, 0x40008000L, 0x00108000L,
|
||||
0x00008000L, 0x40100010L, 0x00000010L, 0x40008000L,
|
||||
0x00100010L, 0x40108000L, 0x40100000L, 0x00000010L,
|
||||
0x00100000L, 0x40008010L, 0x40100010L, 0x00008000L,
|
||||
0x00108010L, 0x40000000L, 0x00000000L, 0x00100010L,
|
||||
0x40008010L, 0x00108010L, 0x40108000L, 0x40000010L,
|
||||
0x40000000L, 0x00100000L, 0x00008010L, 0x40108010L,
|
||||
0x00100010L, 0x40108000L, 0x40008000L, 0x00108010L,
|
||||
0x40108010L, 0x00100010L, 0x40000010L, 0x00000000L,
|
||||
0x40000000L, 0x00008010L, 0x00100000L, 0x40100010L,
|
||||
0x00008000L, 0x40000000L, 0x00108010L, 0x40008010L,
|
||||
0x40108000L, 0x00008000L, 0x00000000L, 0x40000010L,
|
||||
0x00000010L, 0x40108010L, 0x00108000L, 0x40100000L,
|
||||
0x40100010L, 0x00100000L, 0x00008010L, 0x40008000L,
|
||||
0x40008010L, 0x00000010L, 0x40100000L, 0x00108000L,
|
||||
},{
|
||||
/* nibble 2 */
|
||||
0x41000000L, 0x01010040L, 0x00000040L, 0x41000040L,
|
||||
0x40010000L, 0x01000000L, 0x41000040L, 0x00010040L,
|
||||
0x01000040L, 0x00010000L, 0x01010000L, 0x40000000L,
|
||||
0x41010040L, 0x40000040L, 0x40000000L, 0x41010000L,
|
||||
0x00000000L, 0x40010000L, 0x01010040L, 0x00000040L,
|
||||
0x40000040L, 0x41010040L, 0x00010000L, 0x41000000L,
|
||||
0x41010000L, 0x01000040L, 0x40010040L, 0x01010000L,
|
||||
0x00010040L, 0x00000000L, 0x01000000L, 0x40010040L,
|
||||
0x01010040L, 0x00000040L, 0x40000000L, 0x00010000L,
|
||||
0x40000040L, 0x40010000L, 0x01010000L, 0x41000040L,
|
||||
0x00000000L, 0x01010040L, 0x00010040L, 0x41010000L,
|
||||
0x40010000L, 0x01000000L, 0x41010040L, 0x40000000L,
|
||||
0x40010040L, 0x41000000L, 0x01000000L, 0x41010040L,
|
||||
0x00010000L, 0x01000040L, 0x41000040L, 0x00010040L,
|
||||
0x01000040L, 0x00000000L, 0x41010000L, 0x40000040L,
|
||||
0x41000000L, 0x40010040L, 0x00000040L, 0x01010000L,
|
||||
0x04000001L, 0x04040100L, 0x00000100L, 0x04000101L,
|
||||
0x00040001L, 0x04000000L, 0x04000101L, 0x00040100L,
|
||||
0x04000100L, 0x00040000L, 0x04040000L, 0x00000001L,
|
||||
0x04040101L, 0x00000101L, 0x00000001L, 0x04040001L,
|
||||
0x00000000L, 0x00040001L, 0x04040100L, 0x00000100L,
|
||||
0x00000101L, 0x04040101L, 0x00040000L, 0x04000001L,
|
||||
0x04040001L, 0x04000100L, 0x00040101L, 0x04040000L,
|
||||
0x00040100L, 0x00000000L, 0x04000000L, 0x00040101L,
|
||||
0x04040100L, 0x00000100L, 0x00000001L, 0x00040000L,
|
||||
0x00000101L, 0x00040001L, 0x04040000L, 0x04000101L,
|
||||
0x00000000L, 0x04040100L, 0x00040100L, 0x04040001L,
|
||||
0x00040001L, 0x04000000L, 0x04040101L, 0x00000001L,
|
||||
0x00040101L, 0x04000001L, 0x04000000L, 0x04040101L,
|
||||
0x00040000L, 0x04000100L, 0x04000101L, 0x00040100L,
|
||||
0x04000100L, 0x00000000L, 0x04040001L, 0x00000101L,
|
||||
0x04000001L, 0x00040101L, 0x00000100L, 0x04040000L,
|
||||
},{
|
||||
/* nibble 3 */
|
||||
0x00100402L, 0x04000400L, 0x00000002L, 0x04100402L,
|
||||
0x00000000L, 0x04100000L, 0x04000402L, 0x00100002L,
|
||||
0x04100400L, 0x04000002L, 0x04000000L, 0x00000402L,
|
||||
0x04000002L, 0x00100402L, 0x00100000L, 0x04000000L,
|
||||
0x04100002L, 0x00100400L, 0x00000400L, 0x00000002L,
|
||||
0x00100400L, 0x04000402L, 0x04100000L, 0x00000400L,
|
||||
0x00000402L, 0x00000000L, 0x00100002L, 0x04100400L,
|
||||
0x04000400L, 0x04100002L, 0x04100402L, 0x00100000L,
|
||||
0x04100002L, 0x00000402L, 0x00100000L, 0x04000002L,
|
||||
0x00100400L, 0x04000400L, 0x00000002L, 0x04100000L,
|
||||
0x04000402L, 0x00000000L, 0x00000400L, 0x00100002L,
|
||||
0x00000000L, 0x04100002L, 0x04100400L, 0x00000400L,
|
||||
0x04000000L, 0x04100402L, 0x00100402L, 0x00100000L,
|
||||
0x04100402L, 0x00000002L, 0x04000400L, 0x00100402L,
|
||||
0x00100002L, 0x00100400L, 0x04100000L, 0x04000402L,
|
||||
0x00000402L, 0x04000000L, 0x04000002L, 0x04100400L,
|
||||
0x00401008L, 0x10001000L, 0x00000008L, 0x10401008L,
|
||||
0x00000000L, 0x10400000L, 0x10001008L, 0x00400008L,
|
||||
0x10401000L, 0x10000008L, 0x10000000L, 0x00001008L,
|
||||
0x10000008L, 0x00401008L, 0x00400000L, 0x10000000L,
|
||||
0x10400008L, 0x00401000L, 0x00001000L, 0x00000008L,
|
||||
0x00401000L, 0x10001008L, 0x10400000L, 0x00001000L,
|
||||
0x00001008L, 0x00000000L, 0x00400008L, 0x10401000L,
|
||||
0x10001000L, 0x10400008L, 0x10401008L, 0x00400000L,
|
||||
0x10400008L, 0x00001008L, 0x00400000L, 0x10000008L,
|
||||
0x00401000L, 0x10001000L, 0x00000008L, 0x10400000L,
|
||||
0x10001008L, 0x00000000L, 0x00001000L, 0x00400008L,
|
||||
0x00000000L, 0x10400008L, 0x10401000L, 0x00001000L,
|
||||
0x10000000L, 0x10401008L, 0x00401008L, 0x00400000L,
|
||||
0x10401008L, 0x00000008L, 0x10001000L, 0x00401008L,
|
||||
0x00400008L, 0x00401000L, 0x10400000L, 0x10001008L,
|
||||
0x00001008L, 0x10000000L, 0x10000008L, 0x10401000L,
|
||||
},{
|
||||
/* nibble 4 */
|
||||
0x02000000L, 0x00004000L, 0x00000100L, 0x02004108L,
|
||||
0x02004008L, 0x02000100L, 0x00004108L, 0x02004000L,
|
||||
0x00004000L, 0x00000008L, 0x02000008L, 0x00004100L,
|
||||
0x02000108L, 0x02004008L, 0x02004100L, 0x00000000L,
|
||||
0x00004100L, 0x02000000L, 0x00004008L, 0x00000108L,
|
||||
0x02000100L, 0x00004108L, 0x00000000L, 0x02000008L,
|
||||
0x00000008L, 0x02000108L, 0x02004108L, 0x00004008L,
|
||||
0x02004000L, 0x00000100L, 0x00000108L, 0x02004100L,
|
||||
0x02004100L, 0x02000108L, 0x00004008L, 0x02004000L,
|
||||
0x00004000L, 0x00000008L, 0x02000008L, 0x02000100L,
|
||||
0x02000000L, 0x00004100L, 0x02004108L, 0x00000000L,
|
||||
0x00004108L, 0x02000000L, 0x00000100L, 0x00004008L,
|
||||
0x02000108L, 0x00000100L, 0x00000000L, 0x02004108L,
|
||||
0x02004008L, 0x02004100L, 0x00000108L, 0x00004000L,
|
||||
0x00004100L, 0x02004008L, 0x02000100L, 0x00000108L,
|
||||
0x00000008L, 0x00004108L, 0x02004000L, 0x02000008L,
|
||||
0x08000000L, 0x00010000L, 0x00000400L, 0x08010420L,
|
||||
0x08010020L, 0x08000400L, 0x00010420L, 0x08010000L,
|
||||
0x00010000L, 0x00000020L, 0x08000020L, 0x00010400L,
|
||||
0x08000420L, 0x08010020L, 0x08010400L, 0x00000000L,
|
||||
0x00010400L, 0x08000000L, 0x00010020L, 0x00000420L,
|
||||
0x08000400L, 0x00010420L, 0x00000000L, 0x08000020L,
|
||||
0x00000020L, 0x08000420L, 0x08010420L, 0x00010020L,
|
||||
0x08010000L, 0x00000400L, 0x00000420L, 0x08010400L,
|
||||
0x08010400L, 0x08000420L, 0x00010020L, 0x08010000L,
|
||||
0x00010000L, 0x00000020L, 0x08000020L, 0x08000400L,
|
||||
0x08000000L, 0x00010400L, 0x08010420L, 0x00000000L,
|
||||
0x00010420L, 0x08000000L, 0x00000400L, 0x00010020L,
|
||||
0x08000420L, 0x00000400L, 0x00000000L, 0x08010420L,
|
||||
0x08010020L, 0x08010400L, 0x00000420L, 0x00010000L,
|
||||
0x00010400L, 0x08010020L, 0x08000400L, 0x00000420L,
|
||||
0x00000020L, 0x00010420L, 0x08010000L, 0x08000020L,
|
||||
},{
|
||||
/* nibble 5 */
|
||||
0x20000010L, 0x00080010L, 0x00000000L, 0x20080800L,
|
||||
0x00080010L, 0x00000800L, 0x20000810L, 0x00080000L,
|
||||
0x00000810L, 0x20080810L, 0x00080800L, 0x20000000L,
|
||||
0x20000800L, 0x20000010L, 0x20080000L, 0x00080810L,
|
||||
0x00080000L, 0x20000810L, 0x20080010L, 0x00000000L,
|
||||
0x00000800L, 0x00000010L, 0x20080800L, 0x20080010L,
|
||||
0x20080810L, 0x20080000L, 0x20000000L, 0x00000810L,
|
||||
0x00000010L, 0x00080800L, 0x00080810L, 0x20000800L,
|
||||
0x00000810L, 0x20000000L, 0x20000800L, 0x00080810L,
|
||||
0x20080800L, 0x00080010L, 0x00000000L, 0x20000800L,
|
||||
0x20000000L, 0x00000800L, 0x20080010L, 0x00080000L,
|
||||
0x00080010L, 0x20080810L, 0x00080800L, 0x00000010L,
|
||||
0x20080810L, 0x00080800L, 0x00080000L, 0x20000810L,
|
||||
0x20000010L, 0x20080000L, 0x00080810L, 0x00000000L,
|
||||
0x00000800L, 0x20000010L, 0x20000810L, 0x20080800L,
|
||||
0x20080000L, 0x00000810L, 0x00000010L, 0x20080010L,
|
||||
0x80000040L, 0x00200040L, 0x00000000L, 0x80202000L,
|
||||
0x00200040L, 0x00002000L, 0x80002040L, 0x00200000L,
|
||||
0x00002040L, 0x80202040L, 0x00202000L, 0x80000000L,
|
||||
0x80002000L, 0x80000040L, 0x80200000L, 0x00202040L,
|
||||
0x00200000L, 0x80002040L, 0x80200040L, 0x00000000L,
|
||||
0x00002000L, 0x00000040L, 0x80202000L, 0x80200040L,
|
||||
0x80202040L, 0x80200000L, 0x80000000L, 0x00002040L,
|
||||
0x00000040L, 0x00202000L, 0x00202040L, 0x80002000L,
|
||||
0x00002040L, 0x80000000L, 0x80002000L, 0x00202040L,
|
||||
0x80202000L, 0x00200040L, 0x00000000L, 0x80002000L,
|
||||
0x80000000L, 0x00002000L, 0x80200040L, 0x00200000L,
|
||||
0x00200040L, 0x80202040L, 0x00202000L, 0x00000040L,
|
||||
0x80202040L, 0x00202000L, 0x00200000L, 0x80002040L,
|
||||
0x80000040L, 0x80200000L, 0x00202040L, 0x00000000L,
|
||||
0x00002000L, 0x80000040L, 0x80002040L, 0x80202000L,
|
||||
0x80200000L, 0x00002040L, 0x00000040L, 0x80200040L,
|
||||
},{
|
||||
/* nibble 6 */
|
||||
0x00001000L, 0x00000080L, 0x00400080L, 0x00400001L,
|
||||
0x00401081L, 0x00001001L, 0x00001080L, 0x00000000L,
|
||||
0x00400000L, 0x00400081L, 0x00000081L, 0x00401000L,
|
||||
0x00000001L, 0x00401080L, 0x00401000L, 0x00000081L,
|
||||
0x00400081L, 0x00001000L, 0x00001001L, 0x00401081L,
|
||||
0x00000000L, 0x00400080L, 0x00400001L, 0x00001080L,
|
||||
0x00401001L, 0x00001081L, 0x00401080L, 0x00000001L,
|
||||
0x00001081L, 0x00401001L, 0x00000080L, 0x00400000L,
|
||||
0x00001081L, 0x00401000L, 0x00401001L, 0x00000081L,
|
||||
0x00001000L, 0x00000080L, 0x00400000L, 0x00401001L,
|
||||
0x00400081L, 0x00001081L, 0x00001080L, 0x00000000L,
|
||||
0x00000080L, 0x00400001L, 0x00000001L, 0x00400080L,
|
||||
0x00000000L, 0x00400081L, 0x00400080L, 0x00001080L,
|
||||
0x00000081L, 0x00001000L, 0x00401081L, 0x00400000L,
|
||||
0x00401080L, 0x00000001L, 0x00001001L, 0x00401081L,
|
||||
0x00400001L, 0x00401080L, 0x00401000L, 0x00001001L,
|
||||
0x00004000L, 0x00000200L, 0x01000200L, 0x01000004L,
|
||||
0x01004204L, 0x00004004L, 0x00004200L, 0x00000000L,
|
||||
0x01000000L, 0x01000204L, 0x00000204L, 0x01004000L,
|
||||
0x00000004L, 0x01004200L, 0x01004000L, 0x00000204L,
|
||||
0x01000204L, 0x00004000L, 0x00004004L, 0x01004204L,
|
||||
0x00000000L, 0x01000200L, 0x01000004L, 0x00004200L,
|
||||
0x01004004L, 0x00004204L, 0x01004200L, 0x00000004L,
|
||||
0x00004204L, 0x01004004L, 0x00000200L, 0x01000000L,
|
||||
0x00004204L, 0x01004000L, 0x01004004L, 0x00000204L,
|
||||
0x00004000L, 0x00000200L, 0x01000000L, 0x01004004L,
|
||||
0x01000204L, 0x00004204L, 0x00004200L, 0x00000000L,
|
||||
0x00000200L, 0x01000004L, 0x00000004L, 0x01000200L,
|
||||
0x00000000L, 0x01000204L, 0x01000200L, 0x00004200L,
|
||||
0x00000204L, 0x00004000L, 0x01004204L, 0x01000000L,
|
||||
0x01004200L, 0x00000004L, 0x00004004L, 0x01004204L,
|
||||
0x01000004L, 0x01004200L, 0x01004000L, 0x00004004L,
|
||||
},{
|
||||
/* nibble 7 */
|
||||
0x08200020L, 0x08208000L, 0x00008020L, 0x00000000L,
|
||||
0x08008000L, 0x00200020L, 0x08200000L, 0x08208020L,
|
||||
0x00000020L, 0x08000000L, 0x00208000L, 0x00008020L,
|
||||
0x00208020L, 0x08008020L, 0x08000020L, 0x08200000L,
|
||||
0x00008000L, 0x00208020L, 0x00200020L, 0x08008000L,
|
||||
0x08208020L, 0x08000020L, 0x00000000L, 0x00208000L,
|
||||
0x08000000L, 0x00200000L, 0x08008020L, 0x08200020L,
|
||||
0x00200000L, 0x00008000L, 0x08208000L, 0x00000020L,
|
||||
0x00200000L, 0x00008000L, 0x08000020L, 0x08208020L,
|
||||
0x00008020L, 0x08000000L, 0x00000000L, 0x00208000L,
|
||||
0x08200020L, 0x08008020L, 0x08008000L, 0x00200020L,
|
||||
0x08208000L, 0x00000020L, 0x00200020L, 0x08008000L,
|
||||
0x08208020L, 0x00200000L, 0x08200000L, 0x08000020L,
|
||||
0x00208000L, 0x00008020L, 0x08008020L, 0x08200000L,
|
||||
0x00000020L, 0x08208000L, 0x00208020L, 0x00000000L,
|
||||
0x08000000L, 0x08200020L, 0x00008000L, 0x00208020L,
|
||||
0x20800080L, 0x20820000L, 0x00020080L, 0x00000000L,
|
||||
0x20020000L, 0x00800080L, 0x20800000L, 0x20820080L,
|
||||
0x00000080L, 0x20000000L, 0x00820000L, 0x00020080L,
|
||||
0x00820080L, 0x20020080L, 0x20000080L, 0x20800000L,
|
||||
0x00020000L, 0x00820080L, 0x00800080L, 0x20020000L,
|
||||
0x20820080L, 0x20000080L, 0x00000000L, 0x00820000L,
|
||||
0x20000000L, 0x00800000L, 0x20020080L, 0x20800080L,
|
||||
0x00800000L, 0x00020000L, 0x20820000L, 0x00000080L,
|
||||
0x00800000L, 0x00020000L, 0x20000080L, 0x20820080L,
|
||||
0x00020080L, 0x20000000L, 0x00000000L, 0x00820000L,
|
||||
0x20800080L, 0x20020080L, 0x20020000L, 0x00800080L,
|
||||
0x20820000L, 0x00000080L, 0x00800080L, 0x20020000L,
|
||||
0x20820080L, 0x00800000L, 0x20800000L, 0x20000080L,
|
||||
0x00820000L, 0x00020080L, 0x20020080L, 0x20800000L,
|
||||
0x00000080L, 0x20820000L, 0x00820080L, 0x00000000L,
|
||||
0x20000000L, 0x20800080L, 0x00020000L, 0x00820080L,
|
||||
}};
|
||||
|
Reference in New Issue
Block a user