]> WPIA git - cassiopeia.git/blobdiff - lib/openssl/crypto/whrlpool/asm/wp-mmx.pl
upd: openssl to 1.1.0
[cassiopeia.git] / lib / openssl / crypto / whrlpool / asm / wp-mmx.pl
index cb2381c22ba12aed4a9411bb181b7e16e30ec45d..f63945c8b90b9dc17cbf8ba8970d685bae8796e9 100644 (file)
@@ -1,4 +1,11 @@
-#!/usr/bin/env perl
+#! /usr/bin/env perl
+# Copyright 2005-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
+
 #
 # ====================================================================
 # Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
@@ -16,7 +23,7 @@
 # table]. I stick to value of 2 for two reasons: 1. smaller table
 # minimizes cache trashing and thus mitigates the hazard of side-
 # channel leakage similar to AES cache-timing one; 2. performance
-# gap among different �-archs is smaller.
+# gap among different �-archs is smaller.
 #
 # Performance table lists rounded amounts of CPU cycles spent by
 # whirlpool_block_mmx routine on single 64 byte input block, i.e.
@@ -49,6 +56,9 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 
+$output=pop;
+open STDOUT,">$output";
+
 &asm_init($ARGV[0],"wp-mmx.pl");
 
 sub L()  { &data_byte(@_); }
@@ -118,34 +128,36 @@ $tbl="ebp";
        &movq   (@mm[0],&QWP(2048*$SCALE,$tbl,"esi",8));        # rc[r]
        &mov    ("eax",&DWP(0,"esp"));
        &mov    ("ebx",&DWP(4,"esp"));
+       &movz   ("ecx",&LB("eax"));
+       &movz   ("edx",&HB("eax"));
 for($i=0;$i<8;$i++) {
     my $func = ($i==0)? \&movq : \&pxor;
-       &movb   (&LB("ecx"),&LB("eax"));
-       &movb   (&LB("edx"),&HB("eax"));
+       &shr    ("eax",16);
        &scale  ("esi","ecx");
+       &movz   ("ecx",&LB("eax"));
        &scale  ("edi","edx");
-       &shr    ("eax",16);
+       &movz   ("edx",&HB("eax"));
        &pxor   (@mm[0],&QWP(&row(0),$tbl,"esi",8));
        &$func  (@mm[1],&QWP(&row(1),$tbl,"edi",8));
-       &movb   (&LB("ecx"),&LB("eax"));
-       &movb   (&LB("edx"),&HB("eax"));
        &mov    ("eax",&DWP(($i+1)*8,"esp"));
        &scale  ("esi","ecx");
+       &movz   ("ecx",&LB("ebx"));
        &scale  ("edi","edx");
+       &movz   ("edx",&HB("ebx"));
        &$func  (@mm[2],&QWP(&row(2),$tbl,"esi",8));
        &$func  (@mm[3],&QWP(&row(3),$tbl,"edi",8));
-       &movb   (&LB("ecx"),&LB("ebx"));
-       &movb   (&LB("edx"),&HB("ebx"));
+       &shr    ("ebx",16);
        &scale  ("esi","ecx");
+       &movz   ("ecx",&LB("ebx"));
        &scale  ("edi","edx");
-       &shr    ("ebx",16);
+       &movz   ("edx",&HB("ebx"));
        &$func  (@mm[4],&QWP(&row(4),$tbl,"esi",8));
        &$func  (@mm[5],&QWP(&row(5),$tbl,"edi",8));
-       &movb   (&LB("ecx"),&LB("ebx"));
-       &movb   (&LB("edx"),&HB("ebx"));
        &mov    ("ebx",&DWP(($i+1)*8+4,"esp"));
        &scale  ("esi","ecx");
+       &movz   ("ecx",&LB("eax"));
        &scale  ("edi","edx");
+       &movz   ("edx",&HB("eax"));
        &$func  (@mm[6],&QWP(&row(6),$tbl,"esi",8));
        &$func  (@mm[7],&QWP(&row(7),$tbl,"edi",8));
     push(@mm,shift(@mm));
@@ -154,32 +166,32 @@ for($i=0;$i<8;$i++) {
        for($i=0;$i<8;$i++) { &movq(&QWP($i*8,"esp"),@mm[$i]); }    # K=L
 
 for($i=0;$i<8;$i++) {
-       &movb   (&LB("ecx"),&LB("eax"));
-       &movb   (&LB("edx"),&HB("eax"));
+       &shr    ("eax",16);
        &scale  ("esi","ecx");
+       &movz   ("ecx",&LB("eax"));
        &scale  ("edi","edx");
-       &shr    ("eax",16);
+       &movz   ("edx",&HB("eax"));
        &pxor   (@mm[0],&QWP(&row(0),$tbl,"esi",8));
        &pxor   (@mm[1],&QWP(&row(1),$tbl,"edi",8));
-       &movb   (&LB("ecx"),&LB("eax"));
-       &movb   (&LB("edx"),&HB("eax"));
        &mov    ("eax",&DWP(64+($i+1)*8,"esp"))         if ($i<7);
        &scale  ("esi","ecx");
+       &movz   ("ecx",&LB("ebx"));
        &scale  ("edi","edx");
+       &movz   ("edx",&HB("ebx"));
        &pxor   (@mm[2],&QWP(&row(2),$tbl,"esi",8));
        &pxor   (@mm[3],&QWP(&row(3),$tbl,"edi",8));
-       &movb   (&LB("ecx"),&LB("ebx"));
-       &movb   (&LB("edx"),&HB("ebx"));
+       &shr    ("ebx",16);
        &scale  ("esi","ecx");
+       &movz   ("ecx",&LB("ebx"));
        &scale  ("edi","edx");
-       &shr    ("ebx",16);
+       &movz   ("edx",&HB("ebx"));
        &pxor   (@mm[4],&QWP(&row(4),$tbl,"esi",8));
        &pxor   (@mm[5],&QWP(&row(5),$tbl,"edi",8));
-       &movb   (&LB("ecx"),&LB("ebx"));
-       &movb   (&LB("edx"),&HB("ebx"));
        &mov    ("ebx",&DWP(64+($i+1)*8+4,"esp"))       if ($i<7);
        &scale  ("esi","ecx");
+       &movz   ("ecx",&LB("eax"));
        &scale  ("edi","edx");
+       &movz   ("edx",&HB("eax"));
        &pxor   (@mm[6],&QWP(&row(6),$tbl,"esi",8));
        &pxor   (@mm[7],&QWP(&row(7),$tbl,"edi",8));
     push(@mm,shift(@mm));
@@ -491,3 +503,5 @@ for($i=0;$i<8;$i++) {
 
 &function_end_B("whirlpool_block_mmx");
 &asm_finish(); 
+
+close STDOUT;