diff options
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/bf/asm/bf-586.pl | 2 | ||||
-rw-r--r-- | lib/libcrypto/bn/asm/bn-586.pl | 2 | ||||
-rw-r--r-- | lib/libcrypto/cast/asm/cast-586.pl | 2 | ||||
-rw-r--r-- | lib/libcrypto/cast/c_enc.c | 2 | ||||
-rw-r--r-- | lib/libcrypto/des/asm/des-586.pl | 12 | ||||
-rw-r--r-- | lib/libcrypto/des/des_enc.c | 2 | ||||
-rw-r--r-- | lib/libcrypto/perlasm/x86asm.pl | 8 | ||||
-rw-r--r-- | lib/libcrypto/perlasm/x86unix.pl | 35 |
8 files changed, 55 insertions, 10 deletions
diff --git a/lib/libcrypto/bf/asm/bf-586.pl b/lib/libcrypto/bf/asm/bf-586.pl index b556642c949..b5a4760d09c 100644 --- a/lib/libcrypto/bf/asm/bf-586.pl +++ b/lib/libcrypto/bf/asm/bf-586.pl @@ -18,7 +18,7 @@ $tmp4="edx"; &BF_encrypt("BF_encrypt",1); &BF_encrypt("BF_decrypt",0); -&cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1); +&cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1) unless $main'openbsd; &asm_finish(); sub BF_encrypt diff --git a/lib/libcrypto/bn/asm/bn-586.pl b/lib/libcrypto/bn/asm/bn-586.pl index 33f61259201..9a78f63be13 100644 --- a/lib/libcrypto/bn/asm/bn-586.pl +++ b/lib/libcrypto/bn/asm/bn-586.pl @@ -11,7 +11,7 @@ require "x86asm.pl"; &bn_div_words("bn_div_words"); &bn_add_words("bn_add_words"); &bn_sub_words("bn_sub_words"); -&bn_sub_part_words("bn_sub_part_words"); +&bn_sub_part_words("bn_sub_part_words") unless $main'openbsd; &asm_finish(); diff --git a/lib/libcrypto/cast/asm/cast-586.pl b/lib/libcrypto/cast/asm/cast-586.pl index 6be0bfe5724..0ed55d1905e 100644 --- a/lib/libcrypto/cast/asm/cast-586.pl +++ b/lib/libcrypto/cast/asm/cast-586.pl @@ -28,7 +28,7 @@ $S4="CAST_S_table3"; &CAST_encrypt("CAST_encrypt",1); &CAST_encrypt("CAST_decrypt",0); -&cbc("CAST_cbc_encrypt","CAST_encrypt","CAST_decrypt",1,4,5,3,-1,-1); +&cbc("CAST_cbc_encrypt","CAST_encrypt","CAST_decrypt",1,4,5,3,-1,-1) unless $main'openbsd; &asm_finish(); diff --git a/lib/libcrypto/cast/c_enc.c b/lib/libcrypto/cast/c_enc.c index 0fe2cffeccf..e80f65b6986 100644 --- a/lib/libcrypto/cast/c_enc.c +++ b/lib/libcrypto/cast/c_enc.c @@ -59,6 +59,7 @@ #include <openssl/cast.h> #include "cast_lcl.h" +#ifndef OPENBSD_CAST_ASM void CAST_encrypt(CAST_LONG *data, CAST_KEY *key) { register CAST_LONG l,r,*k,t; @@ -122,6 +123,7 @@ void CAST_decrypt(CAST_LONG *data, CAST_KEY *key) data[1]=l&0xffffffffL; data[0]=r&0xffffffffL; } +#endif void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, CAST_KEY *ks, unsigned char *iv, int enc) diff --git a/lib/libcrypto/des/asm/des-586.pl b/lib/libcrypto/des/asm/des-586.pl index b75d3c6b3a4..60d577cc8d5 100644 --- a/lib/libcrypto/des/asm/des-586.pl +++ b/lib/libcrypto/des/asm/des-586.pl @@ -22,10 +22,14 @@ $R="esi"; &external_label("DES_SPtrans"); &DES_encrypt("DES_encrypt1",1); &DES_encrypt("DES_encrypt2",0); -&DES_encrypt3("DES_encrypt3",1); -&DES_encrypt3("DES_decrypt3",0); -&cbc("DES_ncbc_encrypt","DES_encrypt1","DES_encrypt1",0,4,5,3,5,-1); -&cbc("DES_ede3_cbc_encrypt","DES_encrypt3","DES_decrypt3",0,6,7,3,4,5); + +if (!$main'openbsd) + { + &DES_encrypt3("DES_encrypt3",1); + &DES_encrypt3("DES_decrypt3",0); + &cbc("DES_ncbc_encrypt","DES_encrypt1","DES_encrypt1",0,4,5,3,5,-1); + &cbc("DES_ede3_cbc_encrypt","DES_encrypt3","DES_decrypt3",0,6,7,3,4,5); + } &asm_finish(); diff --git a/lib/libcrypto/des/des_enc.c b/lib/libcrypto/des/des_enc.c index 1c37ab96d3d..4f09804c44f 100644 --- a/lib/libcrypto/des/des_enc.c +++ b/lib/libcrypto/des/des_enc.c @@ -58,6 +58,7 @@ #include "des_locl.h" +#ifndef OPENBSD_DES_ASM void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) { register DES_LONG l,r,t,u; @@ -246,6 +247,7 @@ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) data[1]=ROTATE(r,3)&0xffffffffL; l=r=t=u=0; } +#endif void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3) diff --git a/lib/libcrypto/perlasm/x86asm.pl b/lib/libcrypto/perlasm/x86asm.pl index 1cb96e914ab..7c675e3ced3 100644 --- a/lib/libcrypto/perlasm/x86asm.pl +++ b/lib/libcrypto/perlasm/x86asm.pl @@ -18,9 +18,13 @@ sub main'asm_init ($type,$fn,$i386)=@_; $filename=$fn; - $elf=$cpp=$sol=$aout=$win32=$gaswin=0; + $elf=$cpp=$sol=$aout=$win32=$gaswin=$openbsd=0; if ( ($type eq "elf")) { $elf=1; require "x86unix.pl"; } + elsif ( ($type eq "openbsd-elf")) + { $openbsd=$elf=1; require "x86unix.pl"; } + elsif ( ($type eq "openbsd-a.out")) + { $openbsd=1; require "x86unix.pl"; } elsif ( ($type eq "a.out")) { $aout=1; require "x86unix.pl"; } elsif ( ($type eq "gaswin")) @@ -43,6 +47,8 @@ Pick one target type from cpp - format so x86unix.cpp can be used win32 - Windows 95/Windows NT win32n - Windows 95/Windows NT NASM format + openbsd-elf - OpenBSD elf + openbsd-a.out - OpenBSD a.out EOF exit(1); } diff --git a/lib/libcrypto/perlasm/x86unix.pl b/lib/libcrypto/perlasm/x86unix.pl index 10b669bf049..53ad5f49279 100644 --- a/lib/libcrypto/perlasm/x86unix.pl +++ b/lib/libcrypto/perlasm/x86unix.pl @@ -15,6 +15,12 @@ sub main'asm_get_output { return(@out); } sub main'get_labels { return(@labels); } sub main'external_label { push(@labels,@_); } +if ($main'openbsd) + { + $com_start='/*'; + $com_end='*/'; + } + if ($main'cpp) { $align="ALIGN"; @@ -276,6 +282,9 @@ sub main'file { local($file)=@_; + if ($main'openbsd) + { push(@out,"#include <machine/asm.h>\n"); return; } + local($tmp)=<<"EOF"; .file "$file.s" .version "01.01" @@ -291,6 +300,9 @@ sub main'function_begin &main'external_label($func); $func=$under.$func; + if ($main'openbsd) + { push (@out, "\nENTRY($func)\n"); goto skip; } + local($tmp)=<<"EOF"; .text .align $align @@ -303,6 +315,7 @@ EOF { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } else { $tmp=push(@out,"\t.type\t$func,\@function\n"); } push(@out,"$func:\n"); +skip: $tmp=<<"EOF"; pushl %ebp pushl %ebx @@ -321,6 +334,9 @@ sub main'function_begin_B &main'external_label($func); $func=$under.$func; + if ($main'openbsd) + { push(@out, "\nENTRY($func)\n"); goto skip; } + local($tmp)=<<"EOF"; .text .align $align @@ -333,6 +349,7 @@ EOF { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } else { push(@out,"\t.type $func,\@function\n"); } push(@out,"$func:\n"); +skip: $stack=4; } @@ -429,7 +446,8 @@ sub main'swtmp sub main'comment { - if ($main'elf) # GNU and SVR4 as'es use different comment delimiters, + if (!$main'openbsd && $main'elf) + # GNU and SVR4 as'es use different comment delimiters, { # so we just skip comments... push(@out,"\n"); return; @@ -460,7 +478,10 @@ sub main'set_label $label{$_[0]}=".${label}${_[0]}"; $label++; } - push(@out,".align $align\n") if ($_[1] != 0); + if ($main'openbsd) + { push(@out,"_ALIGN_TEXT\n") if ($_[1] != 0); } + else + { push(@out,".align $align\n") if ($_[1] != 0); } push(@out,"$label{$_[0]}:\n"); } @@ -569,6 +590,16 @@ sub main'picmeup ___ push(@out,$tmp); } + elsif ($main'openbsd) + { + push(@out, "#ifdef PIC\n"); + push(@out, "\tPIC_PROLOGUE\n"); + &main'mov($dst,"PIC_GOT($sym)"); + push(@out, "\tPIC_EPILOGUE\n"); + push(@out, "#else\n"); + &main'lea($dst,&main'DWP($sym)); + push(@out, "#endif\n"); + } elsif ($main'pic && ($main'elf || $main'aout)) { push(@out,"\t.align\t8\n"); |