mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
crypto/secp256k1: fix bug in affineFromJacobian
This commit is contained in:
parent
c9cdf144d5
commit
a572d516b7
1 changed files with 4 additions and 0 deletions
|
|
@ -116,6 +116,10 @@ func (BitCurve *BitCurve) IsOnCurve(x, y *big.Int) bool {
|
||||||
// affineFromJacobian reverses the Jacobian transform. See the comment at the
|
// affineFromJacobian reverses the Jacobian transform. See the comment at the
|
||||||
// top of the file.
|
// top of the file.
|
||||||
func (BitCurve *BitCurve) affineFromJacobian(x, y, z *big.Int) (xOut, yOut *big.Int) {
|
func (BitCurve *BitCurve) affineFromJacobian(x, y, z *big.Int) (xOut, yOut *big.Int) {
|
||||||
|
if z.Sign() == 0 {
|
||||||
|
return new(big.Int), new(big.Int)
|
||||||
|
}
|
||||||
|
|
||||||
zinv := new(big.Int).ModInverse(z, BitCurve.P)
|
zinv := new(big.Int).ModInverse(z, BitCurve.P)
|
||||||
zinvsq := new(big.Int).Mul(zinv, zinv)
|
zinvsq := new(big.Int).Mul(zinv, zinv)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue