From 5e058459361ba98f6029be84bf6d83f58fa16bfa Mon Sep 17 00:00:00 2001 From: str4d Date: Wed, 3 Mar 2021 11:11:13 +1300 Subject: [PATCH] Remove unnecessary identity check from Group::random impl Co-authored-by: ebfull --- src/pasta/curves.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/pasta/curves.rs b/src/pasta/curves.rs index 2103134..2ebe77a 100644 --- a/src/pasta/curves.rs +++ b/src/pasta/curves.rs @@ -65,12 +65,6 @@ macro_rules! new_curve_impl { let x = $base::random(&mut rng); let ysign = (rng.next_u32() % 2) as u8; - if x.is_zero() && ysign == 0 { - // This would be the identity if encoded, and Group::random must - // sample from the non-identity elements of the group. - continue; - } - let x3 = x.square() * x; let y = (x3 + $name::curve_constant_b()).sqrt(); if let Some(y) = Option::<$base>::from(y) {