mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-07-10 06:42:31 +00:00
[DEV-323] fix one off bug in sign rfc6979 (#133)
This commit is contained in:
parent
4f1b8c1248
commit
a45c01f9ab
@ -427,9 +427,7 @@ func signRFC6979(privateKey *PrivateKey, hash []byte) (*Signature, error) {
|
|||||||
k := nonceRFC6979(privkey.D, hash)
|
k := nonceRFC6979(privkey.D, hash)
|
||||||
inv := new(big.Int).ModInverse(k, N)
|
inv := new(big.Int).ModInverse(k, N)
|
||||||
r, _ := privkey.Curve.ScalarBaseMult(k.Bytes())
|
r, _ := privkey.Curve.ScalarBaseMult(k.Bytes())
|
||||||
if r.Cmp(N) == 1 {
|
r.Mod(r, N)
|
||||||
r.Sub(r, N)
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.Sign() == 0 {
|
if r.Sign() == 0 {
|
||||||
return nil, errors.New("calculated R is zero")
|
return nil, errors.New("calculated R is zero")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user