From ff91df91b63409636315bcec01c4357f9fadc4aa Mon Sep 17 00:00:00 2001 From: schou Date: Wed, 6 Jan 2021 10:56:47 -0500 Subject: [PATCH] pad and excess bytes here do essentially the same thing --- src/crypto/ecdsa/ecdsa_s390x.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/crypto/ecdsa/ecdsa_s390x.go b/src/crypto/ecdsa/ecdsa_s390x.go index 4a217fc5b86..43cc4cc6541 100644 --- a/src/crypto/ecdsa/ecdsa_s390x.go +++ b/src/crypto/ecdsa/ecdsa_s390x.go @@ -69,14 +69,11 @@ func hashToBytes(dst, hash []byte, c elliptic.Curve) { panic("crypto/ecdsa: dst too small to fit value") } - // pad with zeros - pad := lenDst - orderBits/8 - for i := 0; i <= pad; i++ { - dst[i] = 0 - } - // figure out the excess bytes between the hash size and order of the curve excess := lenDst - orderBytes + for i := 0; i < excess; i++ { + dst[i] = 0 + } // determine the shifts needed truncateBits := ((orderBits - 1) % 8) + 1