aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSamuel Neves <sneves@dei.uc.pt>2018-11-15 21:06:50 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2018-11-15 14:06:44 -0800
commitab873cd2f031e6a2e44407206cc611779257388a (patch)
treefc6103c955dc262adcbc0d13f6781f58a72bd704
parentversion: bump snapshot (diff)
downloadWireGuard-ab873cd2f031e6a2e44407206cc611779257388a.tar.xz
WireGuard-ab873cd2f031e6a2e44407206cc611779257388a.zip
chacha20,poly1305: fix up for win64
These don't help us, but it is important to keep this working for when it's re-added to cryptogams. Signed-off-by: Samuel Neves <sneves@dei.uc.pt>
-rw-r--r--src/crypto/zinc/chacha20/chacha20-x86_64.pl2
-rw-r--r--src/crypto/zinc/poly1305/poly1305-x86_64.pl54
2 files changed, 29 insertions, 27 deletions
diff --git a/src/crypto/zinc/chacha20/chacha20-x86_64.pl b/src/crypto/zinc/chacha20/chacha20-x86_64.pl
index 33058bb..031d27b 100644
--- a/src/crypto/zinc/chacha20/chacha20-x86_64.pl
+++ b/src/crypto/zinc/chacha20/chacha20-x86_64.pl
@@ -4045,7 +4045,7 @@ $code.=<<___ if ($avx);
.long 0xa0,0
___
$code.=<<___ if ($avx>1);
-.LSEH_info_chacha20_8x:
+.LSEH_info_chacha20_avx2:
.byte 9,0,0,0
.rva simd_handler
.rva .L8x_body,.L8x_epilogue # HandlerData[]
diff --git a/src/crypto/zinc/poly1305/poly1305-x86_64.pl b/src/crypto/zinc/poly1305/poly1305-x86_64.pl
index 8de1d1f..4456a1e 100644
--- a/src/crypto/zinc/poly1305/poly1305-x86_64.pl
+++ b/src/crypto/zinc/poly1305/poly1305-x86_64.pl
@@ -128,7 +128,7 @@ ___
if ($avx) {
$code.=<<___ if $kernel;
-.section .rodata # .cst192.Lconst, "aM", @progbits, 192
+.section .rodata
___
$code.=<<___;
.align 64
@@ -231,12 +231,12 @@ ___
$code.=<<___ if (!$kernel);
.extern OPENSSL_ia32cap_P
-.globl poly1305_init
-.hidden poly1305_init
-.globl poly1305_blocks
-.hidden poly1305_blocks
-.globl poly1305_emit
-.hidden poly1305_emit
+.globl poly1305_init_x86_64
+.hidden poly1305_init_x86_64
+.globl poly1305_blocks_x86_64
+.hidden poly1305_blocks_x86_64
+.globl poly1305_emit_x86_64
+.hidden poly1305_emit_x86_64
___
&declare_function("poly1305_init_x86_64", 32, 3);
$code.=<<___;
@@ -249,10 +249,10 @@ $code.=<<___;
je .Lno_key
___
$code.=<<___ if (!$kernel);
- lea poly1305_blocks(%rip),%r10
- lea poly1305_emit(%rip),%r11
+ lea poly1305_blocks_x86_64(%rip),%r10
+ lea poly1305_emit_x86_64(%rip),%r11
___
-$code.=<<___ if (!$kernel && $avx);
+$code.=<<___ if (!$kernel && $avx && 1);
mov OPENSSL_ia32cap_P+4(%rip),%r9
lea poly1305_blocks_avx(%rip),%rax
lea poly1305_emit_avx(%rip),%rcx
@@ -260,12 +260,12 @@ $code.=<<___ if (!$kernel && $avx);
cmovc %rax,%r10
cmovc %rcx,%r11
___
-$code.=<<___ if (!$kernel && $avx>1);
+$code.=<<___ if (!$kernel && $avx>1 && 1);
lea poly1305_blocks_avx2(%rip),%rax
bt \$`5+32`,%r9 # AVX2?
cmovc %rax,%r10
___
-$code.=<<___ if (!$kernel && $avx>3);
+$code.=<<___ if (!$kernel && $avx>3 && 0);
mov \$`(1<<31|1<<21|1<<16)`,%rax
shr \$32,%r9
and %rax,%r9
@@ -2187,6 +2187,7 @@ $code.=<<___ if ($win64);
vmovdqa -0x40(%r10),%xmm13
vmovdqa -0x30(%r10),%xmm14
vmovdqa -0x20(%r10),%xmm15
+ lea -8(%r10),%rsp
.Ldo_avx2_epilogue$suffix:
___
$code.=<<___ if (!$win64);
@@ -2778,6 +2779,7 @@ $code.=<<___ if ($win64);
movdqa -0x40(%r10),%xmm13
movdqa -0x30(%r10),%xmm14
movdqa -0x20(%r10),%xmm15
+ lea -8(%r10),%rsp
.Ldo_avx512_epilogue:
___
$code.=<<___ if (!$win64);
@@ -4110,17 +4112,17 @@ avx_handler:
.section .pdata
.align 4
- .rva .LSEH_begin_poly1305_init
- .rva .LSEH_end_poly1305_init
- .rva .LSEH_info_poly1305_init
+ .rva .LSEH_begin_poly1305_init_x86_64
+ .rva .LSEH_end_poly1305_init_x86_64
+ .rva .LSEH_info_poly1305_init_x86_64
- .rva .LSEH_begin_poly1305_blocks
- .rva .LSEH_end_poly1305_blocks
- .rva .LSEH_info_poly1305_blocks
+ .rva .LSEH_begin_poly1305_blocks_x86_64
+ .rva .LSEH_end_poly1305_blocks_x86_64
+ .rva .LSEH_info_poly1305_blocks_x86_64
- .rva .LSEH_begin_poly1305_emit
- .rva .LSEH_end_poly1305_emit
- .rva .LSEH_info_poly1305_emit
+ .rva .LSEH_begin_poly1305_emit_x86_64
+ .rva .LSEH_end_poly1305_emit_x86_64
+ .rva .LSEH_info_poly1305_emit_x86_64
___
$code.=<<___ if ($avx);
.rva .LSEH_begin_poly1305_blocks_avx
@@ -4160,20 +4162,20 @@ ___
$code.=<<___;
.section .xdata
.align 8
-.LSEH_info_poly1305_init:
+.LSEH_info_poly1305_init_x86_64:
.byte 9,0,0,0
.rva se_handler
- .rva .LSEH_begin_poly1305_init,.LSEH_begin_poly1305_init
+ .rva .LSEH_begin_poly1305_init_x86_64,.LSEH_begin_poly1305_init_x86_64
-.LSEH_info_poly1305_blocks:
+.LSEH_info_poly1305_blocks_x86_64:
.byte 9,0,0,0
.rva se_handler
.rva .Lblocks_body,.Lblocks_epilogue
-.LSEH_info_poly1305_emit:
+.LSEH_info_poly1305_emit_x86_64:
.byte 9,0,0,0
.rva se_handler
- .rva .LSEH_begin_poly1305_emit,.LSEH_begin_poly1305_emit
+ .rva .LSEH_begin_poly1305_emit_x86_64,.LSEH_begin_poly1305_emit_x86_64
___
$code.=<<___ if ($avx);
.LSEH_info_poly1305_blocks_avx_1: