mirror of
https://github.com/arnaucube/phantom-zone.git
synced 2026-01-09 15:41:30 +01:00
make build work with no features
This commit is contained in:
@@ -1642,7 +1642,7 @@ where
|
|||||||
// TODO: check whether parameters support `total_users`
|
// TODO: check whether parameters support `total_users`
|
||||||
let nttop = self.pbs_info().nttop_rlweq();
|
let nttop = self.pbs_info().nttop_rlweq();
|
||||||
let rlwe_modop = self.pbs_info().modop_rlweq();
|
let rlwe_modop = self.pbs_info().modop_rlweq();
|
||||||
let ring_size = self.pbs_info().rlwe_n();
|
// let ring_size = self.pbs_info().rlwe_n();
|
||||||
let rlwe_q = self.parameters().rlwe_q();
|
let rlwe_q = self.parameters().rlwe_q();
|
||||||
|
|
||||||
let sk_rlwe = client_key.sk_rlwe();
|
let sk_rlwe = client_key.sk_rlwe();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ pub use mp_api::*;
|
|||||||
use crate::RowEntity;
|
use crate::RowEntity;
|
||||||
|
|
||||||
pub type ClientKey = keys::ClientKey<[u8; 32], u64>;
|
pub type ClientKey = keys::ClientKey<[u8; 32], u64>;
|
||||||
|
#[cfg(any(feature = "interactive_mp", feature = "non_interactive_mp"))]
|
||||||
pub type FheBool = impl_bool_frontend::FheBool<Vec<u64>>;
|
pub type FheBool = impl_bool_frontend::FheBool<Vec<u64>>;
|
||||||
|
|
||||||
pub(crate) trait BooleanGates {
|
pub(crate) trait BooleanGates {
|
||||||
@@ -69,6 +70,7 @@ pub(crate) trait BooleanGates {
|
|||||||
fn not(&self, c: &Self::Ciphertext) -> Self::Ciphertext;
|
fn not(&self, c: &Self::Ciphertext) -> Self::Ciphertext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "interactive_mp", feature = "non_interactive_mp"))]
|
||||||
mod impl_bool_frontend {
|
mod impl_bool_frontend {
|
||||||
use crate::MultiPartyDecryptor;
|
use crate::MultiPartyDecryptor;
|
||||||
|
|
||||||
@@ -193,6 +195,7 @@ mod impl_bool_frontend {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "interactive_mp", feature = "non_interactive_mp"))]
|
||||||
mod common_mp_enc_dec {
|
mod common_mp_enc_dec {
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
||||||
@@ -200,7 +203,7 @@ mod common_mp_enc_dec {
|
|||||||
use crate::{
|
use crate::{
|
||||||
pbs::{sample_extract, PbsInfo},
|
pbs::{sample_extract, PbsInfo},
|
||||||
utils::WithLocal,
|
utils::WithLocal,
|
||||||
Matrix, MultiPartyDecryptor, RowEntity, SampleExtractor,
|
Matrix, RowEntity, SampleExtractor,
|
||||||
};
|
};
|
||||||
|
|
||||||
type Mat = Vec<Vec<u64>>;
|
type Mat = Vec<Vec<u64>>;
|
||||||
|
|||||||
@@ -43,9 +43,6 @@ pub fn set_parameter_set(select: ParameterSelector) {
|
|||||||
ParameterSelector::InteractiveLTE8Party => {
|
ParameterSelector::InteractiveLTE8Party => {
|
||||||
BOOL_EVALUATOR.with_borrow_mut(|v| *v = Some(BoolEvaluator::new(I_8P)));
|
BOOL_EVALUATOR.with_borrow_mut(|v| *v = Some(BoolEvaluator::new(I_8P)));
|
||||||
}
|
}
|
||||||
_ => {
|
|
||||||
panic!("Paramerter not supported")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -725,27 +725,14 @@ pub(crate) const SP_TEST_BOOL_PARAMS: BoolParameters<u64> = BoolParameters::<u64
|
|||||||
variant: ParameterVariant::SingleParty,
|
variant: ParameterVariant::SingleParty,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(test)]
|
// #[cfg(test)]
|
||||||
mod tests {
|
// mod tests {
|
||||||
|
|
||||||
impl BoolParameters<u64> {
|
// #[test]
|
||||||
pub(crate) fn default_rlwe_modop(&self) -> ModularOpsU64<CiphertextModulus<u64>> {
|
// fn find_prime() {
|
||||||
ModularOpsU64::new(self.rlwe_q)
|
// let bits = 60;
|
||||||
}
|
// let ring_size = 1 << 11;
|
||||||
pub(crate) fn default_rlwe_nttop(&self) -> NttBackendU64 {
|
// let prime = crate::utils::generate_prime(bits, ring_size * 2, 1 <<
|
||||||
NttBackendU64::new(&self.rlwe_q, self.rlwe_n.0)
|
// bits).unwrap(); dbg!(prime);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
use crate::{utils::generate_prime, ModInit, ModularOpsU64, Ntt, NttBackendU64, NttInit};
|
|
||||||
|
|
||||||
use super::{BoolParameters, CiphertextModulus};
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn find_prime() {
|
|
||||||
let bits = 60;
|
|
||||||
let ring_size = 1 << 11;
|
|
||||||
let prime = generate_prime(bits, ring_size * 2, 1 << bits).unwrap();
|
|
||||||
dbg!(prime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use itertools::{assert_equal, izip, Itertools};
|
use itertools::{izip, Itertools};
|
||||||
use num_traits::{FromPrimitive, PrimInt, ToPrimitive, WrappingAdd, WrappingSub};
|
use num_traits::{FromPrimitive, PrimInt, ToPrimitive, WrappingAdd, WrappingSub};
|
||||||
use std::fmt::{Debug, Display};
|
use std::fmt::{Debug, Display};
|
||||||
|
|
||||||
@@ -311,13 +311,13 @@ fn round_value<T: PrimInt + WrappingAdd>(value: T, ignore_bits: usize) -> T {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use itertools::{izip, Itertools};
|
use itertools::Itertools;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
backend::{ModInit, ModularOpsU64, Modulus},
|
backend::{ModInit, ModularOpsU64},
|
||||||
decomposer::round_value,
|
decomposer::round_value,
|
||||||
utils::{generate_prime, tests::Stats},
|
utils::generate_prime,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{Decomposer, DefaultDecomposer};
|
use super::{Decomposer, DefaultDecomposer};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ mod ntt;
|
|||||||
mod pbs;
|
mod pbs;
|
||||||
mod random;
|
mod random;
|
||||||
mod rgsw;
|
mod rgsw;
|
||||||
|
#[cfg(any(feature = "interactive_mp", feature = "non_interactive_mp"))]
|
||||||
mod shortint;
|
mod shortint;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ pub use backend::{
|
|||||||
|
|
||||||
pub use bool::*;
|
pub use bool::*;
|
||||||
pub use ntt::{Ntt, NttBackendU64, NttInit};
|
pub use ntt::{Ntt, NttBackendU64, NttInit};
|
||||||
|
#[cfg(any(feature = "interactive_mp", feature = "non_interactive_mp"))]
|
||||||
pub use shortint::{div_zero_error_flag, reset_error_flags, FheUint8};
|
pub use shortint::{div_zero_error_flag, reset_error_flags, FheUint8};
|
||||||
|
|
||||||
pub use decomposer::{Decomposer, DecomposerIter, DefaultDecomposer};
|
pub use decomposer::{Decomposer, DecomposerIter, DefaultDecomposer};
|
||||||
|
|||||||
@@ -625,7 +625,7 @@ pub(crate) fn decrypt_rlwe<
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Measures maximum noise in degree 1 RLWE ciphertext against message `want_m`
|
// Measures maximum noise in degree 1 RLWE ciphertext against message `want_m`
|
||||||
pub(crate) fn measure_max_noise<
|
fn measure_max_noise<
|
||||||
Mmut: MatrixMut + Matrix,
|
Mmut: MatrixMut + Matrix,
|
||||||
ModOp: VectorOps<Element = Mmut::MatElement> + GetModulus<Element = Mmut::MatElement>,
|
ModOp: VectorOps<Element = Mmut::MatElement> + GetModulus<Element = Mmut::MatElement>,
|
||||||
NttOp: Ntt<Element = Mmut::MatElement>,
|
NttOp: Ntt<Element = Mmut::MatElement>,
|
||||||
|
|||||||
Reference in New Issue
Block a user