x86_64 assembly pack: tolerate spaces in source directory name.
[openssl.git] / crypto / chacha / asm / chacha-x86_64.pl
index 1a87cf8495abc7f3dba2016897c640b8b2ff2dc4..4b1750cd5dea6dd41bd5896ad7e07856e9a94e9d 100755 (executable)
@@ -1,4 +1,11 @@
-#!/usr/bin/env perl
+#! /usr/bin/env perl
+# Copyright 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
+
 #
 # ====================================================================
 # Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
@@ -67,7 +74,7 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([
        $avx = ($2>=3.0) + ($2>3.0);
 }
 
-open OUT,"| \"$^X\" $xlate $flavour $output";
+open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\"";
 *STDOUT=*OUT;
 
 # input parameter block
@@ -219,6 +226,8 @@ $code.=<<___;
 .type  ChaCha20_ctr32,\@function,5
 .align 64
 ChaCha20_ctr32:
+       cmp     \$0,$len
+       je      .Lno_data
        mov     OPENSSL_ia32cap_P+4(%rip),%r10
        test    \$`1<<(41-32)`,%r10d
        jnz     .LChaCha20_ssse3
@@ -375,6 +384,7 @@ $code.=<<___;
        pop     %r12
        pop     %rbp
        pop     %rbx
+.Lno_data:
        ret
 .size  ChaCha20_ctr32,.-ChaCha20_ctr32
 ___
@@ -1541,13 +1551,13 @@ $code.=<<___;
        je              .Ldone4xop
 
        lea             0x40($inp),$inp         # inp+=64*3
-       vmovdqa         $xa2,0x00(%rsp)
+       vmovdqa         $xa3,0x00(%rsp)
        xor             %r10,%r10
-       vmovdqa         $xb2,0x10(%rsp)
+       vmovdqa         $xb3,0x10(%rsp)
        lea             0x40($out),$out         # out+=64*3
-       vmovdqa         $xc2,0x20(%rsp)
+       vmovdqa         $xc3,0x20(%rsp)
        sub             \$192,$len              # len-=64*3
-       vmovdqa         $xd2,0x30(%rsp)
+       vmovdqa         $xd3,0x30(%rsp)
 
 .Loop_tail4xop:
        movzb           ($inp,%r10),%eax