add get_active_parameter_set
Janmajaya Mall janmajayamall@protonmail.com
Tue, 23 Jul 2024 15:03:26 -0700
1 files changed,
10 insertions(+),
20 deletions(-)
jump to
M
src/bool/ni_mp_api.rs
→
src/bool/ni_mp_api.rs
@@ -1,4 +1,4 @@
-use std::{cell::RefCell, sync::OnceLock}; +use std::{borrow::Borrow, cell::RefCell, sync::OnceLock}; use crate::{ backend::ModulusPowerOf2,@@ -29,7 +29,7 @@ >;
thread_local! { static BOOL_EVALUATOR: RefCell<Option<BoolEvaluator>> = RefCell::new(None); - + static ACTIVE_PARAMETER_SET: RefCell<Option<ParameterSelector>> = RefCell::new(None); } static BOOL_SERVER_KEY: OnceLock<ShoupNonInteractiveServerKeyEvaluationDomain<Vec<Vec<u64>>>> = OnceLock::new();@@ -54,6 +54,14 @@ ParameterSelector::NonInteractiveLTE8Party => {
BOOL_EVALUATOR.with_borrow_mut(|v| *v = Some(BoolEvaluator::new(NI_8P))); } } + ACTIVE_PARAMETER_SET.with_borrow_mut(|v| *v = Some(select)); +} + +pub fn get_active_parameter_set() -> ParameterSelector { + ACTIVE_PARAMETER_SET + .borrow() + .take() + .expect("Parameters not set") } pub fn set_common_reference_seed(seed: [u8; 32]) {@@ -439,21 +447,3 @@ BatchedFheBools { data }
} } } - -#[cfg(test)] -mod tests { - use itertools::Itertools; - use rand::{thread_rng, RngCore}; - - use crate::{ - backend::Modulus, - bool::{ - keys::tests::{ideal_sk_rlwe, measure_noise_lwe}, - BooleanGates, - }, - utils::tests::Stats, - Encoder, Encryptor, KeySwitchWithId, MultiPartyDecryptor, - }; - - use super::*; -}