summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/sha/asm/sha256-586.pl
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/sha/asm/sha256-586.pl52
1 files changed, 25 insertions, 27 deletions
diff --git a/src/lib/libcrypto/sha/asm/sha256-586.pl b/src/lib/libcrypto/sha/asm/sha256-586.pl
index ecc8b69c75..928ec53123 100644
--- a/src/lib/libcrypto/sha/asm/sha256-586.pl
+++ b/src/lib/libcrypto/sha/asm/sha256-586.pl
@@ -14,8 +14,8 @@
14# Pentium PIII P4 AMD K8 Core2 14# Pentium PIII P4 AMD K8 Core2
15# gcc 46 36 41 27 26 15# gcc 46 36 41 27 26
16# icc 57 33 38 25 23 16# icc 57 33 38 25 23
17# x86 asm 40 30 35 20 20 17# x86 asm 40 30 33 20 18
18# x86_64 asm(*) - - 21 15.8 16.5 18# x86_64 asm(*) - - 21 16 16
19# 19#
20# (*) x86_64 assembler performance is presented for reference 20# (*) x86_64 assembler performance is presented for reference
21# purposes. 21# purposes.
@@ -48,20 +48,19 @@ sub BODY_00_15() {
48 my $in_16_63=shift; 48 my $in_16_63=shift;
49 49
50 &mov ("ecx",$E); 50 &mov ("ecx",$E);
51 &add ($T,&DWP(4*(8+15+16-9),"esp")) if ($in_16_63); # T += X[-7] 51 &add ($T,"edi") if ($in_16_63); # T += sigma1(X[-2])
52 &ror ("ecx",6); 52 &ror ("ecx",25-11);
53 &mov ("edi",$E);
54 &ror ("edi",11);
55 &mov ("esi",$Foff); 53 &mov ("esi",$Foff);
56 &xor ("ecx","edi"); 54 &xor ("ecx",$E);
57 &ror ("edi",25-11); 55 &ror ("ecx",11-6);
58 &mov (&DWP(4*(8+15),"esp"),$T) if ($in_16_63); # save X[0] 56 &mov (&DWP(4*(8+15),"esp"),$T) if ($in_16_63); # save X[0]
59 &xor ("ecx","edi"); # Sigma1(e) 57 &xor ("ecx",$E);
58 &ror ("ecx",6); # Sigma1(e)
60 &mov ("edi",$Goff); 59 &mov ("edi",$Goff);
61 &add ($T,"ecx"); # T += Sigma1(e) 60 &add ($T,"ecx"); # T += Sigma1(e)
62 &mov ($Eoff,$E); # modulo-scheduled
63 61
64 &xor ("esi","edi"); 62 &xor ("esi","edi");
63 &mov ($Eoff,$E); # modulo-scheduled
65 &mov ("ecx",$A); 64 &mov ("ecx",$A);
66 &and ("esi",$E); 65 &and ("esi",$E);
67 &mov ($E,$Doff); # e becomes d, which is e in next iteration 66 &mov ($E,$Doff); # e becomes d, which is e in next iteration
@@ -69,14 +68,14 @@ sub BODY_00_15() {
69 &mov ("edi",$A); 68 &mov ("edi",$A);
70 &add ($T,"esi"); # T += Ch(e,f,g) 69 &add ($T,"esi"); # T += Ch(e,f,g)
71 70
72 &ror ("ecx",2); 71 &ror ("ecx",22-13);
73 &add ($T,$Hoff); # T += h 72 &add ($T,$Hoff); # T += h
74 &ror ("edi",13); 73 &xor ("ecx",$A);
74 &ror ("ecx",13-2);
75 &mov ("esi",$Boff); 75 &mov ("esi",$Boff);
76 &xor ("ecx","edi"); 76 &xor ("ecx",$A);
77 &ror ("edi",22-13); 77 &ror ("ecx",2); # Sigma0(a)
78 &add ($E,$T); # d += T 78 &add ($E,$T); # d += T
79 &xor ("ecx","edi"); # Sigma0(a)
80 &mov ("edi",$Coff); 79 &mov ("edi",$Coff);
81 80
82 &add ($T,"ecx"); # T += Sigma0(a) 81 &add ($T,"ecx"); # T += Sigma0(a)
@@ -168,23 +167,22 @@ sub BODY_00_15() {
168&set_label("16_63",16); 167&set_label("16_63",16);
169 &mov ("esi",$T); 168 &mov ("esi",$T);
170 &mov ("ecx",&DWP(4*(8+15+16-14),"esp")); 169 &mov ("ecx",&DWP(4*(8+15+16-14),"esp"));
171 &shr ($T,3);
172 &ror ("esi",7);
173 &xor ($T,"esi");
174 &ror ("esi",18-7); 170 &ror ("esi",18-7);
175 &mov ("edi","ecx"); 171 &mov ("edi","ecx");
176 &xor ($T,"esi"); # T = sigma0(X[-15]) 172 &xor ("esi",$T);
173 &ror ("esi",7);
174 &shr ($T,3);
177 175
178 &shr ("ecx",10);
179 &mov ("esi",&DWP(4*(8+15+16),"esp"));
180 &ror ("edi",17);
181 &xor ("ecx","edi");
182 &ror ("edi",19-17); 176 &ror ("edi",19-17);
183 &add ($T,"esi"); # T += X[-16] 177 &xor ($T,"esi"); # T = sigma0(X[-15])
184 &xor ("edi","ecx") # sigma1(X[-2]) 178 &xor ("edi","ecx");
179 &ror ("edi",17);
180 &shr ("ecx",10);
181 &add ($T,&DWP(4*(8+15+16),"esp")); # T += X[-16]
182 &xor ("edi","ecx"); # sigma1(X[-2])
185 183
186 &add ($T,"edi"); # T += sigma1(X[-2]) 184 &add ($T,&DWP(4*(8+15+16-9),"esp")); # T += X[-7]
187 # &add ($T,&DWP(4*(8+15+16-9),"esp")); # T += X[-7], moved to BODY_00_15(1) 185 # &add ($T,"edi"); # T += sigma1(X[-2])
188 # &mov (&DWP(4*(8+15),"esp"),$T); # save X[0] 186 # &mov (&DWP(4*(8+15),"esp"),$T); # save X[0]
189 187
190 &BODY_00_15(1); 188 &BODY_00_15(1);