Skip to content

Commit

Permalink
primeorder: improve initialization from uncompressed point (RustCrypt…
Browse files Browse the repository at this point in the history
  • Loading branch information
wangwillian0 authored May 17, 2023
1 parent f955566 commit 1ccab73
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions primeorder/src/affine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,11 @@ where
}
sec1::Coordinates::Uncompressed { x, y } => {
C::FieldElement::from_repr(*y).and_then(|y| {
Self::decompress(x, y.is_odd())
.and_then(|point| CtOption::new(point, point.y.ct_eq(&y)))
C::FieldElement::from_repr(*x).and_then(|x| {
let lhs = y * &y;
let rhs = x * &x * &x + &(C::EQUATION_A * &x) + &C::EQUATION_B;
CtOption::new(Self { x, y, infinity: 0 }, lhs.ct_eq(&rhs))
})
})
}
}
Expand Down

0 comments on commit 1ccab73

Please sign in to comment.