Use faster ChaCha20-Poly1305 implementation from golang.org/x/crypto

This implementation contains SSE* related assembler code.

Signed-off-by: Sergey Matveev <stargrave@stargrave.org>
This commit is contained in:
Sergey Matveev 2017-01-08 11:55:28 +03:00 committed by Jonathan Rudenberg
parent ab15322ad1
commit 6902797927

View File

@ -10,9 +10,9 @@ import (
"hash"
"io"
"github.com/devi/chap"
"github.com/minio/blake2b-simd"
"golang.org/x/crypto/blake2s"
"golang.org/x/crypto/chacha20poly1305"
"golang.org/x/crypto/curve25519"
)
@ -161,8 +161,12 @@ func cipherAESGCM(k [32]byte) Cipher {
var CipherChaChaPoly CipherFunc = cipherFn{cipherChaChaPoly, "ChaChaPoly"}
func cipherChaChaPoly(k [32]byte) Cipher {
c, err := chacha20poly1305.New(k[:])
if err != nil {
panic(err)
}
return aeadCipher{
chap.NewCipher(&k),
c,
func(n uint64) []byte {
var nonce [12]byte
binary.LittleEndian.PutUint64(nonce[4:], n)