diff --git a/sm2/sm2.go b/sm2/sm2.go index bbd13ff..ff31793 100644 --- a/sm2/sm2.go +++ b/sm2/sm2.go @@ -569,12 +569,9 @@ func Sign(rand io.Reader, priv *ecdsa.PrivateKey, hash []byte) (r, s *big.Int, e } 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