Update copyright year
[oweals/openssl.git] / crypto / modes / asm / aesni-gcm-x86_64.pl
index 921f44eef042e21d4ad11d9ca2c9ffba38179bd0..959efedb0de71e43ec0bb5753d9ef746fff7adde 100644 (file)
@@ -1,5 +1,5 @@
 #! /usr/bin/env perl
-# Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2013-2020 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
@@ -35,6 +35,8 @@
 # Applications using the EVP interface will observe a few percent
 # worse performance.]
 #
+# Knights Landing processes 1 byte in 1.25 cycles (measured with EVP).
+#
 # [1] http://rt.openssl.org/Ticket/Display.html?id=2900&user=guest&pass=guest
 # [2] http://www.intel.com/content/dam/www/public/us/en/documents/software-support/enabling-high-performance-gcm.pdf
 
@@ -64,11 +66,11 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
        $avx = ($1>=10) + ($1>=11);
 }
 
-if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
+if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) {
        $avx = ($2>=3.0) + ($2>3.0);
 }
 
-open OUT,"| \"$^X\" $xlate $flavour $output";
+open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\"";
 *STDOUT=*OUT;
 
 if ($avx>1) {{{
@@ -88,6 +90,7 @@ $code=<<___;
 .type  _aesni_ctr32_ghash_6x,\@abi-omnipotent
 .align 32
 _aesni_ctr32_ghash_6x:
+.cfi_startproc
        vmovdqu         0x20($const),$T2        # borrow $T2, .Lone_msb
        sub             \$6,$len
        vpxor           $Z0,$Z0,$Z0             # $Z0   = 0
@@ -395,6 +398,7 @@ _aesni_ctr32_ghash_6x:
        vpxor           $Z0,$Xi,$Xi             # modulo-scheduled
 
        ret
+.cfi_endproc
 .size  _aesni_ctr32_ghash_6x,.-_aesni_ctr32_ghash_6x
 ___
 ######################################################################
@@ -407,17 +411,25 @@ $code.=<<___;
 .type  aesni_gcm_decrypt,\@function,6
 .align 32
 aesni_gcm_decrypt:
+.cfi_startproc
        xor     $ret,$ret
        cmp     \$0x60,$len                     # minimal accepted length
        jb      .Lgcm_dec_abort
 
        lea     (%rsp),%rax                     # save stack pointer
+.cfi_def_cfa_register  %rax
        push    %rbx
+.cfi_push      %rbx
        push    %rbp
+.cfi_push      %rbp
        push    %r12
+.cfi_push      %r12
        push    %r13
+.cfi_push      %r13
        push    %r14
+.cfi_push      %r14
        push    %r15
+.cfi_push      %r15
 ___
 $code.=<<___ if ($win64);
        lea     -0xa8(%rsp),%rsp
@@ -509,15 +521,23 @@ $code.=<<___ if ($win64);
 ___
 $code.=<<___;
        mov     -48(%rax),%r15
+.cfi_restore   %r15
        mov     -40(%rax),%r14
+.cfi_restore   %r14
        mov     -32(%rax),%r13
+.cfi_restore   %r13
        mov     -24(%rax),%r12
+.cfi_restore   %r12
        mov     -16(%rax),%rbp
+.cfi_restore   %rbp
        mov     -8(%rax),%rbx
+.cfi_restore   %rbx
        lea     (%rax),%rsp             # restore %rsp
+.cfi_def_cfa_register  %rsp
 .Lgcm_dec_abort:
        mov     $ret,%rax               # return value
        ret
+.cfi_endproc
 .size  aesni_gcm_decrypt,.-aesni_gcm_decrypt
 ___
 
@@ -525,6 +545,7 @@ $code.=<<___;
 .type  _aesni_ctr32_6x,\@abi-omnipotent
 .align 32
 _aesni_ctr32_6x:
+.cfi_startproc
        vmovdqu         0x00-0x80($key),$Z0     # borrow $Z0 for $rndkey
        vmovdqu         0x20($const),$T2        # borrow $T2, .Lone_msb
        lea             -1($rounds),%r13
@@ -611,23 +632,32 @@ _aesni_ctr32_6x:
        vpshufb         $Ii,$T1,$T1             # next counter value
        vpxor           $Z0,$inout5,$inout5
        jmp     .Loop_ctr32
+.cfi_endproc
 .size  _aesni_ctr32_6x,.-_aesni_ctr32_6x
 
 .globl aesni_gcm_encrypt
 .type  aesni_gcm_encrypt,\@function,6
 .align 32
 aesni_gcm_encrypt:
+.cfi_startproc
        xor     $ret,$ret
        cmp     \$0x60*3,$len                   # minimal accepted length
        jb      .Lgcm_enc_abort
 
        lea     (%rsp),%rax                     # save stack pointer
+.cfi_def_cfa_register  %rax
        push    %rbx
+.cfi_push      %rbx
        push    %rbp
+.cfi_push      %rbp
        push    %r12
+.cfi_push      %r12
        push    %r13
+.cfi_push      %r13
        push    %r14
+.cfi_push      %r14
        push    %r15
+.cfi_push      %r15
 ___
 $code.=<<___ if ($win64);
        lea     -0xa8(%rsp),%rsp
@@ -890,15 +920,23 @@ $code.=<<___ if ($win64);
 ___
 $code.=<<___;
        mov     -48(%rax),%r15
+.cfi_restore   %r15
        mov     -40(%rax),%r14
+.cfi_restore   %r14
        mov     -32(%rax),%r13
+.cfi_restore   %r13
        mov     -24(%rax),%r12
+.cfi_restore   %r12
        mov     -16(%rax),%rbp
+.cfi_restore   %rbp
        mov     -8(%rax),%rbx
+.cfi_restore   %rbx
        lea     (%rax),%rsp             # restore %rsp
+.cfi_def_cfa_register  %rsp
 .Lgcm_enc_abort:
        mov     $ret,%rax               # return value
        ret
+.cfi_endproc
 .size  aesni_gcm_encrypt,.-aesni_gcm_encrypt
 ___
 
@@ -1045,15 +1083,19 @@ $code=<<___;    # assembler is too old
 .globl aesni_gcm_encrypt
 .type  aesni_gcm_encrypt,\@abi-omnipotent
 aesni_gcm_encrypt:
+.cfi_startproc
        xor     %eax,%eax
        ret
+.cfi_endproc
 .size  aesni_gcm_encrypt,.-aesni_gcm_encrypt
 
 .globl aesni_gcm_decrypt
 .type  aesni_gcm_decrypt,\@abi-omnipotent
 aesni_gcm_decrypt:
+.cfi_startproc
        xor     %eax,%eax
        ret
+.cfi_endproc
 .size  aesni_gcm_decrypt,.-aesni_gcm_decrypt
 ___
 }}}
@@ -1062,4 +1104,4 @@ $code =~ s/\`([^\`]*)\`/eval($1)/gem;
 
 print $code;
 
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";