Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jotabulacios committed Feb 24, 2025
1 parent 36ac367 commit 66b4ef5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions math/src/elliptic_curve/edwards/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,11 @@ impl<E: IsEdwards> IsGroup for EdwardsProjectivePoint<E> {
let den_s2 = &one - &dx1x2y1y2;
// SAFETY: The creation of the result point is safe because the inputs are always points that belong to the curve.
// We are using that den_s1 and den_s2 aren't zero.
// See Theorem 3.3 from https://eprint.iacr.org/2007/286.pdf.
let point = Self::new([&num_s1 / &den_s1, &num_s2 / &den_s2, one]);
// See Theorem 3.3 from https://eprint.iacr.org/2007/286.pdf.
let x_coord = (&num_s1 / &den_s1).unwrap();
let y_coord = (&num_s2 / &den_s2).unwrap();
let point = Self::new([x_coord, y_coord, one]);
point.unwrap()

}

/// Returns the additive inverse of the projective point `p`
Expand Down
6 changes: 3 additions & 3 deletions math/src/elliptic_curve/short_weierstrass/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ where
}

if z == FieldElement::zero() {
let point = Self::new([x, y, z]);
let point = Self::new([x, y, z])
.map_err(|_| DeserializationError::FieldFromBytesError)?;
if point.is_neutral_element() {
Ok(point)
} else {
Expand All @@ -358,11 +359,10 @@ where
&(&y / &z).unwrap_unchecked()
}) == FieldElement::zero()
{
Ok(Self::new([x, y, z]))
Self::new([x, y, z]).map_err(|_| DeserializationError::FieldFromBytesError)
} else {
Err(DeserializationError::FieldFromBytesError)
}

}
PointFormat::Uncompressed => {
if bytes.len() % 2 != 0 {
Expand Down

0 comments on commit 66b4ef5

Please sign in to comment.