]> WPIA git - cassiopeia.git/blobdiff - lib/openssl/crypto/cast/asm/cast-586.pl
upd: openssl to 1.1.0
[cassiopeia.git] / lib / openssl / crypto / cast / asm / cast-586.pl
index bf6810d335f25310b06e303623e7573c75c40ef9..6beb9c5f255071d4b0a70c7f8eabe1ca71c74991 100644 (file)
@@ -1,6 +1,16 @@
-#!/usr/local/bin/perl
-
-# define for pentium pro friendly version
+#! /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
+
+
+# This flag makes the inner loop one cycle longer, but generates 
+# code that runs %30 faster on the pentium pro/II, 44% faster
+# of PIII, while only %7 slower on the pentium.
+# By default, this flag is on.
 $ppro=1;
 
 $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
@@ -8,6 +18,9 @@ push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 require "cbc.pl";
 
+$output=pop;
+open STDOUT,">$output";
+
 &asm_init($ARGV[0],"cast-586.pl",$ARGV[$#ARGV] eq "386");
 
 $CAST_ROUNDS=16;
@@ -33,6 +46,8 @@ $S4="CAST_S_table3";
 
 &asm_finish();
 
+close STDOUT;
+
 sub CAST_encrypt {
     local($name,$enc)=@_;
 
@@ -140,11 +155,11 @@ sub E_CAST {
     &rotl(     $tmp4,          &LB($tmp1));
 
     if ($ppro) {
-       &mov(   $tmp2,          $tmp4);         # B
        &xor(   $tmp1,          $tmp1);
+       &mov(   $tmp2,          0xff);
        
        &movb(  &LB($tmp1),     &HB($tmp4));    # A
-       &and(   $tmp2,          0xff);
+       &and(   $tmp2,          $tmp4);
 
        &shr(   $tmp4,          16);            #
        &xor(   $tmp3,          $tmp3);