Browse Source

Allow CS being none for into_edwards (#16)

* allow cs being none for into_edwards
master
Weikeng Chen 4 years ago
committed by GitHub
parent
commit
edc9a8ce02
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions
  1. +11
    -7
      src/groups/curves/twisted_edwards/mod.rs

+ 11
- 7
src/groups/curves/twisted_edwards/mod.rs

@ -135,14 +135,18 @@ mod montgomery_affine_impl {
u.mul_equals(&self.y, &self.x)?; 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 xplusone = &self.x + P::BaseField::one();
let xminusone = &self.x - P::BaseField::one(); let xminusone = &self.x - P::BaseField::one();

Loading…
Cancel
Save