diff --git a/phase1/src/helpers/accumulator.rs b/phase1/src/helpers/accumulator.rs index 66a7d7bd..f9366014 100644 --- a/phase1/src/helpers/accumulator.rs +++ b/phase1/src/helpers/accumulator.rs @@ -100,10 +100,12 @@ cfg_if! { compression, CheckForCorrectness::OnlyNonZero, )?; + const SECURITY_PARAM: usize = 128; const BATCH_SIZE: usize = 1 << 12; let now = std::time::Instant::now(); - let all_in_prime_order_subgroup = match (elements.len() > BATCH_SIZE, subgroup_check_mode) { + let prime_order_subgroup_check_pass = match (elements.len() > BATCH_SIZE, subgroup_check_mode) { + (_, SubgroupCheckMode::No) => true, (true, SubgroupCheckMode::Auto) | (_, SubgroupCheckMode::Batched) => { match batch_verify_in_subgroup(elements, SECURITY_PARAM, &mut rand::thread_rng()) { Ok(()) => true, @@ -122,7 +124,7 @@ cfg_if! { } }; debug!("Subgroup verification for {} elems: {}us", end - start, now.elapsed().as_micros()); - if !all_in_prime_order_subgroup { + if !prime_order_subgroup_check_pass { return Err(Error::IncorrectSubgroup); } Ok(()) diff --git a/phase1/src/verification.rs b/phase1/src/verification.rs index a1ad23a9..54e627f4 100644 --- a/phase1/src/verification.rs +++ b/phase1/src/verification.rs @@ -381,6 +381,7 @@ impl<'a, E: PairingEngine + Sync> Phase1<'a, E> { .expect( "could not check element are non zero and in prime order subgroup (beta g1)", ); + if ratio_check { check_power_ratios::( (beta_g1, compressed_output, CheckForCorrectness::No), diff --git a/setup-utils/src/elements.rs b/setup-utils/src/elements.rs index 8c5c0fe9..ac49a51f 100644 --- a/setup-utils/src/elements.rs +++ b/setup-utils/src/elements.rs @@ -90,6 +90,7 @@ pub enum SubgroupCheckMode { Auto, Direct, Batched, + No, } impl fmt::Display for SubgroupCheckMode { @@ -98,6 +99,7 @@ impl fmt::Display for SubgroupCheckMode { SubgroupCheckMode::Auto => write!(f, "Auto"), SubgroupCheckMode::Direct => write!(f, "Direct"), SubgroupCheckMode::Batched => write!(f, "Batched"), + SubgroupCheckMode::No => write!(f, "No"), } } } @@ -135,7 +137,8 @@ pub fn check_subgroup( ) -> core::result::Result<(), Error> { const SECURITY_PARAM: usize = 128; const BATCH_SIZE: usize = 1 << 12; - let all_in_prime_order_subgroup = match (elements.len() > BATCH_SIZE, subgroup_check_mode) { + let prime_order_subgroup_check_pass = match (elements.len() > BATCH_SIZE, subgroup_check_mode) { + (_, SubgroupCheckMode::No) => true, (true, SubgroupCheckMode::Auto) | (_, SubgroupCheckMode::Batched) => { match batch_verify_in_subgroup(elements, SECURITY_PARAM, &mut rand::thread_rng()) { Ok(()) => true, @@ -147,7 +150,7 @@ pub fn check_subgroup( .is_zero() }), }; - if !all_in_prime_order_subgroup { + if !prime_order_subgroup_check_pass { return Err(Error::IncorrectSubgroup); }