diff options
author | markus <> | 2003-11-18 12:39:05 +0000 |
---|---|---|
committer | markus <> | 2003-11-18 12:39:05 +0000 |
commit | 3cf6590e9b2b978b44c38897634f84fbf167db4f (patch) | |
tree | 7f604b9764cd13753c7602979f5424b7dc97e04b /src/lib/libcrypto | |
parent | 56f777457f24d2899caf9b29a79285b5753e3e9b (diff) | |
download | openbsd-3cf6590e9b2b978b44c38897634f84fbf167db4f.tar.gz openbsd-3cf6590e9b2b978b44c38897634f84fbf167db4f.tar.bz2 openbsd-3cf6590e9b2b978b44c38897634f84fbf167db4f.zip |
use bn_asm_vax.S (from netbsd); test + ok by miod
use asm code for i386, except for the CBC code, because
it is not clean PIC code.
add <machime/asm.h> support to x86unix.pl
tested by: nick (on 30386), henning, djm, tedu, jmc and more;
no shlib minor crank necessary, only internal symbols changed.
Diffstat (limited to 'src/lib/libcrypto')
-rw-r--r-- | src/lib/libcrypto/bf/asm/bf-586.pl | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/bn/asm/bn-586.pl | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/cast/asm/cast-586.pl | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/cast/c_enc.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/des/asm/des-586.pl | 12 | ||||
-rw-r--r-- | src/lib/libcrypto/des/des_enc.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/perlasm/x86asm.pl | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/perlasm/x86unix.pl | 35 |
8 files changed, 55 insertions, 10 deletions
diff --git a/src/lib/libcrypto/bf/asm/bf-586.pl b/src/lib/libcrypto/bf/asm/bf-586.pl index b556642c94..b5a4760d09 100644 --- a/src/lib/libcrypto/bf/asm/bf-586.pl +++ b/src/lib/libcrypto/bf/asm/bf-586.pl | |||
@@ -18,7 +18,7 @@ $tmp4="edx"; | |||
18 | 18 | ||
19 | &BF_encrypt("BF_encrypt",1); | 19 | &BF_encrypt("BF_encrypt",1); |
20 | &BF_encrypt("BF_decrypt",0); | 20 | &BF_encrypt("BF_decrypt",0); |
21 | &cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1); | 21 | &cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1) unless $main'openbsd; |
22 | &asm_finish(); | 22 | &asm_finish(); |
23 | 23 | ||
24 | sub BF_encrypt | 24 | sub BF_encrypt |
diff --git a/src/lib/libcrypto/bn/asm/bn-586.pl b/src/lib/libcrypto/bn/asm/bn-586.pl index 33f6125920..9a78f63be1 100644 --- a/src/lib/libcrypto/bn/asm/bn-586.pl +++ b/src/lib/libcrypto/bn/asm/bn-586.pl | |||
@@ -11,7 +11,7 @@ require "x86asm.pl"; | |||
11 | &bn_div_words("bn_div_words"); | 11 | &bn_div_words("bn_div_words"); |
12 | &bn_add_words("bn_add_words"); | 12 | &bn_add_words("bn_add_words"); |
13 | &bn_sub_words("bn_sub_words"); | 13 | &bn_sub_words("bn_sub_words"); |
14 | &bn_sub_part_words("bn_sub_part_words"); | 14 | &bn_sub_part_words("bn_sub_part_words") unless $main'openbsd; |
15 | 15 | ||
16 | &asm_finish(); | 16 | &asm_finish(); |
17 | 17 | ||
diff --git a/src/lib/libcrypto/cast/asm/cast-586.pl b/src/lib/libcrypto/cast/asm/cast-586.pl index 6be0bfe572..0ed55d1905 100644 --- a/src/lib/libcrypto/cast/asm/cast-586.pl +++ b/src/lib/libcrypto/cast/asm/cast-586.pl | |||
@@ -28,7 +28,7 @@ $S4="CAST_S_table3"; | |||
28 | 28 | ||
29 | &CAST_encrypt("CAST_encrypt",1); | 29 | &CAST_encrypt("CAST_encrypt",1); |
30 | &CAST_encrypt("CAST_decrypt",0); | 30 | &CAST_encrypt("CAST_decrypt",0); |
31 | &cbc("CAST_cbc_encrypt","CAST_encrypt","CAST_decrypt",1,4,5,3,-1,-1); | 31 | &cbc("CAST_cbc_encrypt","CAST_encrypt","CAST_decrypt",1,4,5,3,-1,-1) unless $main'openbsd; |
32 | 32 | ||
33 | &asm_finish(); | 33 | &asm_finish(); |
34 | 34 | ||
diff --git a/src/lib/libcrypto/cast/c_enc.c b/src/lib/libcrypto/cast/c_enc.c index 0fe2cffecc..e80f65b698 100644 --- a/src/lib/libcrypto/cast/c_enc.c +++ b/src/lib/libcrypto/cast/c_enc.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <openssl/cast.h> | 59 | #include <openssl/cast.h> |
60 | #include "cast_lcl.h" | 60 | #include "cast_lcl.h" |
61 | 61 | ||
62 | #ifndef OPENBSD_CAST_ASM | ||
62 | void CAST_encrypt(CAST_LONG *data, CAST_KEY *key) | 63 | void CAST_encrypt(CAST_LONG *data, CAST_KEY *key) |
63 | { | 64 | { |
64 | register CAST_LONG l,r,*k,t; | 65 | register CAST_LONG l,r,*k,t; |
@@ -122,6 +123,7 @@ void CAST_decrypt(CAST_LONG *data, CAST_KEY *key) | |||
122 | data[1]=l&0xffffffffL; | 123 | data[1]=l&0xffffffffL; |
123 | data[0]=r&0xffffffffL; | 124 | data[0]=r&0xffffffffL; |
124 | } | 125 | } |
126 | #endif | ||
125 | 127 | ||
126 | void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, | 128 | void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, |
127 | CAST_KEY *ks, unsigned char *iv, int enc) | 129 | CAST_KEY *ks, unsigned char *iv, int enc) |
diff --git a/src/lib/libcrypto/des/asm/des-586.pl b/src/lib/libcrypto/des/asm/des-586.pl index b75d3c6b3a..60d577cc8d 100644 --- a/src/lib/libcrypto/des/asm/des-586.pl +++ b/src/lib/libcrypto/des/asm/des-586.pl | |||
@@ -22,10 +22,14 @@ $R="esi"; | |||
22 | &external_label("DES_SPtrans"); | 22 | &external_label("DES_SPtrans"); |
23 | &DES_encrypt("DES_encrypt1",1); | 23 | &DES_encrypt("DES_encrypt1",1); |
24 | &DES_encrypt("DES_encrypt2",0); | 24 | &DES_encrypt("DES_encrypt2",0); |
25 | &DES_encrypt3("DES_encrypt3",1); | 25 | |
26 | &DES_encrypt3("DES_decrypt3",0); | 26 | if (!$main'openbsd) |
27 | &cbc("DES_ncbc_encrypt","DES_encrypt1","DES_encrypt1",0,4,5,3,5,-1); | 27 | { |
28 | &cbc("DES_ede3_cbc_encrypt","DES_encrypt3","DES_decrypt3",0,6,7,3,4,5); | 28 | &DES_encrypt3("DES_encrypt3",1); |
29 | &DES_encrypt3("DES_decrypt3",0); | ||
30 | &cbc("DES_ncbc_encrypt","DES_encrypt1","DES_encrypt1",0,4,5,3,5,-1); | ||
31 | &cbc("DES_ede3_cbc_encrypt","DES_encrypt3","DES_decrypt3",0,6,7,3,4,5); | ||
32 | } | ||
29 | 33 | ||
30 | &asm_finish(); | 34 | &asm_finish(); |
31 | 35 | ||
diff --git a/src/lib/libcrypto/des/des_enc.c b/src/lib/libcrypto/des/des_enc.c index 1c37ab96d3..4f09804c44 100644 --- a/src/lib/libcrypto/des/des_enc.c +++ b/src/lib/libcrypto/des/des_enc.c | |||
@@ -58,6 +58,7 @@ | |||
58 | 58 | ||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | 60 | ||
61 | #ifndef OPENBSD_DES_ASM | ||
61 | void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) | 62 | void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) |
62 | { | 63 | { |
63 | register DES_LONG l,r,t,u; | 64 | register DES_LONG l,r,t,u; |
@@ -246,6 +247,7 @@ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) | |||
246 | data[1]=ROTATE(r,3)&0xffffffffL; | 247 | data[1]=ROTATE(r,3)&0xffffffffL; |
247 | l=r=t=u=0; | 248 | l=r=t=u=0; |
248 | } | 249 | } |
250 | #endif | ||
249 | 251 | ||
250 | void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, | 252 | void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, |
251 | DES_key_schedule *ks2, DES_key_schedule *ks3) | 253 | DES_key_schedule *ks2, DES_key_schedule *ks3) |
diff --git a/src/lib/libcrypto/perlasm/x86asm.pl b/src/lib/libcrypto/perlasm/x86asm.pl index 1cb96e914a..7c675e3ced 100644 --- a/src/lib/libcrypto/perlasm/x86asm.pl +++ b/src/lib/libcrypto/perlasm/x86asm.pl | |||
@@ -18,9 +18,13 @@ sub main'asm_init | |||
18 | ($type,$fn,$i386)=@_; | 18 | ($type,$fn,$i386)=@_; |
19 | $filename=$fn; | 19 | $filename=$fn; |
20 | 20 | ||
21 | $elf=$cpp=$sol=$aout=$win32=$gaswin=0; | 21 | $elf=$cpp=$sol=$aout=$win32=$gaswin=$openbsd=0; |
22 | if ( ($type eq "elf")) | 22 | if ( ($type eq "elf")) |
23 | { $elf=1; require "x86unix.pl"; } | 23 | { $elf=1; require "x86unix.pl"; } |
24 | elsif ( ($type eq "openbsd-elf")) | ||
25 | { $openbsd=$elf=1; require "x86unix.pl"; } | ||
26 | elsif ( ($type eq "openbsd-a.out")) | ||
27 | { $openbsd=1; require "x86unix.pl"; } | ||
24 | elsif ( ($type eq "a.out")) | 28 | elsif ( ($type eq "a.out")) |
25 | { $aout=1; require "x86unix.pl"; } | 29 | { $aout=1; require "x86unix.pl"; } |
26 | elsif ( ($type eq "gaswin")) | 30 | elsif ( ($type eq "gaswin")) |
@@ -43,6 +47,8 @@ Pick one target type from | |||
43 | cpp - format so x86unix.cpp can be used | 47 | cpp - format so x86unix.cpp can be used |
44 | win32 - Windows 95/Windows NT | 48 | win32 - Windows 95/Windows NT |
45 | win32n - Windows 95/Windows NT NASM format | 49 | win32n - Windows 95/Windows NT NASM format |
50 | openbsd-elf - OpenBSD elf | ||
51 | openbsd-a.out - OpenBSD a.out | ||
46 | EOF | 52 | EOF |
47 | exit(1); | 53 | exit(1); |
48 | } | 54 | } |
diff --git a/src/lib/libcrypto/perlasm/x86unix.pl b/src/lib/libcrypto/perlasm/x86unix.pl index 10b669bf04..53ad5f4927 100644 --- a/src/lib/libcrypto/perlasm/x86unix.pl +++ b/src/lib/libcrypto/perlasm/x86unix.pl | |||
@@ -15,6 +15,12 @@ sub main'asm_get_output { return(@out); } | |||
15 | sub main'get_labels { return(@labels); } | 15 | sub main'get_labels { return(@labels); } |
16 | sub main'external_label { push(@labels,@_); } | 16 | sub main'external_label { push(@labels,@_); } |
17 | 17 | ||
18 | if ($main'openbsd) | ||
19 | { | ||
20 | $com_start='/*'; | ||
21 | $com_end='*/'; | ||
22 | } | ||
23 | |||
18 | if ($main'cpp) | 24 | if ($main'cpp) |
19 | { | 25 | { |
20 | $align="ALIGN"; | 26 | $align="ALIGN"; |
@@ -276,6 +282,9 @@ sub main'file | |||
276 | { | 282 | { |
277 | local($file)=@_; | 283 | local($file)=@_; |
278 | 284 | ||
285 | if ($main'openbsd) | ||
286 | { push(@out,"#include <machine/asm.h>\n"); return; } | ||
287 | |||
279 | local($tmp)=<<"EOF"; | 288 | local($tmp)=<<"EOF"; |
280 | .file "$file.s" | 289 | .file "$file.s" |
281 | .version "01.01" | 290 | .version "01.01" |
@@ -291,6 +300,9 @@ sub main'function_begin | |||
291 | &main'external_label($func); | 300 | &main'external_label($func); |
292 | $func=$under.$func; | 301 | $func=$under.$func; |
293 | 302 | ||
303 | if ($main'openbsd) | ||
304 | { push (@out, "\nENTRY($func)\n"); goto skip; } | ||
305 | |||
294 | local($tmp)=<<"EOF"; | 306 | local($tmp)=<<"EOF"; |
295 | .text | 307 | .text |
296 | .align $align | 308 | .align $align |
@@ -303,6 +315,7 @@ EOF | |||
303 | { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } | 315 | { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } |
304 | else { $tmp=push(@out,"\t.type\t$func,\@function\n"); } | 316 | else { $tmp=push(@out,"\t.type\t$func,\@function\n"); } |
305 | push(@out,"$func:\n"); | 317 | push(@out,"$func:\n"); |
318 | skip: | ||
306 | $tmp=<<"EOF"; | 319 | $tmp=<<"EOF"; |
307 | pushl %ebp | 320 | pushl %ebp |
308 | pushl %ebx | 321 | pushl %ebx |
@@ -321,6 +334,9 @@ sub main'function_begin_B | |||
321 | &main'external_label($func); | 334 | &main'external_label($func); |
322 | $func=$under.$func; | 335 | $func=$under.$func; |
323 | 336 | ||
337 | if ($main'openbsd) | ||
338 | { push(@out, "\nENTRY($func)\n"); goto skip; } | ||
339 | |||
324 | local($tmp)=<<"EOF"; | 340 | local($tmp)=<<"EOF"; |
325 | .text | 341 | .text |
326 | .align $align | 342 | .align $align |
@@ -333,6 +349,7 @@ EOF | |||
333 | { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } | 349 | { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } |
334 | else { push(@out,"\t.type $func,\@function\n"); } | 350 | else { push(@out,"\t.type $func,\@function\n"); } |
335 | push(@out,"$func:\n"); | 351 | push(@out,"$func:\n"); |
352 | skip: | ||
336 | $stack=4; | 353 | $stack=4; |
337 | } | 354 | } |
338 | 355 | ||
@@ -429,7 +446,8 @@ sub main'swtmp | |||
429 | 446 | ||
430 | sub main'comment | 447 | sub main'comment |
431 | { | 448 | { |
432 | if ($main'elf) # GNU and SVR4 as'es use different comment delimiters, | 449 | if (!$main'openbsd && $main'elf) |
450 | # GNU and SVR4 as'es use different comment delimiters, | ||
433 | { # so we just skip comments... | 451 | { # so we just skip comments... |
434 | push(@out,"\n"); | 452 | push(@out,"\n"); |
435 | return; | 453 | return; |
@@ -460,7 +478,10 @@ sub main'set_label | |||
460 | $label{$_[0]}=".${label}${_[0]}"; | 478 | $label{$_[0]}=".${label}${_[0]}"; |
461 | $label++; | 479 | $label++; |
462 | } | 480 | } |
463 | push(@out,".align $align\n") if ($_[1] != 0); | 481 | if ($main'openbsd) |
482 | { push(@out,"_ALIGN_TEXT\n") if ($_[1] != 0); } | ||
483 | else | ||
484 | { push(@out,".align $align\n") if ($_[1] != 0); } | ||
464 | push(@out,"$label{$_[0]}:\n"); | 485 | push(@out,"$label{$_[0]}:\n"); |
465 | } | 486 | } |
466 | 487 | ||
@@ -569,6 +590,16 @@ sub main'picmeup | |||
569 | ___ | 590 | ___ |
570 | push(@out,$tmp); | 591 | push(@out,$tmp); |
571 | } | 592 | } |
593 | elsif ($main'openbsd) | ||
594 | { | ||
595 | push(@out, "#ifdef PIC\n"); | ||
596 | push(@out, "\tPIC_PROLOGUE\n"); | ||
597 | &main'mov($dst,"PIC_GOT($sym)"); | ||
598 | push(@out, "\tPIC_EPILOGUE\n"); | ||
599 | push(@out, "#else\n"); | ||
600 | &main'lea($dst,&main'DWP($sym)); | ||
601 | push(@out, "#endif\n"); | ||
602 | } | ||
572 | elsif ($main'pic && ($main'elf || $main'aout)) | 603 | elsif ($main'pic && ($main'elf || $main'aout)) |
573 | { | 604 | { |
574 | push(@out,"\t.align\t8\n"); | 605 | push(@out,"\t.align\t8\n"); |