Skip to content

Commit

Permalink
Allow CS being none for into_edwards (#16)
Browse files Browse the repository at this point in the history
* allow cs being none for into_edwards
  • Loading branch information
weikengchen authored Nov 16, 2020
1 parent 18824c0 commit edc9a8c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/groups/curves/twisted_edwards/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,18 @@ mod montgomery_affine_impl {

u.mul_equals(&self.y, &self.x)?;

let v = F::new_witness(ark_relations::ns!(cs, "v"), || {
let mut t0 = self.x.value()?;
let mut t1 = t0;
t0 -= &P::BaseField::one();
t1 += &P::BaseField::one();
let v = F::new_variable(
ark_relations::ns!(cs, "v"),
|| {
let mut t0 = self.x.value()?;
let mut t1 = t0;
t0 -= &P::BaseField::one();
t1 += &P::BaseField::one();

Ok(t0 * &t1.inverse().ok_or(SynthesisError::DivisionByZero)?)
})?;
Ok(t0 * &t1.inverse().ok_or(SynthesisError::DivisionByZero)?)
},
mode,
)?;

let xplusone = &self.x + P::BaseField::one();
let xminusone = &self.x - P::BaseField::one();
Expand Down

0 comments on commit edc9a8c

Please sign in to comment.