From 690279792740403a8121e99d37c8f28f2e6edeb3 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 8 Jan 2017 11:55:28 +0300 Subject: [PATCH] Use faster ChaCha20-Poly1305 implementation from golang.org/x/crypto This implementation contains SSE* related assembler code. Signed-off-by: Sergey Matveev --- cipher_suite.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cipher_suite.go b/cipher_suite.go index a1d9468..252a102 100644 --- a/cipher_suite.go +++ b/cipher_suite.go @@ -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)