mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-28 05:06:18 +08:00
reduce parameter
This commit is contained in:
parent
0cd7f73183
commit
b45441f0ed
@ -606,12 +606,12 @@ func Sign(rand io.Reader, priv *ecdsa.PrivateKey, hash []byte) (r, s *big.Int, e
|
|||||||
S: cipher.NewCTR(block, []byte(aesIV)),
|
S: cipher.NewCTR(block, []byte(aesIV)),
|
||||||
}
|
}
|
||||||
|
|
||||||
// See [NSA] 3.4.1
|
return signGeneric(priv, &csprng, hash)
|
||||||
c := priv.PublicKey.Curve
|
|
||||||
return signGeneric(priv, &csprng, c, hash)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func signGeneric(priv *ecdsa.PrivateKey, csprng *cipher.StreamReader, c elliptic.Curve, hash []byte) (r, s *big.Int, err error) {
|
func signGeneric(priv *ecdsa.PrivateKey, csprng *cipher.StreamReader, hash []byte) (r, s *big.Int, err error) {
|
||||||
|
// See [NSA] 3.4.1
|
||||||
|
c := priv.PublicKey.Curve
|
||||||
N := c.Params().N
|
N := c.Params().N
|
||||||
if N.Sign() == 0 {
|
if N.Sign() == 0 {
|
||||||
return nil, nil, errZeroParam
|
return nil, nil, errZeroParam
|
||||||
|
Loading…
x
Reference in New Issue
Block a user