From 8dc2499aa62f768c6395c9754b8cabc1ce25c494 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 11 Feb 2022 14:53:56 -0800 Subject: 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 --- libgo/go/crypto/ecdsa/ecdsa.go | 8 ++------ libgo/go/crypto/ecdsa/ecdsa_noasm.go | 1 - libgo/go/crypto/ecdsa/ecdsa_s390x_test.go | 3 +-- libgo/go/crypto/ecdsa/ecdsa_test.go | 6 +++--- 4 files changed, 6 insertions(+), 12 deletions(-) (limited to 'libgo/go/crypto/ecdsa') 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": -- cgit v1.1