bn/asm/*-mont.pl: harmonize with BN_from_montgomery_word.
[openssl.git] / crypto / bn / asm / mips-mont.pl
index a33cdf411121ff0a14aa3c1084a19956022e82ff..9b80e84140d786239d7258462a7f81c655aeab6a 100644 (file)
@@ -377,15 +377,13 @@ $code.=<<___;
        $PTR_SUB $rp,$num       # restore rp
        not     $hi1,$hi0
 
-       and     $ap,$hi0,$sp
-       and     $bp,$hi1,$rp
-       or      $ap,$ap,$bp     # ap=borrow?tp:rp
-
-.align 4
-.Lcopy:        $LD     $aj,($ap)
-       $PTR_ADD $ap,$BNSZ
+.Lcopy:        $LD     $nj,($tp)       # conditional move
+       $LD     $aj,($rp)
        $ST     $zero,($tp)
        $PTR_ADD $tp,$BNSZ
+       and     $nj,$hi0
+       and     $aj,$hi1
+       or      $aj,$nj
        sltu    $at,$tp,$tj
        $ST     $aj,($rp)
        bnez    $at,.Lcopy