From 2e0e7e11b43bd488afe7833e070ab1812a1b831e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bossuat Date: Tue, 8 Jul 2025 13:54:20 +0200 Subject: [PATCH] Enforce extension factor to be a power of two --- core/src/blind_rotation/ccgi.rs | 1 - core/src/blind_rotation/lut.rs | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/blind_rotation/ccgi.rs b/core/src/blind_rotation/ccgi.rs index 62ec4ac..3e0dc33 100644 --- a/core/src/blind_rotation/ccgi.rs +++ b/core/src/blind_rotation/ccgi.rs @@ -82,7 +82,6 @@ pub fn cggi_blind_rotate( } } -// TODO: ENSURE DOMAIN EXTENSION AS pub(crate) fn cggi_blind_rotate_block_binary_extended( module: &Module, res: &mut GLWECiphertext, diff --git a/core/src/blind_rotation/lut.rs b/core/src/blind_rotation/lut.rs index a7fe003..96c1422 100644 --- a/core/src/blind_rotation/lut.rs +++ b/core/src/blind_rotation/lut.rs @@ -8,6 +8,14 @@ pub struct LookUpTable { impl LookUpTable { pub fn alloc(module: &Module, basek: usize, k: usize, extension_factor: usize) -> Self { + #[cfg(debug_assertions)] + { + assert!( + extension_factor & (extension_factor - 1) == 0, + "extension_factor must be a power of two but is: {}", + extension_factor + ); + } let size: usize = k.div_ceil(basek); let mut data: Vec>> = Vec::with_capacity(extension_factor); (0..extension_factor).for_each(|_| {