Fix migration guide mappings for i2o/o2i_ECPublicKey
[openssl.git] / crypto / rc4 / asm / rc4-s390x.pl
index 5589503aa244531bdcbcb8ace904c3a7b4268b98..d5250f57f192d60df35585f8d780831d59346bbc 100644 (file)
@@ -1,14 +1,14 @@
 #! /usr/bin/env perl
-# Copyright 2009-2016 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2009-2020 The OpenSSL Project Authors. All Rights Reserved.
 #
-# Licensed under the OpenSSL license (the "License").  You may not use
+# 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
 
 #
 # ====================================================================
-# Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
+# Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
 # project. The module is, however, dual licensed under OpenSSL and
 # CRYPTOGAMS licenses depending on where you obtain it. For further
 # details see http://www.openssl.org/~appro/cryptogams/.
 # remains z/Architecture specific. On z990 it was measured to perform
 # 50% better than code generated by gcc 4.3.
 
-$flavour = shift;
+# $output is the last argument if it looks like a file (it has an extension)
+# $flavour is the first argument if it doesn't look like a file
+$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
+$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
 
 if ($flavour =~ /3[12]/) {
        $SIZE_T=4;
@@ -40,8 +43,7 @@ if ($flavour =~ /3[12]/) {
        $g="g";
 }
 
-while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {}
-open STDOUT,">$output";
+$output and open STDOUT,">$output";
 
 $rp="%r14";
 $sp="%r15";
@@ -184,7 +186,7 @@ $code.=<<___;
 RC4_set_key:
        stm${g} %r6,%r8,6*$SIZE_T($sp)
        lhi     $cnt,256
-       la      $idx,0(%r0)
+       la      $idx,0
        sth     $idx,0($key)
 .align 4
 .L1stloop:
@@ -194,8 +196,8 @@ RC4_set_key:
 
        lghi    $ikey,-256
        lr      $cnt,$len
-       la      $iinp,0(%r0)
-       la      $idx,0(%r0)
+       la      $iinp,0
+       la      $idx,0
 .align 16
 .L2ndloop:
        llgc    $acc,2+256($ikey,$key)
@@ -212,7 +214,7 @@ RC4_set_key:
        jz      .Ldone
        brct    $cnt,.L2ndloop
        lr      $cnt,$len
-       la      $iinp,0(%r0)
+       la      $iinp,0
        j       .L2ndloop
 .Ldone:
        lm${g}  %r6,%r8,6*$SIZE_T($sp)
@@ -238,4 +240,4 @@ RC4_options:
 ___
 
 print $code;
-close STDOUT;  # force flush
+close STDOUT or die "error closing STDOUT: $!";        # force flush