Skip to content

Commit

Permalink
chacha20poly1305: correct AVX2 feature detection
Browse files Browse the repository at this point in the history
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: 70542b5
GitHub-Pull-Request: #44
Reviewed-on: https://go-review.googlesource.com/110796
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
  • Loading branch information
tmthrgd authored and tklauser committed May 2, 2018
1 parent 613d6ea commit 2c241ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion chacha20poly1305/chacha20poly1305_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2c241ca

Please sign in to comment.