]> WPIA git - cassiopeia.git/blobdiff - lib/openssl/crypto/md5/asm/md5-586.pl
upd: openssl to 1.1.0
[cassiopeia.git] / lib / openssl / crypto / md5 / asm / md5-586.pl
index 6cb66bb49991500f88bdfe0c79b81ffbd137d7ce..24f68af546acb7a21453daa1f463566bba0a1f78 100644 (file)
@@ -1,4 +1,11 @@
-#!/usr/local/bin/perl
+#! /usr/bin/env perl
+# Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the OpenSSL license (the "License").  You may not use
+# this file except in compliance with the License.  You can obtain a copy
+# in the file LICENSE in the source distribution or at
+# https://www.openssl.org/source/license.html
+
 
 # Normal is the
 # md5_block_x86(MD5_CTX *c, ULONG *X);
@@ -11,6 +18,9 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 
+$output=pop;
+open STDOUT,">$output";
+
 &asm_init($ARGV[0],$0);
 
 $A="eax";
@@ -33,6 +43,8 @@ $X="esi";
 &md5_block("md5_block_asm_data_order");
 &asm_finish();
 
+close STDOUT;
+
 sub Np
        {
        local($p)=@_;
@@ -56,14 +68,14 @@ sub R0
        &lea($a,&DWP($t,$a,$tmp2,1));
 
        &xor($tmp1,$d); # F function - part 4
+       &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if ($pos != 2);
 
        &add($a,$tmp1);
-       &mov($tmp1,&Np($c)) if $pos < 1;        # next tmp1 for R0
-       &mov($tmp1,&Np($c)) if $pos == 1;       # next tmp1 for R1
 
        &rotl($a,$s);
 
-       &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if ($pos != 2);
+       &mov($tmp1,&Np($c)) if $pos < 1;        # next tmp1 for R0
+       &mov($tmp1,&Np($c)) if $pos == 1;       # next tmp1 for R1
 
        &add($a,$b);
        }
@@ -74,13 +86,12 @@ sub R1
 
        &comment("R1 $ki");
 
-       &lea($a,&DWP($t,$a,$tmp2,1));
-
        &xor($tmp1,$b); # G function - part 2
        &and($tmp1,$d); # G function - part 3
+       &lea($a,&DWP($t,$a,$tmp2,1));
 
-       &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if ($pos != 2);
        &xor($tmp1,$c);                 # G function - part 4
+       &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if ($pos != 2);
 
        &add($a,$tmp1);
        &mov($tmp1,&Np($c)) if $pos < 1;        # G function - part 1
@@ -108,10 +119,10 @@ if (($n & 1) == 0)
        &lea($a,&DWP($t,$a,$tmp2,1));
 
        &add($a,$tmp1);
+       &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0));
 
        &rotl($a,$s);
 
-       &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0));
        &mov($tmp1,&Np($c));
        }
 else
@@ -120,11 +131,11 @@ else
        # make sure to do 'D' first, not 'B', else we clash with
        # the last add from the previous round.
 
-       &lea($a,&DWP($t,$a,$tmp2,1));
-
        &add($b,$c);                    # MOVED FORWARD
        &xor($tmp1,$d); # H function - part 2
 
+       &lea($a,&DWP($t,$a,$tmp2,1));
+
        &xor($tmp1,$b); # H function - part 3
        &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if ($pos != 2);