Modify DSA and DH keys to use a shared FFC_PARAMS struct
[openssl.git] / crypto / arm64cpuid.pl
index caa33875c93739e9f9645f1350078bb231bfeb69..0fdaf3db678d5f5ac513cd3ac1545d4b84727d1e 100755 (executable)
@@ -1,21 +1,24 @@
 #! /usr/bin/env perl
-# Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2015-2018 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
 
 
-$flavour = shift;
-$output  = 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;
 
 $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 ( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
 ( $xlate="${dir}perlasm/arm-xlate.pl" and -f $xlate) or
 die "can't locate arm-xlate.pl";
 
-open OUT,"| \"$^X\" $xlate $flavour $output";
+open OUT,"| \"$^X\" $xlate $flavour \"$output\""
+    or die "can't call $xlate: $!";
 *STDOUT=*OUT;
 
 $code.=<<___;
@@ -63,6 +66,7 @@ _armv8_sha256_probe:
        sha256su0       v0.4s, v0.4s
        ret
 .size  _armv8_sha256_probe,.-_armv8_sha256_probe
+
 .globl _armv8_pmull_probe
 .type  _armv8_pmull_probe,%function
 _armv8_pmull_probe:
@@ -70,6 +74,13 @@ _armv8_pmull_probe:
        ret
 .size  _armv8_pmull_probe,.-_armv8_pmull_probe
 
+.globl _armv8_sha512_probe
+.type  _armv8_sha512_probe,%function
+_armv8_sha512_probe:
+       .long   0xcec08000      // sha512su0    v0.2d,v0.2d
+       ret
+.size  _armv8_sha512_probe,.-_armv8_sha512_probe
+
 .globl OPENSSL_cleanse
 .type  OPENSSL_cleanse,%function
 .align 5
@@ -107,6 +118,19 @@ OPENSSL_cleanse:
 CRYPTO_memcmp:
        eor     w3,w3,w3
        cbz     x2,.Lno_data    // len==0?
+       cmp     x2,#16
+       b.ne    .Loop_cmp
+       ldp     x8,x9,[x0]
+       ldp     x10,x11,[x1]
+       eor     x8,x8,x10
+       eor     x9,x9,x11
+       orr     x8,x8,x9
+       mov     x0,#1
+       cmp     x8,#0
+       csel    x0,xzr,x0,eq
+       ret
+
+.align 4
 .Loop_cmp:
        ldrb    w4,[x0],#1
        ldrb    w5,[x1],#1
@@ -123,4 +147,4 @@ CRYPTO_memcmp:
 ___
 
 print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT";