From 70542b53cd09fcae26c3579cd84bcee39a4b8a57 Mon Sep 17 00:00:00 2001 From: Tom Thorogood Date: Wed, 2 May 2018 20:35:38 +0930 Subject: [PATCH] chacha20poly1305: correct AVX2 feature detection CL 110355 switched out the adhoc cpu feature detection for x/sys/cpu, in doing so the AVX2 check was broken. The assembly code uses MULX which is part of BMI2. Updates golang/go#24843 --- chacha20poly1305/chacha20poly1305_amd64.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chacha20poly1305/chacha20poly1305_amd64.go b/chacha20poly1305/chacha20poly1305_amd64.go index ff21390d32..07d18a32f7 100644 --- a/chacha20poly1305/chacha20poly1305_amd64.go +++ b/chacha20poly1305/chacha20poly1305_amd64.go @@ -20,7 +20,7 @@ func chacha20Poly1305Seal(dst []byte, key []uint32, src, ad []byte) var ( useASM = cpu.X86.HasSSSE3 - useAVX2 = cpu.X86.HasAVX2 + useAVX2 = cpu.X86.HasAVX2 && cpu.X86.HasBMI2 ) // setupState writes a ChaCha20 input matrix to state. See