mirror of
https://github.com/logos-messaging/noise.git
synced 2026-01-02 14:13:07 +00:00
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:
parent
ab15322ad1
commit
6902797927
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user