From 8d7ed6ff90581cf34a00d59d301d8cc7da2efc54 Mon Sep 17 00:00:00 2001 From: Ben Laurie Date: Mon, 28 Dec 1998 21:58:19 +0000 Subject: Deal with generated files. --- CHANGES | 7 + Configure | 2 +- Makefile.org | 329 +++++++++++++++++++++++++++ Makefile.ssl | 329 --------------------------- crypto/bf/bf_locl.h | 242 -------------------- crypto/bn/bn.h | 599 -------------------------------------------------- crypto/date.h | 1 - crypto/des/des.h | 303 ------------------------- crypto/des/des_locl.h | 516 ------------------------------------------- crypto/idea/idea.h | 116 ---------- crypto/md2/md2.h | 106 --------- crypto/pem/pem.h | 562 ---------------------------------------------- crypto/rc2/rc2.h | 118 ---------- crypto/rc4/rc4.h | 103 --------- crypto/rc4/rc4_locl.h | 70 ------ test/.rnd | Bin 1024 -> 0 bytes test/Makefile.ssl | 4 +- test/certCA.srl | 1 - test/testkey.pem | 9 - test/testreq.pem | 9 - 20 files changed, 339 insertions(+), 3087 deletions(-) create mode 100644 Makefile.org delete mode 100644 Makefile.ssl delete mode 100644 crypto/bf/bf_locl.h delete mode 100644 crypto/bn/bn.h delete mode 100644 crypto/date.h delete mode 100644 crypto/des/des.h delete mode 100644 crypto/des/des_locl.h delete mode 100644 crypto/idea/idea.h delete mode 100644 crypto/md2/md2.h delete mode 100644 crypto/pem/pem.h delete mode 100644 crypto/rc2/rc2.h delete mode 100644 crypto/rc4/rc4.h delete mode 100644 crypto/rc4/rc4_locl.h delete mode 100644 test/.rnd delete mode 100644 test/certCA.srl delete mode 100644 test/testkey.pem delete mode 100644 test/testreq.pem diff --git a/CHANGES b/CHANGES index 80310fae82..535e6abd4f 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,13 @@ sco5-cc. [Ben Laurie] + *) Eliminate generated files from CVS. Reorder tests to regenerate files + before they are needed. + [Ben Laurie] + + *) Generate Makefile.ssl from Makefile.org (to keep CVS happy). + [Ben Laurie] + Changes between 0.9.1b and 0.9.1c *) Added OPENSSL_VERSION_NUMBER to crypto/crypto.h and diff --git a/Configure b/Configure index cdcb027002..d54eb521bb 100755 --- a/Configure +++ b/Configure @@ -327,7 +327,7 @@ if ($rmd160_obj =~ /\.o$/) } my $n=&file_new($Makefile); -open(IN,"<".$Makefile) || die "unable to read $Makefile:$!\n"; +open(IN,'".$n) || die "unable to read $n:$!\n"; while () { diff --git a/Makefile.org b/Makefile.org new file mode 100644 index 0000000000..30bec8e343 --- /dev/null +++ b/Makefile.org @@ -0,0 +1,329 @@ +# +# Makefile for all the SSL related library routines and utilities +VERSION = 0.9.1c +PLATFORM=FreeBSD +# +# make install will install: +# libraries into $INSTALLTOP/lib +# headers into $INSTALLTOP/include +# utilities into $INSTALLTOP/bin +# +# By default INSTALLTOP is set to /usr/local/ssl +# If you want things install elsewere, consider running +# perl util/ssldir.pl /new/path +# +# Interesting Mailing Lists: +# ssl-bugs@mincom.oz.au +# ssl-users@mincom.oz.au +# +# To join the Mailing Lists: +# ssl-bugs-request@mincom.oz.au +# ssl-users-request@mincom.oz.au +# +# If you must get hold of people directly (we much prefer the above +# lists to be used if the question is of general interest!): +# Eric Young +# Tim Hudson +# or both +# +# The primary distribution of SSLeay is from +# ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL +# +# NOCONST - Define for C compilers that don't like the const key word. +# NOPROTO - Define in if your compiler does not support prototypes. +# RSAref - Define if we are to link with RSAref. +# NO_IDEA - Define to build without the IDEA algorithm +# NO_RC4 - Define to build without the RC4 algorithm +# NO_RC2 - Define to build without the RC2 algorithm +# THREADS - Define when building with threads, you will probably also need any +# system defines as well, i.e. _REENTERANT for Solaris 2.[34] +# TERMIO - Define the termio terminal subsystem, needed if sgtty is missing. +# TERMIOS - Define the termios terminal subsystem, Silicon Graphics. +# LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3). +# DEVRANDOM - Give this the value of the 'random device' if your OS supports +# one. 32 bytes will be read from this when the random +# number generator is initalised. +# SSL_ALLOW_ADH - define if you want the server to be able to use the +# SSLv3 anon-DH ciphers. +# SSL_ALLOW_ENULL - define if you want the server to be able to use the +# NULL encryption ciphers. +# +# LOCK_DEBUG - turns on lots of lock debug output :-) +# REF_CHECK - turn on some xyz_free() assertions. +# REF_PRINT - prints some stuff on structure free. +# CRYPTO_MDEBUG - turns on my 'memory leak' detecting stuff +# MFUNC - Make all Malloc/Free/Realloc calls call +# CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to +# call application defined callbacks via CRYPTO_set_mem_functions() +# MD5_ASM needs to be defined to use the x86 assembler for MD5 +# SHA1_ASM needs to be defined to use the x86 assembler for SHA1 +# RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160 +# Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8. It must +# equal 4. +# PKCS1_CHECK - pkcs1 tests. + +CC= gcc +#CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM +CFLAG= -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM +PEX_LIBS= -L. -L.. -L../.. -L../../.. +EX_LIBS= +AR=ar r + +# Set BN_ASM to bn_asm.o if you want to use the C version +BN_ASM= bn_asm.o +#BN_ASM= bn_asm.o +#BN_ASM= asm/bn86-elf.o # elf, linux-elf +#BN_ASM= asm/bn86-sol.o # solaris +#BN_ASM= asm/bn86-out.o # a.out, FreeBSD +#BN_ASM= asm/bn86bsdi.o # bsdi +#BN_ASM= asm/alpha.o # DEC Alpha +#BN_ASM= asm/pa-risc2.o # HP-UX PA-RISC +#BN_ASM= asm/r3000.o # SGI MIPS cpu +#BN_ASM= asm/sparc.o # Sun solaris/SunOS +#BN_ASM= asm/bn-win32.o # Windows 95/NT +#BN_ASM= asm/x86w16.o # 16 bit code for Windows 3.1/DOS +#BN_ASM= asm/x86w32.o # 32 bit code for Windows 3.1 + +# Set DES_ENC to des_enc.o if you want to use the C version +#There are 4 x86 assember options. +DES_ENC= asm/dx86-out.o asm/yx86-out.o +#DES_ENC= des_enc.o fcrypt_b.o # C +#DES_ENC= asm/dx86-elf.o asm/yx86-elf.o # elf +#DES_ENC= asm/dx86-sol.o asm/yx86-sol.o # solaris +#DES_ENC= asm/dx86-out.o asm/yx86-out.o # a.out, FreeBSD +#DES_ENC= asm/dx86bsdi.o asm/yx86bsdi.o # bsdi + +# Set BF_ENC to bf_enc.o if you want to use the C version +#There are 4 x86 assember options. +BF_ENC= asm/bx86-out.o +#BF_ENC= bf_enc.o +#BF_ENC= asm/bx86-elf.o # elf +#BF_ENC= asm/bx86-sol.o # solaris +#BF_ENC= asm/bx86-out.o # a.out, FreeBSD +#BF_ENC= asm/bx86bsdi.o # bsdi + +# Set CAST_ENC to c_enc.o if you want to use the C version +#There are 4 x86 assember options. +CAST_ENC= asm/cx86-out.o +#CAST_ENC= c_enc.o +#CAST_ENC= asm/cx86-elf.o # elf +#CAST_ENC= asm/cx86-sol.o # solaris +#CAST_ENC= asm/cx86-out.o # a.out, FreeBSD +#CAST_ENC= asm/cx86bsdi.o # bsdi + +# Set RC4_ENC to rc4_enc.o if you want to use the C version +#There are 4 x86 assember options. +RC4_ENC= asm/rx86-out.o +#RC4_ENC= rc4_enc.o +#RC4_ENC= asm/rx86-elf.o # elf +#RC4_ENC= asm/rx86-sol.o # solaris +#RC4_ENC= asm/rx86-out.o # a.out, FreeBSD +#RC4_ENC= asm/rx86bsdi.o # bsdi + +# Set RC5_ENC to rc5_enc.o if you want to use the C version +#There are 4 x86 assember options. +RC5_ENC= asm/r586-out.o +#RC5_ENC= rc5_enc.o +#RC5_ENC= asm/r586-elf.o # elf +#RC5_ENC= asm/r586-sol.o # solaris +#RC5_ENC= asm/r586-out.o # a.out, FreeBSD +#RC5_ENC= asm/r586bsdi.o # bsdi + +# Also need MD5_ASM defined +MD5_ASM_OBJ= asm/mx86-out.o +#MD5_ASM_OBJ= asm/mx86-elf.o # elf +#MD5_ASM_OBJ= asm/mx86-sol.o # solaris +#MD5_ASM_OBJ= asm/mx86-out.o # a.out, FreeBSD +#MD5_ASM_OBJ= asm/mx86bsdi.o # bsdi + +# Also need SHA1_ASM defined +SHA1_ASM_OBJ= asm/sx86-out.o +#SHA1_ASM_OBJ= asm/sx86-elf.o # elf +#SHA1_ASM_OBJ= asm/sx86-sol.o # solaris +#SHA1_ASM_OBJ= asm/sx86-out.o # a.out, FreeBSD +#SHA1_ASM_OBJ= asm/sx86bsdi.o # bsdi + +# Also need RMD160_ASM defined +RMD160_ASM_OBJ= asm/rm86-out.o +#RMD160_ASM_OBJ= asm/rm86-elf.o # elf +#RMD160_ASM_OBJ= asm/rm86-sol.o # solaris +#RMD160_ASM_OBJ= asm/rm86-out.o # a.out, FreeBSD +#RMD160_ASM_OBJ= asm/rm86bsdi.o # bsdi + +DIRS= crypto ssl rsaref apps test tools +# dirs in crypto to build +SDIRS= \ + md2 md5 sha mdc2 hmac ripemd \ + des rc2 rc4 rc5 idea bf cast \ + bn rsa dsa dh \ + buffer bio stack lhash rand err objects \ + evp pem asn1 x509 conf txt_db pkcs7 comp + +# If you change the INSTALLTOP, make sure to also change the values +# in crypto/location.h +INSTALLTOP=/usr/local/ssl + +MAKEFILE= Makefile.ssl +MAKE= make -f Makefile.ssl + +MAN1=1 +MAN3=3 +SHELL=/bin/sh + +TOP= . +ONEDIRS=out tmp +EDIRS= times doc bugs util include certs ms shlib mt demos perl sf dep +WDIRS= windows +LIBS= libcrypto.a libssl.a + +GENERAL= Makefile +BASENAME= openssl +NAME= $(BASENAME)-$(VERSION) +TARFILE= $(NAME).tar +WTARFILE= $(NAME)-win.tar +EXHEADER= e_os.h +HEADER= e_os.h + +all: + @for i in $(DIRS) ;\ + do \ + (cd $$i; echo "making $$i..."; \ + $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' SDIRS='${SDIRS}' AR='${AR}' all ); \ + done; + +sub_all: + @for i in $(DIRS) ;\ + do \ + (cd $$i; echo "making $$i..."; \ + $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' all ); \ + done; + +libclean: + /bin/rm *.a */lib */*/lib + +clean: + /bin/rm -f shlib/*.o *.o core a.out fluff *.map + @for i in $(DIRS) ;\ + do \ + (cd $$i; echo "cleaning $$i..."; \ + $(MAKE) SDIRS='${SDIRS}' clean ); \ + /bin/rm -f $(LIBS); \ + done; + /bin/rm -f *.a *.o speed.* *.map *.so .pure core + /bin/rm -f $(TARFILE) + @for i in $(ONEDIRS) ;\ + do \ + /bin/rm -fr $$i/*; \ + done + +makefile.one: files + perl util/mk1mf.pl >makefile.one; \ + sh util/do_ms.sh + +files: MINFO + perl $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO + @for i in $(DIRS) ;\ + do \ + (cd $$i; echo "making 'files' in $$i..."; \ + $(MAKE) SDIRS='${SDIRS}' files ); \ + done; + +links: + /bin/rm -f Makefile + ./util/point.sh Makefile.ssl Makefile + $(TOP)/util/mklink.sh include $(EXHEADER) + @for i in $(DIRS) ;\ + do \ + (cd $$i; echo "making links in $$i..."; \ + $(MAKE) SDIRS='${SDIRS}' links ); \ + done; + @(SSLEAY="`pwd`/apps/ssleay"; export SSLEAY; sh tools/c_rehash certs) + +dclean: + /bin/rm -f *.bak + @for i in $(DIRS) ;\ + do \ + (cd $$i; echo "undoing makedepend in $$i..."; \ + $(MAKE) SDIRS='${SDIRS}' dclean ); \ + done; + +rehash: + @(PATH="`pwd`/apps:${PATH}"; sh tools/c_rehash certs) + +test: tests + +tests: + (cd test; echo "testing $$i..."; \ + $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SDIRS='${SDIRS}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' tests ); + @apps/ssleay version -a + +depend: + @for i in $(DIRS) ;\ + do \ + (cd $$i; echo "making dependancies $$i..."; \ + $(MAKE) SDIRS='${SDIRS}' depend ); \ + done; + +lint: + @for i in $(DIRS) ;\ + do \ + (cd $$i; echo "making lint $$i..."; \ + $(MAKE) SDIRS='${SDIRS}' lint ); \ + done; + +tags: + @for i in $(DIRS) ;\ + do \ + (cd $$i; echo "making tags $$i..."; \ + $(MAKE) SDIRS='${SDIRS}' tags ); \ + done; + +errors: + @for i in $(DIRS) ;\ + do \ + (cd $$i; echo "making errors in $$i..."; \ + $(MAKE) SDIRS='${SDIRS}' errors ); \ + done; + +tar: + @gtar --no-recursion -cvf - \ + `find * -depth -print | grep -v CVS | grep -v .cvsignore | sort` |\ + tardy --user_number=0 --user_name=rse \ + --group_number=0 --group_name=openssl \ + --prefix=openssl-$(VERSION) - |\ + gzip --best >../$(TARFILE).gz; \ + ls -l ../$(TARFILE).gz + +dist: + perl Configure dist + perl util/up_ver.pl ${VERSION} + @$(MAKE) dist_pem_h + @$(MAKE) SDIRS='${SDIRS}' clean + @$(MAKE) SDIRS='${SDIRS}' dclean + @(cd apps; sh ./rmlinks) + @$(MAKE) makefile.one + @$(MAKE) tar + +dist_pem_h: + (cd crypto/pem; $(MAKE) SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean) + +install: all + @-mkdir -p $(INSTALLTOP)/bin 2>/dev/null + @-mkdir -p $(INSTALLTOP)/lib 2>/dev/null + @-mkdir -p $(INSTALLTOP)/include 2>/dev/null + @-mkdir -p $(INSTALLTOP)/certs 2>/dev/null + @-mkdir -p $(INSTALLTOP)/private 2>/dev/null + @for i in $(DIRS) ;\ + do \ + (cd $$i; echo "installing $$i..."; \ + $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' install ); \ + done + @for i in $(LIBS) ;\ + do \ + ( echo installing $$i; \ + cp $$i $(INSTALLTOP)/lib; \ + sh util/ranlib.sh $(INSTALLTOP)/lib/$$i; \ + chmod 644 $(INSTALLTOP)/lib/$$i ); \ + done + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/Makefile.ssl b/Makefile.ssl deleted file mode 100644 index f6cb64329a..0000000000 --- a/Makefile.ssl +++ /dev/null @@ -1,329 +0,0 @@ -# -# Makefile for all the SSL related library routines and utilities -VERSION = 0.9.1c -PLATFORM=dist -# -# make install will install: -# libraries into $INSTALLTOP/lib -# headers into $INSTALLTOP/include -# utilities into $INSTALLTOP/bin -# -# By default INSTALLTOP is set to /usr/local/ssl -# If you want things install elsewere, consider running -# perl util/ssldir.pl /new/path -# -# Interesting Mailing Lists: -# ssl-bugs@mincom.oz.au -# ssl-users@mincom.oz.au -# -# To join the Mailing Lists: -# ssl-bugs-request@mincom.oz.au -# ssl-users-request@mincom.oz.au -# -# If you must get hold of people directly (we much prefer the above -# lists to be used if the question is of general interest!): -# Eric Young -# Tim Hudson -# or both -# -# The primary distribution of SSLeay is from -# ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL -# -# NOCONST - Define for C compilers that don't like the const key word. -# NOPROTO - Define in if your compiler does not support prototypes. -# RSAref - Define if we are to link with RSAref. -# NO_IDEA - Define to build without the IDEA algorithm -# NO_RC4 - Define to build without the RC4 algorithm -# NO_RC2 - Define to build without the RC2 algorithm -# THREADS - Define when building with threads, you will probably also need any -# system defines as well, i.e. _REENTERANT for Solaris 2.[34] -# TERMIO - Define the termio terminal subsystem, needed if sgtty is missing. -# TERMIOS - Define the termios terminal subsystem, Silicon Graphics. -# LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3). -# DEVRANDOM - Give this the value of the 'random device' if your OS supports -# one. 32 bytes will be read from this when the random -# number generator is initalised. -# SSL_ALLOW_ADH - define if you want the server to be able to use the -# SSLv3 anon-DH ciphers. -# SSL_ALLOW_ENULL - define if you want the server to be able to use the -# NULL encryption ciphers. -# -# LOCK_DEBUG - turns on lots of lock debug output :-) -# REF_CHECK - turn on some xyz_free() assertions. -# REF_PRINT - prints some stuff on structure free. -# CRYPTO_MDEBUG - turns on my 'memory leak' detecting stuff -# MFUNC - Make all Malloc/Free/Realloc calls call -# CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to -# call application defined callbacks via CRYPTO_set_mem_functions() -# MD5_ASM needs to be defined to use the x86 assembler for MD5 -# SHA1_ASM needs to be defined to use the x86 assembler for SHA1 -# RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160 -# Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8. It must -# equal 4. -# PKCS1_CHECK - pkcs1 tests. - -CC= cc -#CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM -CFLAG= -O -DNOPROTO -PEX_LIBS= -L. -L.. -L../.. -L../../.. -EX_LIBS= -AR=ar r - -# Set BN_ASM to bn_asm.o if you want to use the C version -BN_ASM= bn_asm.o -#BN_ASM= bn_asm.o -#BN_ASM= asm/bn86-elf.o # elf, linux-elf -#BN_ASM= asm/bn86-sol.o # solaris -#BN_ASM= asm/bn86-out.o # a.out, FreeBSD -#BN_ASM= asm/bn86bsdi.o # bsdi -#BN_ASM= asm/alpha.o # DEC Alpha -#BN_ASM= asm/pa-risc2.o # HP-UX PA-RISC -#BN_ASM= asm/r3000.o # SGI MIPS cpu -#BN_ASM= asm/sparc.o # Sun solaris/SunOS -#BN_ASM= asm/bn-win32.o # Windows 95/NT -#BN_ASM= asm/x86w16.o # 16 bit code for Windows 3.1/DOS -#BN_ASM= asm/x86w32.o # 32 bit code for Windows 3.1 - -# Set DES_ENC to des_enc.o if you want to use the C version -#There are 4 x86 assember options. -DES_ENC= des_enc.o fcrypt_b.o -#DES_ENC= des_enc.o fcrypt_b.o # C -#DES_ENC= asm/dx86-elf.o asm/yx86-elf.o # elf -#DES_ENC= asm/dx86-sol.o asm/yx86-sol.o # solaris -#DES_ENC= asm/dx86-out.o asm/yx86-out.o # a.out, FreeBSD -#DES_ENC= asm/dx86bsdi.o asm/yx86bsdi.o # bsdi - -# Set BF_ENC to bf_enc.o if you want to use the C version -#There are 4 x86 assember options. -BF_ENC= bf_enc.o -#BF_ENC= bf_enc.o -#BF_ENC= asm/bx86-elf.o # elf -#BF_ENC= asm/bx86-sol.o # solaris -#BF_ENC= asm/bx86-out.o # a.out, FreeBSD -#BF_ENC= asm/bx86bsdi.o # bsdi - -# Set CAST_ENC to c_enc.o if you want to use the C version -#There are 4 x86 assember options. -CAST_ENC= c_enc.o -#CAST_ENC= c_enc.o -#CAST_ENC= asm/cx86-elf.o # elf -#CAST_ENC= asm/cx86-sol.o # solaris -#CAST_ENC= asm/cx86-out.o # a.out, FreeBSD -#CAST_ENC= asm/cx86bsdi.o # bsdi - -# Set RC4_ENC to rc4_enc.o if you want to use the C version -#There are 4 x86 assember options. -RC4_ENC= rc4_enc.o -#RC4_ENC= rc4_enc.o -#RC4_ENC= asm/rx86-elf.o # elf -#RC4_ENC= asm/rx86-sol.o # solaris -#RC4_ENC= asm/rx86-out.o # a.out, FreeBSD -#RC4_ENC= asm/rx86bsdi.o # bsdi - -# Set RC5_ENC to rc5_enc.o if you want to use the C version -#There are 4 x86 assember options. -RC5_ENC= rc5_enc.o -#RC5_ENC= rc5_enc.o -#RC5_ENC= asm/r586-elf.o # elf -#RC5_ENC= asm/r586-sol.o # solaris -#RC5_ENC= asm/r586-out.o # a.out, FreeBSD -#RC5_ENC= asm/r586bsdi.o # bsdi - -# Also need MD5_ASM defined -MD5_ASM_OBJ= -#MD5_ASM_OBJ= asm/mx86-elf.o # elf -#MD5_ASM_OBJ= asm/mx86-sol.o # solaris -#MD5_ASM_OBJ= asm/mx86-out.o # a.out, FreeBSD -#MD5_ASM_OBJ= asm/mx86bsdi.o # bsdi - -# Also need SHA1_ASM defined -SHA1_ASM_OBJ= -#SHA1_ASM_OBJ= asm/sx86-elf.o # elf -#SHA1_ASM_OBJ= asm/sx86-sol.o # solaris -#SHA1_ASM_OBJ= asm/sx86-out.o # a.out, FreeBSD -#SHA1_ASM_OBJ= asm/sx86bsdi.o # bsdi - -# Also need RMD160_ASM defined -RMD160_ASM_OBJ= -#RMD160_ASM_OBJ= asm/rm86-elf.o # elf -#RMD160_ASM_OBJ= asm/rm86-sol.o # solaris -#RMD160_ASM_OBJ= asm/rm86-out.o # a.out, FreeBSD -#RMD160_ASM_OBJ= asm/rm86bsdi.o # bsdi - -DIRS= crypto ssl rsaref apps test tools -# dirs in crypto to build -SDIRS= \ - md2 md5 sha mdc2 hmac ripemd \ - des rc2 rc4 rc5 idea bf cast \ - bn rsa dsa dh \ - buffer bio stack lhash rand err objects \ - evp pem asn1 x509 conf txt_db pkcs7 comp - -# If you change the INSTALLTOP, make sure to also change the values -# in crypto/location.h -INSTALLTOP=/usr/local/ssl - -MAKEFILE= Makefile.ssl -MAKE= make -f Makefile.ssl - -MAN1=1 -MAN3=3 -SHELL=/bin/sh - -TOP= . -ONEDIRS=out tmp -EDIRS= times doc bugs util include certs ms shlib mt demos perl sf dep -WDIRS= windows -LIBS= libcrypto.a libssl.a - -GENERAL= Makefile -BASENAME= openssl -NAME= $(BASENAME)-$(VERSION) -TARFILE= $(NAME).tar -WTARFILE= $(NAME)-win.tar -EXHEADER= e_os.h -HEADER= e_os.h - -all: - @for i in $(DIRS) ;\ - do \ - (cd $$i; echo "making $$i..."; \ - $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' SDIRS='${SDIRS}' AR='${AR}' all ); \ - done; - -sub_all: - @for i in $(DIRS) ;\ - do \ - (cd $$i; echo "making $$i..."; \ - $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' all ); \ - done; - -libclean: - /bin/rm *.a */lib */*/lib - -clean: - /bin/rm -f shlib/*.o *.o core a.out fluff *.map - @for i in $(DIRS) ;\ - do \ - (cd $$i; echo "cleaning $$i..."; \ - $(MAKE) SDIRS='${SDIRS}' clean ); \ - /bin/rm -f $(LIBS); \ - done; - /bin/rm -f *.a *.o speed.* *.map *.so .pure core - /bin/rm -f $(TARFILE) - @for i in $(ONEDIRS) ;\ - do \ - /bin/rm -fr $$i/*; \ - done - -makefile.one: files - perl util/mk1mf.pl >makefile.one; \ - sh util/do_ms.sh - -files: MINFO - perl $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO - @for i in $(DIRS) ;\ - do \ - (cd $$i; echo "making 'files' in $$i..."; \ - $(MAKE) SDIRS='${SDIRS}' files ); \ - done; - -links: - /bin/rm -f Makefile - ./util/point.sh Makefile.ssl Makefile - $(TOP)/util/mklink.sh include $(EXHEADER) - @for i in $(DIRS) ;\ - do \ - (cd $$i; echo "making links in $$i..."; \ - $(MAKE) SDIRS='${SDIRS}' links ); \ - done; - @(SSLEAY="`pwd`/apps/ssleay"; export SSLEAY; sh tools/c_rehash certs) - -dclean: - /bin/rm -f *.bak - @for i in $(DIRS) ;\ - do \ - (cd $$i; echo "undoing makedepend in $$i..."; \ - $(MAKE) SDIRS='${SDIRS}' dclean ); \ - done; - -rehash: - @(PATH="`pwd`/apps:${PATH}"; sh tools/c_rehash certs) - -test: tests - -tests: - (cd test; echo "testing $$i..."; \ - $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SDIRS='${SDIRS}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' tests ); - @apps/ssleay version -a - -depend: - @for i in $(DIRS) ;\ - do \ - (cd $$i; echo "making dependancies $$i..."; \ - $(MAKE) SDIRS='${SDIRS}' depend ); \ - done; - -lint: - @for i in $(DIRS) ;\ - do \ - (cd $$i; echo "making lint $$i..."; \ - $(MAKE) SDIRS='${SDIRS}' lint ); \ - done; - -tags: - @for i in $(DIRS) ;\ - do \ - (cd $$i; echo "making tags $$i..."; \ - $(MAKE) SDIRS='${SDIRS}' tags ); \ - done; - -errors: - @for i in $(DIRS) ;\ - do \ - (cd $$i; echo "making errors in $$i..."; \ - $(MAKE) SDIRS='${SDIRS}' errors ); \ - done; - -tar: - @gtar --no-recursion -cvf - \ - `find * -depth -print | grep -v CVS | grep -v .cvsignore | sort` |\ - tardy --user_number=0 --user_name=rse \ - --group_number=0 --group_name=openssl \ - --prefix=openssl-$(VERSION) - |\ - gzip --best >../$(TARFILE).gz; \ - ls -l ../$(TARFILE).gz - -dist: - perl Configure dist - perl util/up_ver.pl ${VERSION} - @$(MAKE) dist_pem_h - @$(MAKE) SDIRS='${SDIRS}' clean - @$(MAKE) SDIRS='${SDIRS}' dclean - @(cd apps; sh ./rmlinks) - @$(MAKE) makefile.one - @$(MAKE) tar - -dist_pem_h: - (cd crypto/pem; $(MAKE) SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean) - -install: all - @-mkdir -p $(INSTALLTOP)/bin 2>/dev/null - @-mkdir -p $(INSTALLTOP)/lib 2>/dev/null - @-mkdir -p $(INSTALLTOP)/include 2>/dev/null - @-mkdir -p $(INSTALLTOP)/certs 2>/dev/null - @-mkdir -p $(INSTALLTOP)/private 2>/dev/null - @for i in $(DIRS) ;\ - do \ - (cd $$i; echo "installing $$i..."; \ - $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' install ); \ - done - @for i in $(LIBS) ;\ - do \ - ( echo installing $$i; \ - cp $$i $(INSTALLTOP)/lib; \ - sh util/ranlib.sh $(INSTALLTOP)/lib/$$i; \ - chmod 644 $(INSTALLTOP)/lib/$$i ); \ - done - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/crypto/bf/bf_locl.h b/crypto/bf/bf_locl.h deleted file mode 100644 index a5663de8ca..0000000000 --- a/crypto/bf/bf_locl.h +++ /dev/null @@ -1,242 +0,0 @@ -/* crypto/bf/bf_locl.org */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * 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@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of 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. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * 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@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - * - * Always modify bf_locl.org since bf_locl.h is automatically generated from - * it during SSLeay configuration. - * - * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - */ - -/* 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 BF_PTR -#elif defined( __ultrix ) /* Older MIPS */ -# define BF_PTR -#elif defined( __osf1__ ) /* Alpha */ - /* None */ -#elif defined ( _AIX ) /* RS6000 */ - /* Unknown */ -#elif defined( __hpux ) /* HP-PA */ - /* None */ -#elif defined( __aux ) /* 68K */ - /* Unknown */ -#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ - /* Unknown */ -#elif defined( __sgi ) /* Newer MIPS */ -# define BF_PTR -#elif defined( i386 ) /* x86 boxes, should be gcc */ -#elif defined( _MSC_VER ) /* x86 boxes, Visual C */ -#endif /* Systems-specific speed defines */ - -#undef c2l -#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ - l|=((unsigned long)(*((c)++)))<< 8L, \ - l|=((unsigned long)(*((c)++)))<<16L, \ - l|=((unsigned long)(*((c)++)))<<24L) - -/* NOTE - c is not incremented as per c2l */ -#undef c2ln -#define c2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((unsigned long)(*(--(c))))<<24L; \ - case 7: l2|=((unsigned long)(*(--(c))))<<16L; \ - case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \ - case 5: l2|=((unsigned long)(*(--(c)))); \ - case 4: l1 =((unsigned long)(*(--(c))))<<24L; \ - case 3: l1|=((unsigned long)(*(--(c))))<<16L; \ - case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \ - case 1: l1|=((unsigned long)(*(--(c)))); \ - } \ - } - -#undef l2c -#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>24L)&0xff)) - -/* NOTE - c is not incremented as per l2c */ -#undef l2cn -#define l2cn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ - } \ - } - -/* NOTE - c is not incremented as per n2l */ -#define n2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((unsigned long)(*(--(c)))) ; \ - case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ - case 6: l2|=((unsigned long)(*(--(c))))<<16; \ - case 5: l2|=((unsigned long)(*(--(c))))<<24; \ - case 4: l1 =((unsigned long)(*(--(c)))) ; \ - case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ - case 2: l1|=((unsigned long)(*(--(c))))<<16; \ - case 1: l1|=((unsigned long)(*(--(c))))<<24; \ - } \ - } - -/* NOTE - c is not incremented as per l2n */ -#define l2nn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ - } \ - } - -#undef n2l -#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ - l|=((unsigned long)(*((c)++)))<<16L, \ - l|=((unsigned long)(*((c)++)))<< 8L, \ - l|=((unsigned long)(*((c)++)))) - -#undef l2n -#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l) )&0xff)) - -/* This is actually a big endian algorithm, the most significate byte - * is used to lookup array 0 */ - -/* use BF_PTR2 for intel boxes, - * BF_PTR for sparc and MIPS/SGI - * use nothing for Alpha and HP. - */ -#if !defined(BF_PTR) && !defined(BF_PTR2) -#undef BF_PTR -#endif - -#define BF_M 0x3fc -#define BF_0 22L -#define BF_1 14L -#define BF_2 6L -#define BF_3 2L /* left shift */ - -#if defined(BF_PTR2) - -/* This is basically a special pentium verson */ -#define BF_ENC(LL,R,S,P) \ - { \ - BF_LONG t,u,v; \ - u=R>>BF_0; \ - v=R>>BF_1; \ - u&=BF_M; \ - v&=BF_M; \ - t= *(BF_LONG *)((unsigned char *)&(S[ 0])+u); \ - u=R>>BF_2; \ - t+= *(BF_LONG *)((unsigned char *)&(S[256])+v); \ - v=R<>BF_0)&BF_M))+ \ - *(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \ - *(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \ - *(BF_LONG *)((unsigned char *)&(S[768])+((R<>24L) ] + \ - S[0x0100+((int)(R>>16L)&0xff)])^ \ - S[0x0200+((int)(R>> 8L)&0xff)])+ \ - S[0x0300+((int)(R )&0xff)])&0xffffffffL; -#endif diff --git a/crypto/bn/bn.h b/crypto/bn/bn.h deleted file mode 100644 index 90b438e589..0000000000 --- a/crypto/bn/bn.h +++ /dev/null @@ -1,599 +0,0 @@ -/* crypto/bn/bn.org */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * 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@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of 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. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * 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@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - * - * Always modify bn.org since bn.h is automatically generated from - * it during SSLeay configuration. - * - * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - */ - -#ifndef HEADER_BN_H -#define HEADER_BN_H - -#ifdef __cplusplus -extern "C" { -#endif - -#undef BN_LLONG - -#ifdef WIN32 -#define BN_LLONG /* This comment stops Configure mutilating things */ -#endif - -#define BN_MUL_COMBA -#define BN_SQR_COMBA -#define BN_RECURSION -#define RECP_MUL_MOD -#define MONT_MUL_MOD - -/* This next option uses the C libraries (2 word)/(1 word) function. - * If it is not defined, I use my C version (which is slower). - * The reason for this flag is that when the particular C compiler - * library routine is used, and the library is linked with a different - * compiler, the library is missing. This mostly happens when the - * library is built with gcc and then linked using nornal cc. This would - * be a common occurance because gcc normally produces code that is - * 2 times faster than system compilers for the big number stuff. - * For machines with only one compiler (or shared libraries), this should - * be on. Again this in only really a problem on machines - * using "long long's", are 32bit, and are not using my assember code. */ -#if defined(MSDOS) || defined(WINDOWS) || defined(linux) -#define BN_DIV2W -#endif - -/* Only one for the following should be defined */ -/* The prime number generation stuff may not work when - * EIGHT_BIT but I don't care since I've only used this mode - * for debuging the bignum libraries */ -#undef SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#define THIRTY_TWO_BIT -#undef SIXTEEN_BIT -#undef EIGHT_BIT - - -/* assuming long is 64bit - this is the DEC Alpha - * unsigned long long is only 64 bits :-(, don't define - * BN_LLONG for the DEC Alpha */ -#ifdef SIXTY_FOUR_BIT_LONG -#define BN_ULLONG unsigned long long -#define BN_ULONG unsigned long -#define BN_LONG long -#define BN_BITS 128 -#define BN_BYTES 8 -#define BN_BITS2 64 -#define BN_BITS4 32 -#define BN_MASK (0xffffffffffffffffffffffffffffffffLL) -#define BN_MASK2 (0xffffffffffffffffL) -#define BN_MASK2l (0xffffffffL) -#define BN_MASK2h (0xffffffff00000000L) -#define BN_MASK2h1 (0xffffffff80000000L) -#define BN_TBIT (0x8000000000000000L) -#define BN_DEC_CONV (10000000000000000000UL) -#define BN_DEC_FMT1 "%lu" -#define BN_DEC_FMT2 "%019lu" -#define BN_DEC_NUM 19 -#endif - -/* This is where the long long data type is 64 bits, but long is 32. - * For machines where there are 64bit registers, this is the mode to use. - * IRIX, on R4000 and above should use this mode, along with the relevent - * assember code :-). Do NOT define BN_ULLONG. - */ -#ifdef SIXTY_FOUR_BIT -#undef BN_LLONG -/* #define BN_ULLONG unsigned long long */ -#define BN_ULONG unsigned long long -#define BN_LONG long long -#define BN_BITS 128 -#define BN_BYTES 8 -#define BN_BITS2 64 -#define BN_BITS4 32 -#define BN_MASK2 (0xffffffffffffffffLL) -#define BN_MASK2l (0xffffffffL) -#define BN_MASK2h (0xffffffff00000000LL) -#define BN_MASK2h1 (0xffffffff80000000LL) -#define BN_TBIT (0x8000000000000000LL) -#define BN_DEC_CONV (10000000000000000000LL) -#define BN_DEC_FMT1 "%llu" -#define BN_DEC_FMT2 "%019llu" -#define BN_DEC_NUM 19 -#endif - -#ifdef THIRTY_TWO_BIT -#ifdef WIN32 -#define BN_ULLONG unsigned _int64 -#else -#define BN_ULLONG unsigned long long -#endif -#define BN_ULONG unsigned long -#define BN_LONG long -#define BN_BITS 64 -#define BN_BYTES 4 -#define BN_BITS2 32 -#define BN_BITS4 16 -#define BN_MASK (0xffffffffffffffffLL) -#define BN_MASK2 (0xffffffffL) -#define BN_MASK2l (0xffff) -#define BN_MASK2h1 (0xffff8000L) -#define BN_MASK2h (0xffff0000L) -#define BN_TBIT (0x80000000L) -#define BN_DEC_CONV (1000000000L) -#define BN_DEC_FMT1 "%lu" -#define BN_DEC_FMT2 "%09lu" -#define BN_DEC_NUM 9 -#endif - -#ifdef SIXTEEN_BIT -#ifndef BN_DIV2W -#define BN_DIV2W -#endif -#define BN_ULLONG unsigned long -#define BN_ULONG unsigned short -#define BN_LONG short -#define BN_BITS 32 -#define BN_BYTES 2 -#define BN_BITS2 16 -#define BN_BITS4 8 -#define BN_MASK (0xffffffff) -#define BN_MASK2 (0xffff) -#define BN_MASK2l (0xff) -#define BN_MASK2h1 (0xff80) -#define BN_MASK2h (0xff00) -#define BN_TBIT (0x8000) -#define BN_DEC_CONV (100000) -#define BN_DEC_FMT1 "%u" -#define BN_DEC_FMT2 "%05u" -#define BN_DEC_NUM 5 -#endif - -#ifdef EIGHT_BIT -#ifndef BN_DIV2W -#define BN_DIV2W -#endif -#define BN_ULLONG unsigned short -#define BN_ULONG unsigned char -#define BN_LONG char -#define BN_BITS 16 -#define BN_BYTES 1 -#define BN_BITS2 8 -#define BN_BITS4 4 -#define BN_MASK (0xffff) -#define BN_MASK2 (0xff) -#define BN_MASK2l (0xf) -#define BN_MASK2h1 (0xf8) -#define BN_MASK2h (0xf0) -#define BN_TBIT (0x80) -#define BN_DEC_CONV (100) -#define BN_DEC_FMT1 "%u" -#define BN_DEC_FMT2 "%02u" -#define BN_DEC_NUM 2 -#endif - -#define BN_DEFAULT_BITS 1280 - -#ifdef BIGNUM -#undef BIGNUM -#endif - -#define BN_FLG_MALLOCED 0x01 -#define BN_FLG_STATIC_DATA 0x02 -#define BN_FLG_FREE 0x8000 /* used for debuging */ -#define BN_set_flags(b,n) ((b)->flags|=(n)) -#define BN_get_flags(b,n) ((b)->flags&(n)) - -typedef struct bignum_st - { - BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ - int top; /* Index of last used d +1. */ - /* The next are internal book keeping for bn_expand. */ - int max; /* Size of the d array. */ - int neg; /* one if the number is negative */ - int flags; - } BIGNUM; - -/* Used for temp variables */ -#define BN_CTX_NUM 12 -typedef struct bignum_ctx - { - int tos; - BIGNUM bn[BN_CTX_NUM+1]; - int flags; - } BN_CTX; - -typedef struct bn_blinding_st - { - int init; - BIGNUM *A; - BIGNUM *Ai; - BIGNUM *mod; /* just a reference */ - } BN_BLINDING; - -/* Used for montgomery multiplication */ -typedef struct bn_mont_ctx_st - { - int use_word; /* 0 for word form, 1 for long form */ - int ri; /* number of bits in R */ - BIGNUM RR; /* used to convert to montgomery form */ - BIGNUM N; /* The modulus */ - BIGNUM Ni; /* The inverse of N */ - BN_ULONG n0; /* word form of inverse, normally only one of - * Ni or n0 is defined */ - int flags; - } BN_MONT_CTX; - -/* Used for reciprocal division/mod functions - * It cannot be shared between threads - */ -typedef struct bn_recp_ctx_st - { - BIGNUM N; /* the divisor */ - BIGNUM Nr; /* the reciprocal */ - int num_bits; - int shift; - int flags; - } BN_RECP_CTX; - -#define BN_to_montgomery(r,a,mont,ctx) BN_mod_mul_montgomery(\ - r,a,&((mont)->RR),(mont),ctx) - -#define BN_prime_checks (5) - -#define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) -#define BN_is_word(a,w) (((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) -#define BN_is_zero(a) (((a)->top == 0) || BN_is_word(a,0)) -#define BN_is_one(a) (BN_is_word((a),1)) -#define BN_is_odd(a) (((a)->top > 0) && ((a)->d[0] & 1)) -#define BN_one(a) (BN_set_word((a),1)) -#define BN_zero(a) (BN_set_word((a),0)) - -/*#define BN_ascii2bn(a) BN_hex2bn(a) */ -/*#define BN_bn2ascii(a) BN_bn2hex(a) */ - -#define bn_expand(n,b) ((((((b+BN_BITS2-1))/BN_BITS2)) <= (n)->max)?\ - (n):bn_expand2((n),(b)/BN_BITS2+1)) -#define bn_wexpand(n,b) (((b) <= (n)->max)?(n):bn_expand2((n),(b))) - -#define bn_fix_top(a) \ - { \ - BN_ULONG *ftl; \ - if ((a)->top > 0) \ - { \ - for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \ - if (*(ftl--)) break; \ - } \ - } - -#ifndef NOPROTO -BIGNUM *BN_value_one(void); -char * BN_options(void); -BN_CTX *BN_CTX_new(void); -void BN_CTX_init(BN_CTX *c); -void BN_CTX_free(BN_CTX *c); -int BN_rand(BIGNUM *rnd, int bits, int top,int bottom); -int BN_num_bits(BIGNUM *a); -int BN_num_bits_word(BN_ULONG); -BIGNUM *BN_new(void); -void BN_init(BIGNUM *); -void BN_clear_free(BIGNUM *a); -BIGNUM *BN_copy(BIGNUM *a, BIGNUM *b); -BIGNUM *BN_bin2bn(unsigned char *s,int len,BIGNUM *ret); -int BN_bn2bin(BIGNUM *a, unsigned char *to); -BIGNUM *BN_mpi2bn(unsigned char *s,int len,BIGNUM *ret); -int BN_bn2mpi(BIGNUM *a, unsigned char *to); -int BN_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b); -int BN_usub(BIGNUM *r, BIGNUM *a, BIGNUM *b); -int BN_uadd(BIGNUM *r, BIGNUM *a, BIGNUM *b); -int BN_add(BIGNUM *r, BIGNUM *a, BIGNUM *b); -int BN_mod(BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); -int BN_div(BIGNUM *dv, BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); -int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b,BN_CTX *ctx); -int BN_sqr(BIGNUM *r, BIGNUM *a,BN_CTX *ctx); -BN_ULONG BN_mod_word(BIGNUM *a, BN_ULONG w); -BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); -int BN_mul_word(BIGNUM *a, BN_ULONG w); -int BN_add_word(BIGNUM *a, BN_ULONG w); -int BN_sub_word(BIGNUM *a, BN_ULONG w); -int BN_set_word(BIGNUM *a, BN_ULONG w); -BN_ULONG BN_get_word(BIGNUM *a); -int BN_cmp(BIGNUM *a, BIGNUM *b); -void BN_free(BIGNUM *a); -int BN_is_bit_set(BIGNUM *a, int n); -int BN_lshift(BIGNUM *r, BIGNUM *a, int n); -int BN_lshift1(BIGNUM *r, BIGNUM *a); -int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p,BN_CTX *ctx); -int BN_mod_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx); -int BN_mod_exp_mont(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx, - BN_MONT_CTX *m_ctx); -int BN_mod_exp2_mont(BIGNUM *r, BIGNUM *a1, BIGNUM *p1,BIGNUM *a2, - BIGNUM *p2,BIGNUM *m,BN_CTX *ctx,BN_MONT_CTX *m_ctx); -int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, BIGNUM *p, - BIGNUM *m,BN_CTX *ctx); -int BN_mask_bits(BIGNUM *a,int n); -int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, BIGNUM *m, - BN_CTX *ctx); -#ifndef WIN16 -int BN_print_fp(FILE *fp, BIGNUM *a); -#endif -#ifdef HEADER_BIO_H -int BN_print(BIO *fp, BIGNUM *a); -#else -int BN_print(char *fp, BIGNUM *a); -#endif -int BN_reciprocal(BIGNUM *r, BIGNUM *m, int len, BN_CTX *ctx); -int BN_rshift(BIGNUM *r, BIGNUM *a, int n); -int BN_rshift1(BIGNUM *r, BIGNUM *a); -void BN_clear(BIGNUM *a); -BIGNUM *bn_expand2(BIGNUM *b, int bits); -BIGNUM *BN_dup(BIGNUM *a); -int BN_ucmp(BIGNUM *a, BIGNUM *b); -int BN_set_bit(BIGNUM *a, int n); -int BN_clear_bit(BIGNUM *a, int n); -char * BN_bn2hex(BIGNUM *a); -char * BN_bn2dec(BIGNUM *a); -int BN_hex2bn(BIGNUM **a,char *str); -int BN_dec2bn(BIGNUM **a,char *str); -int BN_gcd(BIGNUM *r,BIGNUM *in_a,BIGNUM *in_b,BN_CTX *ctx); -BIGNUM *BN_mod_inverse(BIGNUM *ret,BIGNUM *a, BIGNUM *n,BN_CTX *ctx); -BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int strong,BIGNUM *add, - BIGNUM *rem,void (*callback)(int,int,char *),char *cb_arg); -int BN_is_prime(BIGNUM *p,int nchecks,void (*callback)(int,int,char *), - BN_CTX *ctx,char *cb_arg); -void ERR_load_BN_strings(void ); - -BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); -BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); -void bn_sqr_words(BN_ULONG *rp, BN_ULONG *ap, int num); -BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); -BN_ULONG bn_add_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int num); -BN_ULONG bn_sub_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int num); - -BN_MONT_CTX *BN_MONT_CTX_new(void ); -void BN_MONT_CTX_init(BN_MONT_CTX *ctx); -int BN_mod_mul_montgomery(BIGNUM *r,BIGNUM *a,BIGNUM *b,BN_MONT_CTX *mont, - BN_CTX *ctx); -int BN_from_montgomery(BIGNUM *r,BIGNUM *a,BN_MONT_CTX *mont,BN_CTX *ctx); -void BN_MONT_CTX_free(BN_MONT_CTX *mont); -int BN_MONT_CTX_set(BN_MONT_CTX *mont,BIGNUM *modulus,BN_CTX *ctx); -BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to,BN_MONT_CTX *from); - -BN_BLINDING *BN_BLINDING_new(BIGNUM *A,BIGNUM *Ai,BIGNUM *mod); -void BN_BLINDING_free(BN_BLINDING *b); -int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); -int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *r, BN_CTX *ctx); -int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); - -void BN_set_params(int mul,int high,int low,int mont); -int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */ - -void bn_mul_normal(BN_ULONG *r,BN_ULONG *a,int na,BN_ULONG *b,int nb); -void bn_mul_comba8(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b); -void bn_mul_comba4(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b); -void bn_sqr_normal(BN_ULONG *r, BN_ULONG *a, int n, BN_ULONG *tmp); -void bn_sqr_comba8(BN_ULONG *r,BN_ULONG *a); -void bn_sqr_comba4(BN_ULONG *r,BN_ULONG *a); -int bn_cmp_words(BN_ULONG *a,BN_ULONG *b,int n); -void bn_mul_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,int n2,BN_ULONG *t); -void bn_mul_part_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b, - int tn, int n,BN_ULONG *t); -void bn_sqr_recursive(BN_ULONG *r,BN_ULONG *a, int n2, BN_ULONG *t); -void bn_mul_low_normal(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b, int n); - -void BN_RECP_CTX_init(BN_RECP_CTX *recp); -BN_RECP_CTX *BN_RECP_CTX_new(void); -void BN_RECP_CTX_free(BN_RECP_CTX *recp); -int BN_RECP_CTX_set(BN_RECP_CTX *recp,BIGNUM *rdiv,BN_CTX *ctx); -int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *x, BIGNUM *y, - BN_RECP_CTX *recp,BN_CTX *ctx); -int BN_mod_exp_recp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx); -int BN_div_recp(BIGNUM *dv, BIGNUM *rem, BIGNUM *m, - BN_RECP_CTX *recp, BN_CTX *ctx); - - -#else - -BIGNUM *BN_value_one(); -char * BN_options(); -BN_CTX *BN_CTX_new(); -void BN_CTX_init(); -void BN_CTX_free(); -int BN_rand(); -int BN_num_bits(); -int BN_num_bits_word(); -BIGNUM *BN_new(); -void BN_init(); -void BN_clear_free(); -BIGNUM *BN_copy(); -BIGNUM *BN_bin2bn(); -int BN_bn2bin(); -BIGNUM *BN_mpi2bn(); -int BN_bn2mpi(); -int BN_sub(); -int BN_usub(); -int BN_uadd(); -int BN_add(); -int BN_mod(); -int BN_div(); -int BN_mul(); -int BN_sqr(); -BN_ULONG BN_mod_word(); -BN_ULONG BN_div_word(); -int BN_add_word(); -int BN_sub_word(); -int BN_mul_word(); -int BN_set_word(); -unsigned long BN_get_word(); -int BN_cmp(); -void BN_free(); -int BN_is_bit_set(); -int BN_lshift(); -int BN_lshift1(); -int BN_exp(); -int BN_mod_exp(); -int BN_mod_exp_mont(); -int BN_mod_exp_recp(); -int BN_mod_exp_simple(); -int BN_mask_bits(); -int BN_mod_mul_reciprocal(); -int BN_mod_mul(); -#ifndef WIN16 -int BN_print_fp(); -#endif -int BN_print(); -int BN_reciprocal(); -int BN_rshift(); -int BN_rshift1(); -void BN_clear(); -BIGNUM *bn_expand2(); -BIGNUM *BN_dup(); -int BN_ucmp(); -int BN_set_bit(); -int BN_clear_bit(); -char * BN_bn2hex(); -char * BN_bn2dec(); -int BN_hex2bn(); -int BN_dec2bn(); -int BN_gcd(); -BIGNUM *BN_mod_inverse(); -BIGNUM *BN_generate_prime(); -int BN_is_prime(); -void ERR_load_BN_strings(); - -BN_ULONG bn_mul_add_words(); -BN_ULONG bn_mul_words(); -void bn_sqr_words(); -BN_ULONG bn_div_words(); -BN_ULONG bn_add_words(); -BN_ULONG bn_sub_words(); - -int BN_mod_mul_montgomery(); -int BN_from_montgomery(); -BN_MONT_CTX *BN_MONT_CTX_new(); -void BN_MONT_CTX_init(); -void BN_MONT_CTX_free(); -int BN_MONT_CTX_set(); - -BN_BLINDING *BN_BLINDING_new(); -void BN_BLINDING_free(); -int BN_BLINDING_update(); -int BN_BLINDING_convert(); -int BN_BLINDING_invert(); - -void bn_mul_normal(); -void bn_mul_comba8(); -void bn_mul_comba4(); -void bn_sqr_normal(); -void bn_sqr_comba8(); -void bn_sqr_comba4(); -int bn_cmp_words(); -void bn_mul_recursive(); -void bn_mul_part_recursive(); -void bn_sqr_recursive(); -void bn_mul_low_normal(); - -void BN_RECP_CTX_init(); -BN_RECP_CTX *BN_RECP_CTX_new(); -void BN_RECP_CTX_free(); -int BN_RECP_CTX_set(); -int BN_mod_mul_reciprocal(); -int BN_mod_exp_recp(); -int BN_div_recp(); - -#endif - -/* BEGIN ERROR CODES */ -/* Error codes for the BN functions. */ - -/* Function codes. */ -#define BN_F_BN_BLINDING_CONVERT 100 -#define BN_F_BN_BLINDING_INVERT 101 -#define BN_F_BN_BLINDING_NEW 102 -#define BN_F_BN_BLINDING_UPDATE 103 -#define BN_F_BN_BL_CTX_INIT 104 -#define BN_F_BN_BL_CTX_NEW 105 -#define BN_F_BN_BN2DEC 106 -#define BN_F_BN_BN2HEX 107 -#define BN_F_BN_CTX_NEW 108 -#define BN_F_BN_DIV 109 -#define BN_F_BN_EXPAND2 110 -#define BN_F_BN_MOD_EXP_MONT 111 -#define BN_F_BN_MOD_INVERSE 112 -#define BN_F_BN_MOD_MUL_RECIPROCAL 113 -#define BN_F_BN_MPI2BN 114 -#define BN_F_BN_NEW 115 -#define BN_F_BN_RAND 116 -#define BN_F_BN_USUB 117 - -/* Reason codes. */ -#define BN_R_ARG2_LT_ARG3 100 -#define BN_R_BAD_RECIPROCAL 101 -#define BN_R_CALLED_WITH_EVEN_MODULUS 102 -#define BN_R_DIV_BY_ZERO 103 -#define BN_R_ENCODING_ERROR 104 -#define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 -#define BN_R_INVALID_LENGTH 106 -#define BN_R_NOT_INITALISED 107 -#define BN_R_NO_INVERSE 108 - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/crypto/date.h b/crypto/date.h deleted file mode 100644 index b4b9bd96dd..0000000000 --- a/crypto/date.h +++ /dev/null @@ -1 +0,0 @@ -#define DATE "Tue Dec 8 17:40:20 CET 1998" diff --git a/crypto/des/des.h b/crypto/des/des.h deleted file mode 100644 index 4d7610c8ed..0000000000 --- a/crypto/des/des.h +++ /dev/null @@ -1,303 +0,0 @@ -/* crypto/des/des.org */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * 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@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of 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. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * 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@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - * - * Always modify des.org since des.h is automatically generated from - * it during SSLeay configuration. - * - * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - */ - -#ifndef HEADER_DES_H -#define HEADER_DES_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a - * %20 speed up (longs are 8 bytes, int's are 4). */ -#ifndef DES_LONG -#define DES_LONG unsigned long -#endif - -typedef unsigned char des_cblock[8]; -typedef struct des_ks_struct - { - union { - des_cblock _; - /* make sure things are correct size on machines with - * 8 byte longs */ - DES_LONG pad[2]; - } ks; -#undef _ -#define _ ks._ - int weak_key; - } des_key_schedule[16]; - -#define DES_KEY_SZ (sizeof(des_cblock)) -#define DES_SCHEDULE_SZ (sizeof(des_key_schedule)) - -#define DES_ENCRYPT 1 -#define DES_DECRYPT 0 - -#define DES_CBC_MODE 0 -#define DES_PCBC_MODE 1 - -#define des_ecb2_encrypt(i,o,k1,k2,e) \ - des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) - -#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ - des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) - -#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ - des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) - -#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ - des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) - -#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 -#define random_key des_random_key -#define pcbc_encrypt des_pcbc_encrypt -#define set_key des_set_key -#define key_sched des_key_sched -#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 - -/* For compatibility with the MIT lib - eay 20/05/92 */ -typedef des_key_schedule bit_64; -#define des_fixup_key_parity des_set_odd_parity -#define des_check_key_parity check_parity - -extern int des_check_key; /* defaults to false */ -extern int des_rw_mode; /* defaults to DES_PCBC_MODE */ -extern int des_set_weak_key_flag; /* set the weak key flag */ - -/* The next line is used to disable full ANSI prototypes, if your - * compiler has problems with the prototypes, make sure this line always - * evaluates to true :-) */ -#if defined(MSDOS) || defined(__STDC__) -#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); -DES_LONG des_cbc_cksum(des_cblock *input,des_cblock *output, - long length,des_key_schedule schedule,des_cblock *ivec); -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_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, - long length,des_key_schedule schedule,des_cblock *ivec,int enc); -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); -void des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, - long length, des_key_schedule ks1, des_key_schedule ks2, - des_key_schedule ks3, des_cblock *ivec, int *num, int enc); -void des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, - long length, des_key_schedule ks1, des_key_schedule ks2, - des_key_schedule ks3, des_cblock *ivec, int *num); - -void des_xwhite_in2out(des_cblock (*des_key), des_cblock (*in_white), - des_cblock (*out_white)); - -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 -/* some stupid compilers complain because I have declared char instead - * of const char */ -#ifdef HEADER_DES_LOCL_H -char *crypt(const char *buf,const char *salt); -#else -char *crypt(); -#endif -#endif -void des_ofb_encrypt(unsigned char *in,unsigned char *out, - int numbits,long length,des_key_schedule schedule,des_cblock *ivec); -void des_pcbc_encrypt(des_cblock *input,des_cblock *output,long length, - des_key_schedule schedule,des_cblock *ivec,int enc); -DES_LONG des_quad_cksum(des_cblock *input,des_cblock *output, - long length,int out_count,des_cblock *seed); -void des_random_seed(des_cblock key); -void des_random_key(des_cblock ret); -int des_read_password(des_cblock *key,char *prompt,int verify); -int des_read_2passwords(des_cblock *key1,des_cblock *key2, - char *prompt,int verify); -int des_read_pw_string(char *buf,int length,char *prompt,int verify); -void des_set_odd_parity(des_cblock *key); -int des_is_weak_key(des_cblock *key); -int des_set_key(des_cblock *key,des_key_schedule schedule); -int des_key_sched(des_cblock *key,des_key_schedule schedule); -void des_string_to_key(char *str,des_cblock *key); -void des_string_to_2keys(char *str,des_cblock *key1,des_cblock *key2); -void des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, - des_key_schedule schedule, des_cblock *ivec, int *num, int enc); -void des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, - des_key_schedule schedule, des_cblock *ivec, int *num); -int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify); - -/* Extra functions from Mark Murray */ -void des_cblock_print_file(des_cblock *cb, FILE *fp); -/* 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. */ -int des_new_random_key(des_cblock *key); -void des_init_rando