Commit 69027979 authored by Sergey Matveev's avatar Sergey Matveev Committed by Jonathan Rudenberg

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

This implementation contains SSE* related assembler code.
Signed-off-by: default avatarSergey Matveev <stargrave@stargrave.org>
parent ab15322a
......@@ -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)
......
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