diff options
author | Ian Lance Taylor <iant@golang.org> | 2022-02-11 14:53:56 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2022-02-11 15:01:19 -0800 |
commit | 8dc2499aa62f768c6395c9754b8cabc1ce25c494 (patch) | |
tree | 43d7fd2bbfd7ad8c9625a718a5e8718889351994 /libgo/go/crypto/ecdsa | |
parent | 9a56779dbc4e2d9c15be8d31e36f2f59be7331a8 (diff) | |
download | gcc-8dc2499aa62f768c6395c9754b8cabc1ce25c494.zip gcc-8dc2499aa62f768c6395c9754b8cabc1ce25c494.tar.gz gcc-8dc2499aa62f768c6395c9754b8cabc1ce25c494.tar.bz2 |
libgo: update to Go1.18beta2
gotools/
* Makefile.am (go_cmd_cgo_files): Add ast_go118.go
(check-go-tool): Copy golang.org/x/tools directories.
* Makefile.in: Regenerate.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/384695
Diffstat (limited to 'libgo/go/crypto/ecdsa')
-rw-r--r-- | libgo/go/crypto/ecdsa/ecdsa.go | 8 | ||||
-rw-r--r-- | libgo/go/crypto/ecdsa/ecdsa_noasm.go | 1 | ||||
-rw-r--r-- | libgo/go/crypto/ecdsa/ecdsa_s390x_test.go | 3 | ||||
-rw-r--r-- | libgo/go/crypto/ecdsa/ecdsa_test.go | 6 |
4 files changed, 6 insertions, 12 deletions
diff --git a/libgo/go/crypto/ecdsa/ecdsa.go b/libgo/go/crypto/ecdsa/ecdsa.go index 2194369..282596d 100644 --- a/libgo/go/crypto/ecdsa/ecdsa.go +++ b/libgo/go/crypto/ecdsa/ecdsa.go @@ -200,12 +200,8 @@ var errZeroParam = errors.New("zero parameter") func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err error) { randutil.MaybeReadByte(rand) - // Get min(log2(q) / 2, 256) bits of entropy from rand. - entropylen := (priv.Curve.Params().BitSize + 7) / 16 - if entropylen > 32 { - entropylen = 32 - } - entropy := make([]byte, entropylen) + // Get 256 bits of entropy from rand. + entropy := make([]byte, 32) _, err = io.ReadFull(rand, entropy) if err != nil { return diff --git a/libgo/go/crypto/ecdsa/ecdsa_noasm.go b/libgo/go/crypto/ecdsa/ecdsa_noasm.go index 717e80d..d65a4e2 100644 --- a/libgo/go/crypto/ecdsa/ecdsa_noasm.go +++ b/libgo/go/crypto/ecdsa/ecdsa_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //-go:build !s390x -// -build !s390x package ecdsa diff --git a/libgo/go/crypto/ecdsa/ecdsa_s390x_test.go b/libgo/go/crypto/ecdsa/ecdsa_s390x_test.go index 6070afc..058dd86 100644 --- a/libgo/go/crypto/ecdsa/ecdsa_s390x_test.go +++ b/libgo/go/crypto/ecdsa/ecdsa_s390x_test.go @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build ignore -// +build ignore +//go:build ignore && s390x package ecdsa diff --git a/libgo/go/crypto/ecdsa/ecdsa_test.go b/libgo/go/crypto/ecdsa/ecdsa_test.go index 556818a..c8390b2 100644 --- a/libgo/go/crypto/ecdsa/ecdsa_test.go +++ b/libgo/go/crypto/ecdsa/ecdsa_test.go @@ -219,9 +219,9 @@ func TestVectors(t *testing.T) { if line[0] == '[' { line = line[1 : len(line)-1] - parts := strings.SplitN(line, ",", 2) + curve, hash, _ := strings.Cut(line, ",") - switch parts[0] { + switch curve { case "P-224": pub.Curve = elliptic.P224() case "P-256": @@ -234,7 +234,7 @@ func TestVectors(t *testing.T) { pub.Curve = nil } - switch parts[1] { + switch hash { case "SHA-1": h = sha1.New() case "SHA-224": |