diff --git a/libcrux-ml-kem/benches/ml-kem.rs b/libcrux-ml-kem/benches/ml-kem.rs index d3449a043..5eace9335 100644 --- a/libcrux-ml-kem/benches/ml-kem.rs +++ b/libcrux-ml-kem/benches/ml-kem.rs @@ -20,7 +20,7 @@ pub fn comparisons_key_generation(c: &mut Criterion) { }) }); - #[cfg(feature = "simd256")] + #[cfg(all(feature = "mlkem768", feature = "pre-verification", feature = "simd256"))] group.bench_function("libcrux avx2 unpacked (external random)", |b| { let mut seed = [0; 64]; rng.fill_bytes(&mut seed); @@ -29,7 +29,7 @@ pub fn comparisons_key_generation(c: &mut Criterion) { }) }); - #[cfg(feature = "simd128")] + #[cfg(all(feature = "mlkem768", feature = "pre-verification", feature = "simd128"))] group.bench_function("libcrux neon unpacked (external random)", |b| { let mut seed = [0; 64]; rng.fill_bytes(&mut seed); @@ -38,6 +38,7 @@ pub fn comparisons_key_generation(c: &mut Criterion) { }) }); + #[cfg(all(feature = "mlkem768", feature = "pre-verification"))] group.bench_function("libcrux portable unpacked (external random)", |b| { let mut seed = [0; 64]; rng.fill_bytes(&mut seed); @@ -87,6 +88,7 @@ pub fn comparisons_encapsulation(c: &mut Criterion) { ) }); + #[cfg(all(feature = "mlkem768", feature = "pre-verification"))] group.bench_function("libcrux unpacked portable (external random)", |b| { let mut seed1 = [0; 64]; OsRng.fill_bytes(&mut seed1); @@ -105,7 +107,7 @@ pub fn comparisons_encapsulation(c: &mut Criterion) { ) }); - #[cfg(feature = "simd128")] + #[cfg(all(feature = "mlkem768", feature = "pre-verification", feature = "simd128"))] group.bench_function("libcrux unpacked neon (external random)", |b| { let mut seed1 = [0; 64]; OsRng.fill_bytes(&mut seed1); @@ -124,7 +126,7 @@ pub fn comparisons_encapsulation(c: &mut Criterion) { ) }); - #[cfg(feature = "simd256")] + #[cfg(all(feature = "mlkem768", feature = "pre-verification", feature = "simd256"))] group.bench_function("libcrux unpacked avx2 (external random)", |b| { let mut seed1 = [0; 64]; OsRng.fill_bytes(&mut seed1); @@ -167,6 +169,7 @@ pub fn comparisons_decapsulation(c: &mut Criterion) { ) }); + #[cfg(all(feature = "mlkem768", feature = "pre-verification"))] group.bench_function("libcrux unpacked portable", |b| { let mut seed1 = [0; 64]; OsRng.fill_bytes(&mut seed1); @@ -190,7 +193,7 @@ pub fn comparisons_decapsulation(c: &mut Criterion) { ) }); - #[cfg(feature = "simd128")] + #[cfg(all(feature = "mlkem768", feature = "pre-verification", feature = "simd128"))] group.bench_function("libcrux unpacked neon", |b| { let mut seed1 = [0; 64]; OsRng.fill_bytes(&mut seed1); @@ -213,7 +216,7 @@ pub fn comparisons_decapsulation(c: &mut Criterion) { ) }); - #[cfg(feature = "simd256")] + #[cfg(all(feature = "mlkem768", feature = "pre-verification", feature = "simd256"))] group.bench_function("libcrux unpacked avx2", |b| { let mut seed1 = [0; 64]; OsRng.fill_bytes(&mut seed1); diff --git a/libcrux-ml-kem/tests/self.rs b/libcrux-ml-kem/tests/self.rs index 2e663270f..37d16d09a 100644 --- a/libcrux-ml-kem/tests/self.rs +++ b/libcrux-ml-kem/tests/self.rs @@ -209,6 +209,7 @@ macro_rules! impl_modified_ciphertext_and_implicit_rejection_value { }; } + #[cfg(feature = "mlkem512")] impl_consistency!( consistency_512, @@ -231,91 +232,94 @@ impl_consistency!( libcrux_ml_kem::mlkem1024::decapsulate ); +#[cfg(all(feature = "mlkem512", feature = "pre-verification"))] impl_consistency_unpacked!( consistency_unpacked_512_portable, - mlkem512::portable::generate_key_pair, - mlkem512::portable::encapsulate, - mlkem512::portable::generate_key_pair_unpacked, - mlkem512::portable::encapsulate_unpacked, - mlkem512::portable::decapsulate_unpacked + libcrux_ml_kem::mlkem512::portable::generate_key_pair, + libcrux_ml_kem::mlkem512::portable::encapsulate, + libcrux_ml_kem::mlkem512::portable::generate_key_pair_unpacked, + libcrux_ml_kem::mlkem512::portable::encapsulate_unpacked, + libcrux_ml_kem::mlkem512::portable::decapsulate_unpacked ); -#[cfg(all(feature = "mlkem512", feature = "simd128"))] +#[cfg(all(feature = "mlkem512", feature = "pre-verification", feature = "simd128"))] impl_consistency_unpacked!( consistency_unpacked_512_neon, - mlkem512::neon::generate_key_pair, - mlkem512::neon::encapsulate, - mlkem512::neon::generate_key_pair_unpacked, - mlkem512::neon::encapsulate_unpacked, - mlkem512::neon::decapsulate_unpacked + libcrux_ml_kem::mlkem512::neon::generate_key_pair, + libcrux_ml_kem::mlkem512::neon::encapsulate, + libcrux_ml_kem::mlkem512::neon::generate_key_pair_unpacked, + libcrux_ml_kem::mlkem512::neon::encapsulate_unpacked, + libcrux_ml_kem::mlkem512::neon::decapsulate_unpacked ); -#[cfg(all(feature = "mlkem512", feature = "simd256"))] +#[cfg(all(feature = "mlkem512", feature = "pre-verification", feature = "simd256"))] impl_consistency_unpacked!( consistency_unpacked_512_avx2, - mlkem512::avx2::generate_key_pair, - mlkem512::avx2::encapsulate, - mlkem512::avx2::generate_key_pair_unpacked, - mlkem512::avx2::encapsulate_unpacked, - mlkem512::avx2::decapsulate_unpacked + libcrux_ml_kem::mlkem512::avx2::generate_key_pair, + libcrux_ml_kem::mlkem512::avx2::encapsulate, + libcrux_ml_kem::mlkem512::avx2::generate_key_pair_unpacked, + libcrux_ml_kem::mlkem512::avx2::encapsulate_unpacked, + libcrux_ml_kem::mlkem512::avx2::decapsulate_unpacked ); +#[cfg(all(feature = "mlkem1024", feature = "pre-verification"))] impl_consistency_unpacked!( consistency_unpacked_1024_portable, - mlkem1024::portable::generate_key_pair, - mlkem1024::portable::encapsulate, - mlkem1024::portable::generate_key_pair_unpacked, - mlkem1024::portable::encapsulate_unpacked, - mlkem1024::portable::decapsulate_unpacked + libcrux_ml_kem::mlkem1024::portable::generate_key_pair, + libcrux_ml_kem::mlkem1024::portable::encapsulate, + libcrux_ml_kem::mlkem1024::portable::generate_key_pair_unpacked, + libcrux_ml_kem::mlkem1024::portable::encapsulate_unpacked, + libcrux_ml_kem::mlkem1024::portable::decapsulate_unpacked ); -#[cfg(all(feature = "mlkem1024", feature = "simd128"))] +#[cfg(all(feature = "mlkem1024", feature = "pre-verification", feature = "simd128"))] impl_consistency_unpacked!( consistency_unpacked_1024_neon, - mlkem1024::neon::generate_key_pair, - mlkem1024::neon::encapsulate, - mlkem1024::neon::generate_key_pair_unpacked, - mlkem1024::neon::encapsulate_unpacked, - mlkem1024::neon::decapsulate_unpacked + libcrux_ml_kem::mlkem1024::neon::generate_key_pair, + libcrux_ml_kem::mlkem1024::neon::encapsulate, + libcrux_ml_kem::mlkem1024::neon::generate_key_pair_unpacked, + libcrux_ml_kem::mlkem1024::neon::encapsulate_unpacked, + libcrux_ml_kem::mlkem1024::neon::decapsulate_unpacked ); -#[cfg(all(feature = "mlkem1024", feature = "simd256"))] +#[cfg(all(feature = "mlkem1024", feature = "pre-verification", feature = "simd256"))] impl_consistency_unpacked!( consistency_unpacked_1024_avx2, - mlkem1024::avx2::generate_key_pair, - mlkem1024::avx2::encapsulate, - mlkem1024::avx2::generate_key_pair_unpacked, - mlkem1024::avx2::encapsulate_unpacked, - mlkem1024::avx2::decapsulate_unpacked + libcrux_ml_kem::mlkem1024::avx2::generate_key_pair, + libcrux_ml_kem::mlkem1024::avx2::encapsulate, + libcrux_ml_kem::mlkem1024::avx2::generate_key_pair_unpacked, + libcrux_ml_kem::mlkem1024::avx2::encapsulate_unpacked, + libcrux_ml_kem::mlkem1024::avx2::decapsulate_unpacked ); +#[cfg(all(feature = "mlkem768", feature = "pre-verification"))] impl_consistency_unpacked!( consistency_unpacked_768_portable, - mlkem768::portable::generate_key_pair, - mlkem768::portable::encapsulate, - mlkem768::portable::generate_key_pair_unpacked, - mlkem768::portable::encapsulate_unpacked, - mlkem768::portable::decapsulate_unpacked + libcrux_ml_kem::mlkem768::portable::generate_key_pair, + libcrux_ml_kem::mlkem768::portable::encapsulate, + libcrux_ml_kem::mlkem768::portable::generate_key_pair_unpacked, + libcrux_ml_kem::mlkem768::portable::encapsulate_unpacked, + libcrux_ml_kem::mlkem768::portable::decapsulate_unpacked ); -#[cfg(all(feature = "mlkem768", feature = "simd128"))] +#[cfg(all(feature = "mlkem768", feature = "pre-verification", feature = "simd128"))] impl_consistency_unpacked!( consistency_unpacked_768_neon, - mlkem768::neon::generate_key_pair, - mlkem768::neon::encapsulate, - mlkem768::neon::generate_key_pair_unpacked, - mlkem768::neon::encapsulate_unpacked, - mlkem768::neon::decapsulate_unpacked + libcrux_ml_kem::mlkem768::neon::generate_key_pair, + libcrux_ml_kem::mlkem768::neon::encapsulate, + libcrux_ml_kem::mlkem768::neon::generate_key_pair_unpacked, + libcrux_ml_kem::mlkem768::neon::encapsulate_unpacked, + libcrux_ml_kem::mlkem768::neon::decapsulate_unpacked ); -#[cfg(all(feature = "mlkem768", feature = "simd256"))] +#[cfg(all(feature = "mlkem768", feature = "pre-verification", feature = "simd256"))] impl_consistency_unpacked!( consistency_unpacked_768_avx2, - mlkem768::avx2::generate_key_pair, - mlkem768::avx2::encapsulate, - mlkem768::avx2::generate_key_pair_unpacked, - mlkem768::avx2::encapsulate_unpacked, - mlkem768::avx2::decapsulate_unpacked + libcrux_ml_kem::mlkem768::avx2::generate_key_pair, + libcrux_ml_kem::mlkem768::avx2::encapsulate, + libcrux_ml_kem::mlkem768::avx2::generate_key_pair_unpacked, + libcrux_ml_kem::mlkem768::avx2::encapsulate_unpacked, + libcrux_ml_kem::mlkem768::avx2::decapsulate_unpacked ); #[cfg(feature = "mlkem512")]