]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/internal/boring: remove unnecessary struct field
authorRoland Shoemaker <roland@golang.org>
Fri, 24 Jan 2025 20:27:08 +0000 (12:27 -0800)
committerGopher Robot <gobot@golang.org>
Sun, 16 Feb 2025 05:47:27 +0000 (21:47 -0800)
That could result in a hanging pointer.

Change-Id: I547950a3d3010e03b75f70f5f021f20124e2cef0
Reviewed-on: https://go-review.googlesource.com/c/go/+/644120
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/crypto/internal/boring/ecdh.go

index ff29eb17b1134482bc5bb4911bc4b737d888b506..4a887fdfd676647baf3952179b2395eb1b13b87d 100644 (file)
@@ -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