Skip to content

Commit

Permalink
rc4/asm/rc4-586.pl: allow for 386-only build.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Polyakov committed Feb 27, 2014
1 parent fd361a6 commit f861b1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crypto/rc4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ lib: $(LIBOBJ)
@touch lib

rc4-586.s: asm/rc4-586.pl ../perlasm/x86asm.pl
$(PERL) asm/rc4-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
$(PERL) asm/rc4-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@

rc4-x86_64.s: asm/rc4-x86_64.pl
$(PERL) asm/rc4-x86_64.pl $(PERLASM_SCHEME) > $@
Expand Down
8 changes: 6 additions & 2 deletions crypto/rc4/asm/rc4-586.pl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl";

&asm_init($ARGV[0],"rc4-586.pl");
&asm_init($ARGV[0],"rc4-586.pl",$x86only = $ARGV[$#ARGV] eq "386");

$xx="eax";
$yy="ebx";
Expand Down Expand Up @@ -187,8 +187,11 @@ sub RC4_loop {
&and ($ty,-4); # how many 4-byte chunks?
&jz (&label("loop1"));

&test ($ty,-8);
&mov (&wparam(3),$out); # $out as accumulator in these loops
if ($x86only) {
&jmp (&label("go4loop4"));
} else {
&test ($ty,-8);
&jz (&label("go4loop4"));

&picmeup($out,"OPENSSL_ia32cap_P");
Expand Down Expand Up @@ -231,6 +234,7 @@ sub RC4_loop {
&cmp ($inp,&wparam(1)); # compare to input+len
&je (&label("done"));
&jmp (&label("loop1"));
}

&set_label("go4loop4",16);
&lea ($ty,&DWP(-4,$inp,$ty));
Expand Down

0 comments on commit f861b1d

Please sign in to comment.