diff --git a/brontide/noise.go b/brontide/noise.go index f80a1b3d..6d6d13af 100644 --- a/brontide/noise.go +++ b/brontide/noise.go @@ -9,9 +9,9 @@ import ( "io" "math" + "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/hkdf" - "github.com/aead/chacha20" "github.com/roasbeef/btcd/btcec" ) @@ -122,7 +122,10 @@ func (c *cipherState) Decrypt(associatedData, plainText, cipherText []byte) ([]b func (c *cipherState) InitializeKey(key [32]byte) { c.secretKey = key c.nonce = 0 - c.cipher = chacha20.NewChaCha20Poly1305(&c.secretKey) + + // Safe to ignore the error here as our key is properly sized + // (32-bytes). + c.cipher, _ = chacha20poly1305.New(c.secretKey[:]) } // InitializeKeyWithSalt is identical to InitializeKey however it also sets the diff --git a/glide.yaml b/glide.yaml index 7aa67de5..d1bb56aa 100644 --- a/glide.yaml +++ b/glide.yaml @@ -47,6 +47,7 @@ import: - nacl/secretbox - ripemd160 - scrypt + - chacha20poly1305 - package: golang.org/x/net subpackages: - context @@ -56,7 +57,6 @@ import: version: a527838cac5e47260fb61ed155b9b24a6d6a10cc - package: github.com/grpc-ecosystem/grpc-gateway version: ^1.1.0 -- package: github.com/aead/chacha20 - package: github.com/go-errors/errors - package: github.com/tv42/zbase32 - package: github.com/awalterschulze/gographviz