]> git.feebdaed.xyz Git - 0xmirror/go.git/commit
crypto/ecdsa: clean up ECDSA parsing and serialization paths
authorFilippo Valsorda <filippo@golang.org>
Mon, 24 Nov 2025 19:46:14 +0000 (20:46 +0100)
committerGopher Robot <gobot@golang.org>
Tue, 25 Nov 2025 18:29:31 +0000 (10:29 -0800)
commita5ebc6b67c1e397ab74abadf20a7f290cf28949e
treeab9ba834c93a213f2c255c7a2269de77f4482001
parente8fdfeb72b0468b645f256bcaf46570f866a54fd
crypto/ecdsa: clean up ECDSA parsing and serialization paths

Check for invalid encodings and keys more systematically in
ParseRawPrivateKey/PrivateKey.Bytes,
ParseUncompressedPublicKey/PublicKey.Bytes, and
fips140/ecdsa.NewPrivateKey/NewPublicKey.

Also, use these functions throughout the codebase.

This should not change any observable behavior, because there were
multiple layers of checks and every path would hit at least one.

Change-Id: I6a6a46566c95de871a5a37996835a0e51495f1d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/724000
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/crypto/ecdsa/ecdsa.go
src/crypto/ecdsa/ecdsa_test.go
src/crypto/internal/fips140/ecdsa/ecdsa.go
src/crypto/tls/tls.go
src/crypto/x509/parser.go
src/crypto/x509/sec1.go
src/crypto/x509/x509.go