From 89a7d03442f925a17e62f9e62a55b3765bf0e7c8 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 31 May 2024 18:24:38 +0200 Subject: [PATCH] Check complement point --- src/testing.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/testing.rs b/src/testing.rs index 756d588..367649e 100644 --- a/src/testing.rs +++ b/src/testing.rs @@ -100,6 +100,19 @@ where assert!(result.is_ok()); } +#[cfg(feature = "ring")] +pub fn check_complement_point() +where + BaseField: ark_ff::PrimeField, + CurveConfig: ark_ec::short_weierstrass::SWCurveConfig + Clone, + AffinePoint: ring::IntoSW>, +{ + use ring::IntoSW; + let pt = S::COMPLEMENT_POINT.into_sw(); + assert!(pt.is_on_curve()); + assert!(!pt.is_in_correct_subgroup_assuming_on_curve()); +} + #[macro_export] macro_rules! suite_tests { ($suite:ident, $build_ring:ident) => { @@ -127,6 +140,12 @@ macro_rules! ring_suite_tests { fn ring_prove_verify() { $crate::testing::ring_prove_verify::<$suite>() } + + #[cfg(feature = "ring")] + #[test] + fn check_complement_point() { + $crate::testing::check_complement_point::<$suite>() + } }; ($suite:ident, false) => {}; }