ristretto255: do not modify the receiver if Decode fails

This commit is contained in:
Filippo Valsorda 2019-04-19 17:11:44 -04:00
parent 971fdbf516
commit 675dee67e6
1 changed files with 2 additions and 1 deletions

View File

@ -250,7 +250,7 @@ func (e *Element) Decode(in []byte) error {
// x = CT_ABS(2 * s * den_x)
// y = u1 * den_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.Y.Mul(u1, denY)
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).
e.r.Set(&out)
return nil
}