Skip to content

Commit

Permalink
(fix) It is not generally safe to mutably multiply a bigint, though i…
Browse files Browse the repository at this point in the history
…t does work if the number you are multiplying by is big enough (probably because either the result vector is reallocated or you just don't happen to write to a storage location before you've finished reading it).
  • Loading branch information
rrw-zilliqa committed Oct 8, 2024
1 parent ca85f4f commit 8b7c128
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions schnorr/schnorr.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ func TrySign(privateKey []byte, publicKey []byte, message []byte, k []byte) ([]b

//4. Compute s = k - r * prv
// 4a. Compute r * prv
_r := *r
s := new(big.Int).Mod(_r.Mul(&_r, priKey), keytools.Secp256k1.N)
var v = new(big.Int).Mul(r, priKey)
s := new(big.Int).Mod(v, keytools.Secp256k1.N)
s = new(big.Int).Mod(new(big.Int).Sub(bintK, s), keytools.Secp256k1.N)

if s.Cmp(big.NewInt(0)) == 0 {
Expand Down

0 comments on commit 8b7c128

Please sign in to comment.