From fdaeab7c9b33b43800f5e35d92dc8c41dc548c34 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 28 Feb 2017 17:42:49 -0600 Subject: [PATCH] brontide: refer directly to the curve object in btcec's global namespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit modifies the `ecdh` function within the `brontide` package to refer directly to the global curve params object in the `bcec` package rather than reference it from the target public key. This changes fixes a class of panics that have been uncovered recently but *doesn’t* yet fix the root cause. --- brontide/noise.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brontide/noise.go b/brontide/noise.go index ba34b4f2..0198608d 100644 --- a/brontide/noise.go +++ b/brontide/noise.go @@ -47,7 +47,7 @@ var ( // the sha256 of the compressed shared point. func ecdh(pub *btcec.PublicKey, priv *btcec.PrivateKey) []byte { s := &btcec.PublicKey{} - x, y := pub.Curve.ScalarMult(pub.X, pub.Y, priv.D.Bytes()) + x, y := btcec.S256().ScalarMult(pub.X, pub.Y, priv.D.Bytes()) s.X = x s.Y = y