brontide: refer directly to the curve object in btcec's global namespace

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.
This commit is contained in:
Olaoluwa Osuntokun 2017-02-28 17:42:49 -06:00
parent b4fff97d14
commit fdaeab7c9b
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
1 changed files with 1 additions and 1 deletions

View File

@ -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