EVP: Fix evp_keymgmt_util_copy() for to->keymgmt == NULL
[oweals/openssl.git] / crypto / des / asm / crypt586.pl
index 51fb3ddf26e4a00d34d97484209c95e30db506fe..e175b4f5515b294043ce4eca1bef97d60bf2baff 100644 (file)
@@ -1,15 +1,21 @@
-#!/usr/local/bin/perl
+#! /usr/bin/env perl
+# Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
 #
+# Licensed under the Apache License 2.0 (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
+
 # The inner loop instruction sequence and the IP/FP modifications are from
-# Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk>
-# I've added the stuff needed for crypt() but I've not worried about making
-# things perfect.
-#
+# Svend Olaf Mikkelsen
 
-push(@INC,"perlasm","../../perlasm");
+$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
+push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 
-&asm_init($ARGV[0],"crypt586.pl");
+$output=pop and open STDOUT,">$output";
+
+&asm_init($ARGV[0]);
 
 $L="edi";
 $R="esi";
@@ -18,11 +24,13 @@ $R="esi";
 &fcrypt_body("fcrypt_body");
 &asm_finish();
 
+close STDOUT or die "error closing STDOUT: $!";
+
 sub fcrypt_body
        {
        local($name,$do_ip)=@_;
 
-       &function_begin($name,"EXTRN   _DES_SPtrans:DWORD");
+       &function_begin($name);
 
        &comment("");
        &comment("Load the 2 words");
@@ -32,8 +40,9 @@ sub fcrypt_body
        &xor(   $R,     $R);
 
        # PIC-ification:-)
-       if ($cpp)       { &picmeup("edx","DES_SPtrans");   }
-       else            { &lea("edx",&DWP("DES_SPtrans")); }
+       &picmeup("edx","DES_SPtrans");
+       #if ($cpp)      { &picmeup("edx","DES_SPtrans");   }
+       #else           { &lea("edx",&DWP("DES_SPtrans")); }
        &push("edx");   # becomes &swtmp(1)
        #
        &mov($trans,&wparam(1)); # reloaded with DES_SPtrans in D_ENCRYPT
@@ -101,7 +110,7 @@ sub D_ENCRYPT
        &and(   $u,             "0xfcfcfcfc"    );              # 2
        &xor(   $tmp1,          $tmp1);                         # 1
        &and(   $t,             "0xcfcfcfcf"    );              # 2
-       &xor(   $tmp2,          $tmp2); 
+       &xor(   $tmp2,          $tmp2);
        &movb(  &LB($tmp1),     &LB($u) );
        &movb(  &LB($tmp2),     &HB($u) );
        &rotr(  $t,             4               );
@@ -165,7 +174,7 @@ sub IP_new
        &R_PERM_OP($l,$tt,$r,14,"0x33333333",$r);
        &R_PERM_OP($tt,$r,$l,22,"0x03fc03fc",$r);
        &R_PERM_OP($l,$r,$tt, 9,"0xaaaaaaaa",$r);
-       
+
        if ($lr != 3)
                {
                if (($lr-3) < 0)