Harmonize s390x assembler modules with "catch-all" rules from commit#19749.
[openssl.git] / crypto / aes / asm / aes-s390x.pl
index 4b27afd92fc479773abd64e875901cfcb506242c..1fd91ca1b8a80b17055f5c95935da29b8857fab8 100644 (file)
@@ -50,6 +50,9 @@
 # it was measured to be ~6.6x. It's less than previously mentioned 8x,
 # because software implementation was optimized.
 
+while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
+open STDOUT,">$output";
+
 $softonly=0;   # allow hardware support
 
 $t0="%r0";     $mask="%r0";
@@ -765,6 +768,11 @@ $code.=<<___ if (!$softonly);
        srl     %r5,6
        ar      %r5,%r0
 
+       larl    %r1,OPENSSL_s390xcap_P
+       lg      %r0,0(%r1)
+       tmhl    %r0,0x4000      # check for message-security assist
+       jz      .Lekey_internal
+
        lghi    %r0,0           # query capability vector
        la      %r1,16($sp)
        .long   0xb92f0042      # kmc %r4,%r2
@@ -1323,6 +1331,7 @@ $code.=<<___;
 4:     ex      $len,0($s1)
        j       .Lcbc_dec_exit
 .size  AES_cbc_encrypt,.-AES_cbc_encrypt
+.comm  OPENSSL_s390xcap_P,8,8
 ___
 }
 $code.=<<___;
@@ -1331,3 +1340,4 @@ ___
 
 $code =~ s/\`([^\`]*)\`/eval $1/gem;
 print $code;
+close STDOUT;  # force flush