mirror of https://github.com/gtank/ristretto255
ristretto255: do not modify the receiver if Decode fails
This commit is contained in:
parent
971fdbf516
commit
675dee67e6
|
@ -250,7 +250,7 @@ func (e *Element) Decode(in []byte) error {
|
||||||
// x = CT_ABS(2 * s * den_x)
|
// x = CT_ABS(2 * s * den_x)
|
||||||
// y = u1 * den_y
|
// y = u1 * den_y
|
||||||
// t = x * y
|
// t = x * y
|
||||||
out := &e.r
|
var out edwards25519.ExtendedGroupElement
|
||||||
out.X.Mul(radix51.Two, s).Mul(&out.X, denX).Abs(&out.X)
|
out.X.Mul(radix51.Two, s).Mul(&out.X, denX).Abs(&out.X)
|
||||||
out.Y.Mul(u1, denY)
|
out.Y.Mul(u1, denY)
|
||||||
out.Z.One()
|
out.Z.One()
|
||||||
|
@ -262,6 +262,7 @@ func (e *Element) Decode(in []byte) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, return the internal representation in extended coordinates (x, y, 1, t).
|
// Otherwise, return the internal representation in extended coordinates (x, y, 1, t).
|
||||||
|
e.r.Set(&out)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue