Commit 66063b2d authored by Mikio Hara's avatar Mikio Hara Committed by Brad Fitzpatrick

vendor: update golang.org/x/crypto/chacha20poly1305

Updates golang.org/x/crypto/chacha20poly1305 to rev cb497ae for:
- chacha20poly1305: fix detection of BMI on amd64 (https://golang.org/cl/34852)
- chacha20poly1305: fix typos (https://golang.org/cl/34536)
- chacha20poly1305: fix typos (https://golang.org/cl/33855)
- chacha20poly1305: fix build constraints (https://golang.org/cl/32391)

Change-Id: I3a608b5e21b3a72b5aaa5d0afe6c6cffbb1d6fc1
Reviewed-on: https://go-review.googlesource.com/34871Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 5ddfa69f
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build amd64,go1.7
// +build go1.7,amd64,!gccgo,!appengine
package chacha20poly1305
......
......@@ -4,7 +4,7 @@
// This file was originally from https://golang.org/cl/24717 by Vlad Krasnov of CloudFlare.
// +build go1.7
// +build go1.7,amd64,!gccgo,!appengine
#include "textflag.h"
// General register allocation
......@@ -280,9 +280,14 @@ TEXT ·chacha20Poly1305Open(SB), 0, $288-97
// Check for AVX2 support
CMPB runtime·support_avx2(SB), $0
JE noavx2bmi2Open
CMPB runtime·support_bmi2(SB), $1 // for MULXQ
JE chacha20Poly1305Open_AVX2
// Check BMI2 bit for MULXQ.
// runtime·cpuid_ebx7 is always available here
// because it passed avx2 check
TESTL $(1<<8), runtime·cpuid_ebx7(SB)
JNE chacha20Poly1305Open_AVX2
noavx2bmi2Open:
// Special optimization, for very short buffers
CMPQ inl, $128
JBE openSSE128 // About 16% faster
......@@ -1489,9 +1494,14 @@ TEXT ·chacha20Poly1305Seal(SB), 0, $288-96
// Check for AVX2 support
CMPB runtime·support_avx2(SB), $0
JE noavx2bmi2Seal
CMPB runtime·support_bmi2(SB), $1 // for MULXQ
JE chacha20Poly1305Seal_AVX2
// Check BMI2 bit for MULXQ.
// runtime·cpuid_ebx7 is always available here
// because it passed avx2 check
TESTL $(1<<8), runtime·cpuid_ebx7(SB)
JNE chacha20Poly1305Seal_AVX2
noavx2bmi2Seal:
// Special optimization, for very short buffers
CMPQ inl, $128
JBE sealSSE128 // About 15% faster
......@@ -1695,7 +1705,7 @@ sealSSETail64:
MOVO D1, ctr0Store
sealSSETail64LoopA:
// Perform ChaCha rounds, while hashing the prevsiosly encrpyted ciphertext
// Perform ChaCha rounds, while hashing the previously encrypted ciphertext
polyAdd(0(oup))
polyMul
LEAQ 16(oup), oup
......@@ -1729,7 +1739,7 @@ sealSSETail128:
MOVO A0, A1; MOVO B0, B1; MOVO C0, C1; MOVO D0, D1; PADDL ·sseIncMask<>(SB), D1; MOVO D1, ctr1Store
sealSSETail128LoopA:
// Perform ChaCha rounds, while hashing the prevsiosly encrpyted ciphertext
// Perform ChaCha rounds, while hashing the previously encrypted ciphertext
polyAdd(0(oup))
polyMul
LEAQ 16(oup), oup
......@@ -1775,7 +1785,7 @@ sealSSETail192:
MOVO A1, A2; MOVO B1, B2; MOVO C1, C2; MOVO D1, D2; PADDL ·sseIncMask<>(SB), D2; MOVO D2, ctr2Store
sealSSETail192LoopA:
// Perform ChaCha rounds, while hashing the prevsiosly encrpyted ciphertext
// Perform ChaCha rounds, while hashing the previously encrypted ciphertext
polyAdd(0(oup))
polyMul
LEAQ 16(oup), oup
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !amd64 !go1.7
// +build !amd64 !go1.7 gccgo appengine
package chacha20poly1305
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment