Unified - adapt the generation of bignum assembler to use GENERATE
[openssl.git] / crypto / bn / asm / via-mont.pl
index ce3cd61eb39c1f80e6372c4ae49c2ce21c7418a9..8cf4dde4d5a1488cc120ea1c985ebdb0c0529f23 100644 (file)
@@ -81,6 +81,9 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 
+$output = pop;
+open STDOUT,">$output";
+
 &asm_init($ARGV[0],"via-mont.pl");
 
 # int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0, int num);
@@ -187,17 +190,12 @@ $sp=&DWP(28,"esp");
        &data_byte(0xf3,0x0f,0xa6,0xc0);# rep montmul
 
        &mov    ("ecx","ebp");
-       &xor    ("edx","edx");                  # i=0
        &lea    ("esi",&DWP(64,"esp"));         # tp
        # edi still points at the end of padded np copy...
-       &mov    ("eax",&DWP(-4-$pad,"edi"));    # np[num-1]
        &neg    ("ebp");
        &lea    ("ebp",&DWP(-$pad,"edi","ebp",4));      # so just "rewind"
        &mov    ("edi",$rp);                    # restore rp
-
-       &shr    ("eax",30);                     # boundary condition...
-       &jz     (&label("copy"));               # ... is met
-       &xor    ("edx","edx");                  # clear CF
+       &xor    ("edx","edx");                  # i=0 and clear CF
 
 &set_label("sub",8);
        &mov    ("eax",&DWP(0,"esi","edx",4));
@@ -245,3 +243,5 @@ $sp=&DWP(28,"esp");
 &asciz("Padlock Montgomery Multiplication, CRYPTOGAMS by <appro\@openssl.org>");
 
 &asm_finish();
+
+close STDOUT;