Skip to content

Commit

Permalink
avoid doing on_curve check twice,already done in blst
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Jan 20, 2021
1 parent 9323601 commit 643f7b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl G1Affine {
/// Attempts to deserialize an uncompressed element.
pub fn from_uncompressed(bytes: &[u8; 96]) -> Option<Self> {
G1Affine::from_uncompressed_unchecked(bytes).and_then(|el| {
if el.is_zero() || (el.is_torsion_free() && el.is_on_curve()) {
if el.is_zero() || el.is_torsion_free() {
Some(el)
} else {
None
Expand Down Expand Up @@ -248,7 +248,7 @@ impl G1Affine {
/// Attempts to deserialize a compressed element.
pub fn from_compressed(bytes: &[u8; 48]) -> Option<Self> {
G1Affine::from_compressed_unchecked(bytes).and_then(|el| {
if el.is_zero() || (el.is_torsion_free() && el.is_on_curve()) {
if el.is_zero() || el.is_torsion_free() {
Some(el)
} else {
None
Expand Down
4 changes: 2 additions & 2 deletions src/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl G2Affine {
/// Attempts to deserialize an uncompressed element.
pub fn from_uncompressed(bytes: &[u8; 192]) -> Option<Self> {
G2Affine::from_uncompressed_unchecked(bytes).and_then(|el| {
if el.is_zero() || (el.is_torsion_free() && el.is_on_curve()) {
if el.is_zero() || el.is_torsion_free() {
Some(el)
} else {
None
Expand Down Expand Up @@ -264,7 +264,7 @@ impl G2Affine {
/// Attempts to deserialize a compressed element.
pub fn from_compressed(bytes: &[u8; 96]) -> Option<Self> {
G2Affine::from_compressed_unchecked(bytes).and_then(|el| {
if el.is_zero() || (el.is_torsion_free() && el.is_on_curve()) {
if el.is_zero() || el.is_torsion_free() {
Some(el)
} else {
None
Expand Down

0 comments on commit 643f7b9

Please sign in to comment.