From 2613c1fa2f08814cd276800008b5a20c159ea7ff Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ulf=20M=C3=B6ller?= Date: Wed, 31 Mar 1999 12:38:27 +0000 Subject: [PATCH] New option to generate 80386 code. --- CHANGES | 4 ++++ Configure | 5 +++++ INSTALL | 9 ++++++++- Makefile.org | 8 ++++++-- crypto/bf/Makefile.ssl | 2 +- crypto/bf/asm/bf-586.pl | 2 +- crypto/cast/Makefile.ssl | 2 +- crypto/cast/asm/cast-586.pl | 3 ++- crypto/perlasm/x86asm.pl | 9 +-------- crypto/sha/Makefile.ssl | 2 +- crypto/sha/asm/sha1-586.pl | 2 +- 11 files changed, 31 insertions(+), 17 deletions(-) diff --git a/CHANGES b/CHANGES index 44c81913a0..b1fa3bbcec 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,10 @@ Changes between 0.9.2b and 0.9.3 + *) New config option to avoid instructions that are illegal on the 80386. + The default code is faster, but requires at least a 486. + [Ulf Möller] + *) Got rid of old SSL2_CLIENT_VERSION (inconsistently used) and SSL2_SERVER_VERSION (not used at all) macros, which are now the same as SSL2_VERSION anyway. diff --git a/Configure b/Configure index e4089268e2..50fe9627d2 100755 --- a/Configure +++ b/Configure @@ -272,6 +272,7 @@ my $rc5_enc="rc5_enc.o"; my $md5_obj=""; my $sha1_obj=""; my $rmd160_obj=""; +my $processor=""; if ($#ARGV < 0) { @@ -286,6 +287,8 @@ foreach (@ARGV) { if ($_ =~ /^no-asm$/) { $no_asm=1; } + elsif ($_ =~ /^386$/) + { $processor=386; } elsif ($_ =~ /^-/) { if ($_ =~ /^-[lL](.*)$/) @@ -389,6 +392,7 @@ while () s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/; s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/; s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/; + s/^PROCESSOR=.*/PROCESSOR= $processor/; print OUT $_."\n"; } close(IN); @@ -406,6 +410,7 @@ print "RC5_ENC =$rc5_obj\n"; print "MD5_OBJ_ASM =$md5_obj\n"; print "SHA1_OBJ_ASM =$sha1_obj\n"; print "RMD160_OBJ_ASM=$rmd160_obj\n"; +print "PROCESSOR =$processor\n"; my $des_ptr=0; my $des_risc1=0; diff --git a/INSTALL b/INSTALL index 722612ba44..50ae13e669 100644 --- a/INSTALL +++ b/INSTALL @@ -23,10 +23,17 @@ This will build and install OpenSSL in the default location, which is (for historical reasons) /usr/local/ssl. If you want to install it anywhere else, - do this after running `sh config': + do this after running `./config': $ perl util/ssldir.pl /new/install/path + There are several options to ./config to customize the build: + + -DRSAref Build with RSADSI's RSAREF toolkit. + no-asm Build with no assembler code. + 386 Use the 80386 instruction set only (the default x86 code is + more efficient, but requires at least a 486). + If anything goes wrong, follow the detailed instructions below. If your operating system is not (yet) supported by OpenSSL, see the section on porting to a new system. diff --git a/Makefile.org b/Makefile.org index 7c000f2567..3828a1eba2 100644 --- a/Makefile.org +++ b/Makefile.org @@ -60,6 +60,10 @@ BN_ASM= bn_asm.o #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 +# For x86 assembler: Set PROCESSOR to 386 if you want to support +# the 80386. +PROCESSOR= + # 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 @@ -163,14 +167,14 @@ all: Makefile.ssl @for i in $(DIRS) ;\ do \ (cd $$i && echo "making all in $$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 ) || exit 1; \ + $(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}' PROCESSOR='$(PROCESSOR)' all ) || exit 1; \ done; sub_all: @for i in $(DIRS) ;\ do \ (cd $$i && echo "making all in $$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 ) || exit 1; \ + $(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}' PROCESSOR='$(PROCESSOR)' all ) || exit 1; \ done; Makefile.ssl: Makefile.org diff --git a/crypto/bf/Makefile.ssl b/crypto/bf/Makefile.ssl index cc4e3586df..2f92edaafb 100644 --- a/crypto/bf/Makefile.ssl +++ b/crypto/bf/Makefile.ssl @@ -64,7 +64,7 @@ asm/bx86bsdi.o: asm/bx86unix.cpp $(CPP) -DBSDI asm/bx86unix.cpp | sed 's/ :/:/' | as -o asm/bx86bsdi.o asm/bx86unix.cpp: - (cd asm; perl bf-586.pl cpp >bx86unix.cpp) + (cd asm; perl bf-586.pl cpp $(PROCESSOR) >bx86unix.cpp) files: perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO diff --git a/crypto/bf/asm/bf-586.pl b/crypto/bf/asm/bf-586.pl index 252abb710d..b556642c94 100644 --- a/crypto/bf/asm/bf-586.pl +++ b/crypto/bf/asm/bf-586.pl @@ -4,7 +4,7 @@ push(@INC,"perlasm","../../perlasm"); require "x86asm.pl"; require "cbc.pl"; -&asm_init($ARGV[0],"bf-586.pl"); +&asm_init($ARGV[0],"bf-586.pl",$ARGV[$#ARGV] eq "386"); $BF_ROUNDS=16; $BF_OFF=($BF_ROUNDS+2)*4; diff --git a/crypto/cast/Makefile.ssl b/crypto/cast/Makefile.ssl index 72ae8dec8a..0834c09c13 100644 --- a/crypto/cast/Makefile.ssl +++ b/crypto/cast/Makefile.ssl @@ -67,7 +67,7 @@ asm/cx86bsdi.o: asm/cx86unix.cpp $(CPP) -DBSDI asm/cx86unix.cpp | sed 's/ :/:/' | as -o asm/cx86bsdi.o asm/cx86unix.cpp: asm/cast-586.pl - (cd asm; perl cast-586.pl cpp >cx86unix.cpp) + (cd asm; perl cast-586.pl cpp $(PROCESSOR) >cx86unix.cpp) files: perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO diff --git a/crypto/cast/asm/cast-586.pl b/crypto/cast/asm/cast-586.pl index eda14ad413..6be0bfe572 100644 --- a/crypto/cast/asm/cast-586.pl +++ b/crypto/cast/asm/cast-586.pl @@ -7,7 +7,7 @@ push(@INC,"perlasm","../../perlasm"); require "x86asm.pl"; require "cbc.pl"; -&asm_init($ARGV[0],"cast-586.pl"); +&asm_init($ARGV[0],"cast-586.pl",$ARGV[$#ARGV] eq "386"); $CAST_ROUNDS=16; $L="edi"; @@ -173,3 +173,4 @@ sub E_CAST { &xor( $L, $tmp1); # XXX } + diff --git a/crypto/perlasm/x86asm.pl b/crypto/perlasm/x86asm.pl index b35dd1bc53..c81910851a 100644 --- a/crypto/perlasm/x86asm.pl +++ b/crypto/perlasm/x86asm.pl @@ -15,14 +15,9 @@ sub main'asm_finish sub main'asm_init { - ($type,$fn)=@_; + ($type,$fn,$i386)=@_; $filename=$fn; - if ($ARGV[$#ARGV] eq "386") - { - $i386=1; - } - $cpp=$sol=$aout=$win32=0; if ( ($type eq "elf")) { require "x86unix.pl"; } @@ -37,8 +32,6 @@ sub main'asm_init else { print STDERR <<"EOF"; -Usage: $filename [386] - Pick one target type from elf - linux, FreeBSD etc a.out - old linux diff --git a/crypto/sha/Makefile.ssl b/crypto/sha/Makefile.ssl index 9214c583a8..190da3a6cf 100644 --- a/crypto/sha/Makefile.ssl +++ b/crypto/sha/Makefile.ssl @@ -61,7 +61,7 @@ asm/sx86bsdi.o: asm/sx86unix.cpp $(CPP) -DBSDI asm/sx86unix.cpp | sed 's/ :/:/' | as -o asm/sx86bsdi.o asm/sx86unix.cpp: - (cd asm; perl sha1-586.pl cpp >sx86unix.cpp) + (cd asm; perl sha1-586.pl cpp $(PROCESSOR) >sx86unix.cpp) files: perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO diff --git a/crypto/sha/asm/sha1-586.pl b/crypto/sha/asm/sha1-586.pl index 38bb27532d..04e42ab09f 100644 --- a/crypto/sha/asm/sha1-586.pl +++ b/crypto/sha/asm/sha1-586.pl @@ -5,7 +5,7 @@ $normal=0; push(@INC,"perlasm","../../perlasm"); require "x86asm.pl"; -&asm_init($ARGV[0],"sha1-586.pl"); +&asm_init($ARGV[0],"sha1-586.pl",$ARGV[$#ARGV] eq "386"); $A="eax"; $B="ebx"; -- 2.25.1