diff options
author | Michael Munday <mike.munday@ibm.com> | 2019-10-16 21:49:09 +0100 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2019-10-16 21:57:24 +0000 |
commit | 943df4f629560f5c33474dd82e2b534ea5f8653f (patch) | |
tree | c9228e462770512741e1d59af046ae9dec69d21b /src/crypto/ecdsa/ecdsa.go | |
parent | b76e6f88251712a21071d4ea11573bd8cdfa21de (diff) | |
download | go-943df4f629560f5c33474dd82e2b534ea5f8653f.tar.gz go-943df4f629560f5c33474dd82e2b534ea5f8653f.zip |
crypto/ecdsa: remove s390x assembly
This a revert of CL 174437 and follow up fix CL 201317.
The s390x assembly in this package makes use of an instruction
(specifically KDSA) which is not supported by the current build
machine. Remove this assembly for now, we can revisit this
functionality once we have a newer build machine and can ensure
that this assembly is well tested.
Updates #34927.
Change-Id: I779286fa7d9530a254b53a515ee76b1218821f2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/201360
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/crypto/ecdsa/ecdsa.go')
-rw-r--r-- | src/crypto/ecdsa/ecdsa.go | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/crypto/ecdsa/ecdsa.go b/src/crypto/ecdsa/ecdsa.go index d1c7975aa9..65911e737a 100644 --- a/src/crypto/ecdsa/ecdsa.go +++ b/src/crypto/ecdsa/ecdsa.go @@ -199,21 +199,14 @@ func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err err // See [NSA] 3.4.1 c := priv.PublicKey.Curve - e := hashToInt(hash, c) - r, s, err = sign(priv, &csprng, c, e) - return -} - -func signGeneric(priv *PrivateKey, csprng *cipher.StreamReader, c elliptic.Curve, e *big.Int) (r, s *big.Int, err error) { N := c.Params().N if N.Sign() == 0 { return nil, nil, errZeroParam } - var k, kInv *big.Int for { for { - k, err = randFieldElement(c, *csprng) + k, err = randFieldElement(c, csprng) if err != nil { r = nil return @@ -231,6 +224,8 @@ func signGeneric(priv *PrivateKey, csprng *cipher.StreamReader, c elliptic.Curve break } } + + e := hashToInt(hash, c) s = new(big.Int).Mul(priv.D, r) s.Add(s, e) s.Mul(s, kInv) @@ -239,6 +234,7 @@ func signGeneric(priv *PrivateKey, csprng *cipher.StreamReader, c elliptic.Curve break } } + return } @@ -256,12 +252,8 @@ func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool { return false } e := hashToInt(hash, c) - return verify(pub, c, e, r, s) -} -func verifyGeneric(pub *PublicKey, c elliptic.Curve, e, r, s *big.Int) bool { var w *big.Int - N := c.Params().N if in, ok := c.(invertible); ok { w = in.Inverse(s) } else { |