From: Roland Shoemaker Date: Fri, 24 Jan 2025 20:27:08 +0000 (-0800) Subject: crypto/internal/boring: remove unnecessary struct field X-Git-Tag: go1.25rc1~1006 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b38415d7e9abad2a8255c6b527ab7a033851c5f2;p=gostls13.git crypto/internal/boring: remove unnecessary struct field That could result in a hanging pointer. Change-Id: I547950a3d3010e03b75f70f5f021f20124e2cef0 Reviewed-on: https://go-review.googlesource.com/c/go/+/644120 Auto-Submit: Roland Shoemaker Reviewed-by: Filippo Valsorda LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov --- diff --git a/src/crypto/internal/boring/ecdh.go b/src/crypto/internal/boring/ecdh.go index ff29eb17b1..4a887fdfd6 100644 --- a/src/crypto/internal/boring/ecdh.go +++ b/src/crypto/internal/boring/ecdh.go @@ -17,7 +17,6 @@ import ( type PublicKeyECDH struct { curve string key *C.GO_EC_POINT - group *C.GO_EC_GROUP bytes []byte } @@ -59,7 +58,7 @@ func NewPublicKeyECDH(curve string, bytes []byte) (*PublicKeyECDH, error) { return nil, errors.New("point not on curve") } - k := &PublicKeyECDH{curve, key, group, append([]byte(nil), bytes...)} + k := &PublicKeyECDH{curve, key, append([]byte(nil), bytes...)} // Note: Because of the finalizer, any time k.key is passed to cgo, // that call must be followed by a call to runtime.KeepAlive(k), // to make sure k is not collected (and finalized) before the cgo @@ -122,7 +121,7 @@ func (k *PrivateKeyECDH) PublicKey() (*PublicKeyECDH, error) { C._goboringcrypto_EC_POINT_free(pt) return nil, err } - pub := &PublicKeyECDH{k.curve, pt, group, bytes} + pub := &PublicKeyECDH{k.curve, pt, bytes} // Note: Same as in NewPublicKeyECDH regarding finalizer and KeepAlive. runtime.SetFinalizer(pub, (*PublicKeyECDH).finalize) return pub, nil