Jelajahi Sumber

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

Change-Id: I4719b8ff3211eb1c823099512e593e540d6f3be8
GitHub-Last-Rev: 70542b53cd09fcae26c3579cd84bcee39a4b8a57
GitHub-Pull-Request: golang/crypto#44
Reviewed-on: https://go-review.googlesource.com/110796
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Tom Thorogood 7 tahun lalu
induk
melakukan
2c241ca304
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      chacha20poly1305/chacha20poly1305_amd64.go

+ 1 - 1
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