summaryrefslogtreecommitdiffstats
path: root/crypto/sha
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2007-09-14 21:06:14 +0000
committerAndy Polyakov <appro@openssl.org>2007-09-14 21:06:14 +0000
commit563d3e5948a17328819f90b2ab20477256ada1f4 (patch)
treeedf9dfa26ed81b62b25b0ebcd548932a142406e4 /crypto/sha
parent1187ee7dad8a3809192d24e6f1c69718767caa88 (diff)
Engage new x86 assembler modules.
Diffstat (limited to 'crypto/sha')
-rw-r--r--crypto/sha/Makefile18
-rw-r--r--crypto/sha/asm/sha512-586.pl14
2 files changed, 22 insertions, 10 deletions
diff --git a/crypto/sha/Makefile b/crypto/sha/Makefile
index 1231f1da38..e02d9f1dc3 100644
--- a/crypto/sha/Makefile
+++ b/crypto/sha/Makefile
@@ -45,18 +45,24 @@ lib: $(LIBOBJ)
# ELF
sx86-elf.s: asm/sha1-586.pl ../perlasm/x86asm.pl
(cd asm; $(PERL) sha1-586.pl elf $(CFLAGS) $(PROCESSOR) > ../$@)
-s512sse2-elf.s: asm/sha512-sse2.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) sha512-sse2.pl elf $(CFLAGS) $(PROCESSOR) > ../$@)
+sha256x86-elf.s: asm/sha256-586.pl ../perlasm/x86asm.pl
+ (cd asm; $(PERL) sha256-586.pl elf $(CFLAGS) $(PROCESSOR) > ../$@)
+sha512x86-elf.s: asm/sha512-586.pl ../perlasm/x86asm.pl
+ (cd asm; $(PERL) sha512-586.pl elf $(CFLAGS) $(PROCESSOR) > ../$@)
# COFF
sx86-cof.s: asm/sha1-586.pl ../perlasm/x86asm.pl
(cd asm; $(PERL) sha1-586.pl coff $(CFLAGS) $(PROCESSOR) > ../$@)
-s512sse2-cof.s: asm/sha512-sse2.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) sha512-sse2.pl coff $(CFLAGS) $(PROCESSOR) > ../$@)
+sha256x86-cof.s: asm/sha256-586.pl ../perlasm/x86asm.pl
+ (cd asm; $(PERL) sha256-586.pl coff $(CFLAGS) $(PROCESSOR) > ../$@)
+sha512x86-cof.s: asm/sha512-586.pl ../perlasm/x86asm.pl
+ (cd asm; $(PERL) sha512-586.pl coff $(CFLAGS) $(PROCESSOR) > ../$@)
# a.out
sx86-out.s: asm/sha1-586.pl ../perlasm/x86asm.pl
(cd asm; $(PERL) sha1-586.pl a.out $(CFLAGS) $(PROCESSOR) > ../$@)
-s512sse2-out.s: asm/sha512-sse2.pl ../perlasm/x86asm.pl
- (cd asm; $(PERL) sha512-sse2.pl a.out $(CFLAGS) $(PROCESSOR) > ../$@)
+sha256x86-out.s: asm/sha256-586.pl ../perlasm/x86asm.pl
+ (cd asm; $(PERL) sha256-586.pl a.out $(CFLAGS) $(PROCESSOR) > ../$@)
+sha512x86-out.s: asm/sha512-586.pl ../perlasm/x86asm.pl
+ (cd asm; $(PERL) sha512-586.pl a.out $(CFLAGS) $(PROCESSOR) > ../$@)
sha1-ia64.s: asm/sha1-ia64.pl
(cd asm; $(PERL) sha1-ia64.pl $(CFLAGS) ) > $@
diff --git a/crypto/sha/asm/sha512-586.pl b/crypto/sha/asm/sha512-586.pl
index 8f215ac247..49a9814544 100644
--- a/crypto/sha/asm/sha512-586.pl
+++ b/crypto/sha/asm/sha512-586.pl
@@ -38,6 +38,11 @@ require "x86asm.pl";
&asm_init($ARGV[0],"sha512-586.pl",$ARGV[$#ARGV] eq "386");
+$sse2=0;
+for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
+
+&external_label("OPENSSL_ia32cap_P") if ($sse2);
+
$Tlo=&DWP(0,"esp"); $Thi=&DWP(4,"esp");
$Alo=&DWP(8,"esp"); $Ahi=&DWP(8+4,"esp");
$Blo=&DWP(16,"esp"); $Bhi=&DWP(16+4,"esp");
@@ -70,7 +75,7 @@ sub BODY_00_15_sse2 {
&movq ("mm1",$E); # %mm1 is sliding right
&movq ("mm2",$E); # %mm2 is sliding left
&psrlq ("mm1",14);
- &movq ($Esse2,$E); # module-scheduled save e
+ &movq ($Esse2,$E); # modulo-scheduled save e
&psllq ("mm2",23);
&movq ("mm3","mm1"); # %mm3 is T1
&psrlq ("mm1",4);
@@ -109,7 +114,7 @@ sub BODY_00_15_sse2 {
&pxor ("mm7","mm6");
&psllq ("mm6",6);
&pxor ("mm7","mm5");
- &movq (&QWP(0,"esp"),$A); # module-scheduled save a
+ &movq (&QWP(0,"esp"),$A); # modulo-scheduled save a
&pxor ("mm7","mm6"); # T2=Sigma0_512(a)
&movq ("mm5",$A); # %mm5=a
@@ -274,7 +279,8 @@ sub BODY_00_15_x86 {
&mov (&DWP(8,"esp"),"eax"); # inp+num*128
&mov (&DWP(12,"esp"),"ebx"); # saved sp
- &picmeup("edx","OPENSSL_ia32cap_P",$K512,&label("pic_point"));
+if ($sse2) {
+ &picmeup("edx","OPENSSL_ia32cap_P",$K512,&label("K512"));
&bt (&DWP(0,"edx"),26);
&jnc (&label("loop_x86"));
@@ -403,7 +409,7 @@ sub BODY_00_15_x86 {
&emms ();
&mov ("esp",&DWP(8*10+12,"esp")); # restore sp
&function_end_A();
-
+}
&set_label("loop_x86",16);
# copy input block to stack reversing byte and qword order
for ($i=0;$i<8;$i++) {