mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-08 22:28:01 -05:00
feat(tfhe): update rust toolchain
This commit is contained in:
@@ -36,7 +36,7 @@ impl KreyviumStreamShortint {
|
||||
let mut c_register: [Ciphertext; 111] = [0; 111].map(|x| sk.create_trivial(x));
|
||||
|
||||
for i in 0..93 {
|
||||
a_register[i] = key[128 - 93 + i].clone();
|
||||
a_register[i].clone_from(&key[128 - 93 + i]);
|
||||
}
|
||||
for i in 0..84 {
|
||||
b_register[i] = sk.create_trivial(iv[128 - 84 + i]);
|
||||
|
||||
@@ -34,7 +34,7 @@ impl TriviumStreamShortint {
|
||||
let mut c_register: [Ciphertext; 111] = [0; 111].map(|x| sk.create_trivial(x));
|
||||
|
||||
for i in 0..80 {
|
||||
a_register[93 - 80 + i] = key[i].clone();
|
||||
a_register[93 - 80 + i].clone_from(&key[i]);
|
||||
b_register[84 - 80 + i] = sk.create_trivial(iv[i]);
|
||||
}
|
||||
|
||||
|
||||
@@ -198,8 +198,8 @@ impl<BlockCipher: AesBlockCipher> Iterator for AesCtrGenerator<BlockCipher> {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(unused)] // to please clippy when tests are not activated
|
||||
pub mod aes_ctr_generic_test {
|
||||
#![allow(unused)] // to please clippy when tests are not activated
|
||||
|
||||
use super::*;
|
||||
use crate::generators::aes_ctr::index::{AesIndex, ByteIndex};
|
||||
|
||||
@@ -83,7 +83,6 @@ fn aes_encrypt_many(
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use std::convert::TryInto;
|
||||
|
||||
// Test vector for aes128, from the FIPS publication 197
|
||||
const CIPHER_KEY: u128 = u128::from_be(0x000102030405060708090a0b0c0d0e0f);
|
||||
|
||||
@@ -124,8 +124,8 @@ mod implem;
|
||||
pub use implem::*;
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(unused)] // to please clippy when tests are not activated
|
||||
pub mod generator_generic_test {
|
||||
#![allow(unused)] // to please clippy when tests are not activated
|
||||
use super::*;
|
||||
use rand::Rng;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::seeders::{Seed, Seeder};
|
||||
use libc;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
/// There is no `rseed` equivalent in the ARM specification until `ARMv8.5-A`.
|
||||
|
||||
@@ -12,7 +12,6 @@ use tfhe::boolean::parameters::{
|
||||
use tfhe::core_crypto::prelude::*;
|
||||
use tfhe::keycache::NamedParam;
|
||||
use tfhe::shortint::parameters::*;
|
||||
use tfhe::shortint::ClassicPBSParameters;
|
||||
|
||||
const SHORTINT_BENCH_PARAMS: [ClassicPBSParameters; 19] = [
|
||||
PARAM_MESSAGE_1_CARRY_0_KS_PBS,
|
||||
|
||||
@@ -9,7 +9,6 @@ use std::env;
|
||||
use criterion::{criterion_group, Criterion};
|
||||
use itertools::iproduct;
|
||||
use rand::prelude::*;
|
||||
use rand::Rng;
|
||||
use std::vec::IntoIter;
|
||||
use tfhe::integer::keycache::KEY_CACHE;
|
||||
use tfhe::integer::{IntegerKeyKind, RadixCiphertext, RadixClientKey, ServerKey};
|
||||
@@ -1187,14 +1186,10 @@ define_server_key_bench_default_fn!(
|
||||
#[cfg(feature = "gpu")]
|
||||
mod cuda {
|
||||
use super::*;
|
||||
use crate::utilities::{write_to_json, EnvConfig, OperatorType};
|
||||
use criterion::{criterion_group, Criterion};
|
||||
use criterion::criterion_group;
|
||||
use tfhe::core_crypto::gpu::{CudaDevice, CudaStream};
|
||||
use tfhe::integer::gpu::ciphertext::CudaUnsignedRadixCiphertext;
|
||||
use tfhe::integer::gpu::server_key::CudaServerKey;
|
||||
use tfhe::integer::keycache::KEY_CACHE;
|
||||
use tfhe::integer::IntegerKeyKind;
|
||||
use tfhe::keycache::NamedParam;
|
||||
|
||||
fn bench_cuda_server_key_unary_function_clean_inputs<F>(
|
||||
c: &mut Criterion,
|
||||
|
||||
@@ -7,7 +7,6 @@ use std::env;
|
||||
use criterion::{criterion_group, Criterion};
|
||||
use itertools::iproduct;
|
||||
use rand::prelude::*;
|
||||
use rand::Rng;
|
||||
use std::vec::IntoIter;
|
||||
use tfhe::integer::keycache::KEY_CACHE;
|
||||
use tfhe::integer::{IntegerKeyKind, RadixCiphertext, ServerKey, SignedRadixCiphertext, I256};
|
||||
@@ -1202,14 +1201,10 @@ criterion_group!(cast_ops, cast_to_unsigned, cast_to_signed);
|
||||
#[cfg(feature = "gpu")]
|
||||
mod cuda {
|
||||
use super::*;
|
||||
use crate::utilities::{write_to_json, OperatorType};
|
||||
use criterion::{criterion_group, Criterion};
|
||||
use criterion::criterion_group;
|
||||
use tfhe::core_crypto::gpu::{CudaDevice, CudaStream};
|
||||
use tfhe::integer::gpu::ciphertext::CudaSignedRadixCiphertext;
|
||||
use tfhe::integer::gpu::server_key::CudaServerKey;
|
||||
use tfhe::integer::keycache::KEY_CACHE;
|
||||
use tfhe::integer::IntegerKeyKind;
|
||||
use tfhe::keycache::NamedParam;
|
||||
|
||||
/// Base function to bench a server key function that is a binary operation, input ciphertext
|
||||
/// will contain only zero carries
|
||||
|
||||
@@ -7,9 +7,7 @@ use std::env;
|
||||
use criterion::{criterion_group, Criterion};
|
||||
use tfhe::keycache::NamedParam;
|
||||
use tfhe::shortint::parameters::*;
|
||||
use tfhe::shortint::{
|
||||
Ciphertext, ClassicPBSParameters, CompressedServerKey, ServerKey, ShortintParameterSet,
|
||||
};
|
||||
use tfhe::shortint::{Ciphertext, CompressedServerKey, ServerKey};
|
||||
|
||||
use rand::Rng;
|
||||
use tfhe::shortint::keycache::{KEY_CACHE, KEY_CACHE_WOPBS};
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
//! underlying `core_crypto` module.
|
||||
|
||||
use crate::boolean::ciphertext::{Ciphertext, CompressedCiphertext};
|
||||
use crate::boolean::parameters::{
|
||||
BooleanKeySwitchingParameters, BooleanParameters, EncryptionKeyChoice,
|
||||
};
|
||||
use crate::boolean::parameters::{BooleanKeySwitchingParameters, BooleanParameters};
|
||||
use crate::boolean::{ClientKey, CompressedPublicKey, PublicKey, PLAINTEXT_FALSE, PLAINTEXT_TRUE};
|
||||
use crate::core_crypto::algorithms::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
@@ -17,7 +15,7 @@ use crate::core_crypto::commons::generators::{
|
||||
DeterministicSeeder, EncryptionRandomGenerator, SecretRandomGenerator,
|
||||
};
|
||||
use crate::core_crypto::commons::math::random::{ActivatedRandomGenerator, Seeder};
|
||||
use crate::core_crypto::commons::parameters::{PBSOrder, *};
|
||||
use crate::core_crypto::commons::parameters::*;
|
||||
use crate::core_crypto::seeders::new_seeder;
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -38,8 +38,6 @@ pub unsafe extern "C" fn shortint_ciphertext_get_degree(
|
||||
})
|
||||
}
|
||||
|
||||
use tfhe_c_api_dynamic_buffer::DynamicBuffer;
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn shortint_serialize_ciphertext(
|
||||
ciphertext: *const ShortintCiphertext,
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
use crate::core_crypto::commons::computation_buffers::ComputationBuffers;
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::ggsw::{
|
||||
fill_with_forward_fourier_scratch, FourierGgswCiphertext,
|
||||
};
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::ggsw::fill_with_forward_fourier_scratch;
|
||||
use crate::core_crypto::fft_impl::fft64::math::fft::{Fft, FftView};
|
||||
use concrete_fft::c64;
|
||||
use dyn_stack::{PodStack, SizeOverflow, StackReq};
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
//! like addition, multiplication, etc.
|
||||
|
||||
use crate::core_crypto::algorithms::slice_algorithms::*;
|
||||
use crate::core_crypto::commons::numeric::UnsignedInteger;
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
//! [`LWE Ciphertext`](`LweCiphertext`) from a given [`GLWE ciphertext`](`GlweCiphertext`).
|
||||
|
||||
use crate::core_crypto::algorithms::slice_algorithms::*;
|
||||
use crate::core_crypto::commons::numeric::UnsignedInteger;
|
||||
use crate::core_crypto::commons::parameters::{MonomialDegree, *};
|
||||
use crate::core_crypto::commons::parameters::*;
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
use rayon::prelude::*;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
use crate::core_crypto::commons::generators::SecretRandomGenerator;
|
||||
use crate::core_crypto::commons::math::random::{RandomGenerable, UniformBinary};
|
||||
use crate::core_crypto::commons::numeric::Numeric;
|
||||
use crate::core_crypto::commons::parameters::*;
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
|
||||
@@ -5,11 +5,8 @@
|
||||
use crate::core_crypto::commons::computation_buffers::ComputationBuffers;
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
use crate::core_crypto::fft_impl::fft128::crypto::bootstrap::Fourier128LweBootstrapKey;
|
||||
use crate::core_crypto::fft_impl::fft128::math::fft::Fft128;
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::bootstrap::{
|
||||
fill_with_forward_fourier_scratch, FourierLweBootstrapKey,
|
||||
};
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::bootstrap::fill_with_forward_fourier_scratch;
|
||||
use crate::core_crypto::fft_impl::fft64::math::fft::{Fft, FftView};
|
||||
use concrete_fft::c64;
|
||||
use dyn_stack::{PodStack, SizeOverflow, StackReq};
|
||||
|
||||
@@ -2278,14 +2278,10 @@ pub fn par_encrypt_lwe_compact_ciphertext_list_with_compact_public_key<
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::core_crypto::commons::generators::DeterministicSeeder;
|
||||
use crate::core_crypto::commons::test_tools;
|
||||
use crate::core_crypto::prelude::*;
|
||||
|
||||
use crate::core_crypto::commons::generators::{
|
||||
DeterministicSeeder, EncryptionRandomGenerator, SecretRandomGenerator,
|
||||
};
|
||||
use crate::core_crypto::commons::math::random::{ActivatedRandomGenerator, Gaussian};
|
||||
|
||||
#[test]
|
||||
fn test_compact_public_key_encryption() {
|
||||
use rand::Rng;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
use crate::core_crypto::algorithms::slice_algorithms::*;
|
||||
use crate::core_crypto::commons::math::decomposition::SignedDecomposer;
|
||||
use crate::core_crypto::commons::numeric::UnsignedInteger;
|
||||
use crate::core_crypto::commons::parameters::{
|
||||
DecompositionBaseLog, DecompositionLevelCount, ThreadCount,
|
||||
};
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
use crate::core_crypto::algorithms::slice_algorithms::*;
|
||||
use crate::core_crypto::commons::ciphertext_modulus::CiphertextModulusKind;
|
||||
use crate::core_crypto::commons::numeric::UnsignedInteger;
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@ use crate::core_crypto::algorithms::{
|
||||
};
|
||||
use crate::core_crypto::commons::generators::EncryptionRandomGenerator;
|
||||
use crate::core_crypto::commons::math::decomposition::{DecompositionLevel, DecompositionTerm};
|
||||
use crate::core_crypto::commons::math::random::{
|
||||
ActivatedRandomGenerator, ByteRandomGenerator, Distribution, Uniform,
|
||||
};
|
||||
use crate::core_crypto::commons::math::random::{ActivatedRandomGenerator, Distribution, Uniform};
|
||||
use crate::core_crypto::commons::parameters::*;
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use crate::core_crypto::entities::{
|
||||
|
||||
@@ -6,17 +6,13 @@ use crate::core_crypto::commons::math::decomposition::SignedDecomposer;
|
||||
use crate::core_crypto::commons::parameters::*;
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
use crate::core_crypto::fft_impl::fft128::crypto::bootstrap::{
|
||||
bootstrap_scratch as bootstrap_scratch_f128, Fourier128LweBootstrapKey,
|
||||
};
|
||||
use crate::core_crypto::fft_impl::fft128::crypto::bootstrap::bootstrap_scratch as bootstrap_scratch_f128;
|
||||
use crate::core_crypto::fft_impl::fft128::math::fft::{Fft128, Fft128View};
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::bootstrap::{
|
||||
bootstrap_scratch, FourierLweBootstrapKey,
|
||||
};
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::bootstrap::bootstrap_scratch;
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::ggsw::{
|
||||
add_external_product_assign as impl_add_external_product_assign,
|
||||
add_external_product_assign_scratch as impl_add_external_product_assign_scratch, cmux,
|
||||
cmux_scratch, FourierGgswCiphertext,
|
||||
cmux_scratch,
|
||||
};
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::wop_pbs::blind_rotate_assign_scratch;
|
||||
use crate::core_crypto::fft_impl::fft64::math::fft::{Fft, FftView};
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
use crate::core_crypto::commons::generators::SecretRandomGenerator;
|
||||
use crate::core_crypto::commons::math::random::{RandomGenerable, UniformBinary};
|
||||
use crate::core_crypto::commons::numeric::Numeric;
|
||||
use crate::core_crypto::commons::parameters::*;
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::core_crypto::commons::math::random::{Distribution, Uniform};
|
||||
use crate::core_crypto::commons::parameters::*;
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::bootstrap::FourierLweBootstrapKey;
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::wop_pbs::{
|
||||
circuit_bootstrap_boolean_vertical_packing, circuit_bootstrap_boolean_vertical_packing_scratch,
|
||||
extract_bits, extract_bits_scratch,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
//! Module providing algorithms to perform computations on polynomials modulo $X^{N} + 1$.
|
||||
|
||||
use crate::core_crypto::algorithms::slice_algorithms::*;
|
||||
use crate::core_crypto::commons::numeric::UnsignedInteger;
|
||||
use crate::core_crypto::commons::parameters::MonomialDegree;
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
use super::*;
|
||||
|
||||
use crate::core_crypto::commons::generators::{
|
||||
DeterministicSeeder, EncryptionRandomGenerator, SecretRandomGenerator,
|
||||
};
|
||||
use crate::core_crypto::commons::math::random::{ActivatedRandomGenerator, CompressionSeed};
|
||||
use crate::core_crypto::commons::generators::DeterministicSeeder;
|
||||
use crate::core_crypto::commons::math::random::CompressionSeed;
|
||||
use crate::core_crypto::commons::test_tools;
|
||||
|
||||
#[cfg(not(tarpaulin))]
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
use super::*;
|
||||
|
||||
use crate::core_crypto::commons::generators::{
|
||||
DeterministicSeeder, EncryptionRandomGenerator, SecretRandomGenerator,
|
||||
};
|
||||
use crate::core_crypto::commons::math::random::{ActivatedRandomGenerator, Gaussian};
|
||||
use crate::core_crypto::commons::generators::DeterministicSeeder;
|
||||
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
use super::*;
|
||||
|
||||
use crate::core_crypto::commons::generators::{
|
||||
DeterministicSeeder, EncryptionRandomGenerator, SecretRandomGenerator,
|
||||
};
|
||||
use crate::core_crypto::commons::math::random::ActivatedRandomGenerator;
|
||||
use crate::core_crypto::commons::generators::DeterministicSeeder;
|
||||
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::*;
|
||||
use crate::core_crypto::keycache::KeyCacheAccess;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::*;
|
||||
use crate::core_crypto::keycache::KeyCacheAccess;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
use super::*;
|
||||
|
||||
use crate::core_crypto::commons::generators::{
|
||||
DeterministicSeeder, EncryptionRandomGenerator, SecretRandomGenerator,
|
||||
};
|
||||
use crate::core_crypto::commons::math::random::ActivatedRandomGenerator;
|
||||
use crate::core_crypto::commons::generators::DeterministicSeeder;
|
||||
|
||||
#[cfg(not(tarpaulin))]
|
||||
const NB_TESTS: usize = 10;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::*;
|
||||
use crate::core_crypto::keycache::KeyCacheAccess;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::*;
|
||||
use crate::core_crypto::commons::dispersion::{DispersionParameter, StandardDev};
|
||||
use crate::core_crypto::commons::math::torus::FromTorus;
|
||||
use crate::core_crypto::commons::numeric::{CastInto, Numeric};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::core_crypto::commons::numeric::{CastInto, FloatingPoint};
|
||||
use crate::core_crypto::commons::parameters::CiphertextModulus;
|
||||
use concrete_csprng::generators::{BytesPerChild, ChildrenCount, ForkError};
|
||||
use rayon::prelude::*;
|
||||
use std::convert::TryInto;
|
||||
|
||||
pub use concrete_csprng::generators::{
|
||||
ParallelRandomGenerator as ParallelByteRandomGenerator, RandomGenerator as ByteRandomGenerator,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::*;
|
||||
use crate::core_crypto::commons::numeric::{Numeric, UnsignedInteger};
|
||||
use crate::core_crypto::commons::numeric::Numeric;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The distribution $TUniform(1, -2^b, 2^b)$ is defined as follows, any value in the interval
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
use super::*;
|
||||
|
||||
use crate::core_crypto::commons::numeric::UnsignedInteger;
|
||||
|
||||
/// A distribution type representing uniform sampling for unsigned integer types. The value is
|
||||
/// uniformly sampled in `[0, 2^n[` where `n` is the size of the integer type.
|
||||
#[derive(Copy, Clone)]
|
||||
|
||||
@@ -72,7 +72,7 @@ pub mod test_tools {
|
||||
LweDimension, PlaintextCount, PolynomialSize,
|
||||
};
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use concrete_csprng::seeders::{Seed, Seeder};
|
||||
use concrete_csprng::seeders::Seed;
|
||||
|
||||
pub fn variance(samples: &[f64]) -> Variance {
|
||||
let num_samples = samples.len();
|
||||
|
||||
@@ -89,7 +89,6 @@ pub mod tests {
|
||||
pub(crate) use crate::core_crypto::algorithms::test::gen_keys_or_get_from_cache_if_enabled;
|
||||
|
||||
use crate::core_crypto::algorithms::test::{FftBootstrapKeys, FftTestParams, TestResources};
|
||||
use crate::core_crypto::commons::numeric::Numeric;
|
||||
use crate::core_crypto::fft_impl::common::FourierBootstrapKey;
|
||||
use crate::core_crypto::keycache::KeyCacheAccess;
|
||||
use crate::core_crypto::prelude::*;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::super::math::fft::{Fft128, Fft128View};
|
||||
use super::ggsw::{cmux, cmux_scratch, Fourier128GgswCiphertext};
|
||||
use super::ggsw::{cmux, cmux_scratch};
|
||||
use crate::core_crypto::algorithms::extract_lwe_sample_from_glwe_ciphertext;
|
||||
use crate::core_crypto::algorithms::polynomial_algorithms::*;
|
||||
use crate::core_crypto::commons::math::decomposition::SignedDecomposer;
|
||||
|
||||
@@ -10,7 +10,6 @@ use crate::core_crypto::commons::traits::ContiguousEntityContainerMut;
|
||||
use crate::core_crypto::commons::utils::izip;
|
||||
use crate::core_crypto::entities::*;
|
||||
use crate::core_crypto::fft_impl::common::fast_pbs_modulus_switch;
|
||||
use crate::core_crypto::fft_impl::fft128::crypto::bootstrap::Fourier128LweBootstrapKey;
|
||||
use crate::core_crypto::prelude::{Container, ContainerMut};
|
||||
use aligned_vec::CACHELINE_ALIGN;
|
||||
use dyn_stack::{PodStack, ReborrowMut};
|
||||
|
||||
@@ -6,9 +6,7 @@ use crate::core_crypto::commons::traits::contiguous_entity_container::{
|
||||
};
|
||||
use crate::core_crypto::commons::utils::izip;
|
||||
use crate::core_crypto::entities::*;
|
||||
use crate::core_crypto::fft_impl::fft128::crypto::ggsw::{
|
||||
update_with_fmadd, Fourier128GgswCiphertext,
|
||||
};
|
||||
use crate::core_crypto::fft_impl::fft128::crypto::ggsw::update_with_fmadd;
|
||||
use crate::core_crypto::prelude::{Container, ContainerMut, SignedDecomposer};
|
||||
use aligned_vec::CACHELINE_ALIGN;
|
||||
use dyn_stack::{PodStack, ReborrowMut};
|
||||
|
||||
@@ -13,7 +13,6 @@ use super::ggsw::{
|
||||
use crate::core_crypto::algorithms::polynomial_algorithms::*;
|
||||
use crate::core_crypto::algorithms::*;
|
||||
use crate::core_crypto::commons::math::decomposition::DecompositionLevel;
|
||||
use crate::core_crypto::commons::numeric::CastInto;
|
||||
use crate::core_crypto::commons::parameters::*;
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use crate::core_crypto::commons::utils::izip;
|
||||
|
||||
@@ -3,22 +3,15 @@ use crate::core_crypto::algorithms::slice_algorithms::*;
|
||||
use crate::core_crypto::algorithms::test::{FftWopPbsKeys, FftWopPbsTestParams};
|
||||
use crate::core_crypto::commons::dispersion::LogStandardDev;
|
||||
use crate::core_crypto::commons::math::decomposition::SignedDecomposer;
|
||||
use crate::core_crypto::commons::parameters::{
|
||||
DecompositionBaseLog, DecompositionLevelCount, DeltaLog, ExtractedBitsCount, GlweDimension,
|
||||
LweDimension, PlaintextCount, PolynomialCount, PolynomialSize,
|
||||
};
|
||||
use crate::core_crypto::commons::test_tools;
|
||||
use crate::core_crypto::fft_impl::common::tests::gen_keys_or_get_from_cache_if_enabled;
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::bootstrap::{
|
||||
fill_with_forward_fourier_scratch, FourierLweBootstrapKey,
|
||||
};
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::bootstrap::fill_with_forward_fourier_scratch;
|
||||
use crate::core_crypto::fft_impl::fft64::math::fft::Fft;
|
||||
use crate::core_crypto::prelude::test::{
|
||||
TestResources, FFT_WOPBS_N1024_PARAMS, FFT_WOPBS_N2048_PARAMS, FFT_WOPBS_N512_PARAMS,
|
||||
FFT_WOPBS_PARAMS,
|
||||
};
|
||||
use concrete_fft::c64;
|
||||
use dyn_stack::{GlobalPodBuffer, PodStack, ReborrowMut, StackReq};
|
||||
use dyn_stack::GlobalPodBuffer;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use dyn_stack::{GlobalPodBuffer, ReborrowMut};
|
||||
|
||||
use super::super::polynomial::FourierPolynomial;
|
||||
use super::*;
|
||||
use crate::core_crypto::commons::test_tools::{modular_distance, new_random_generator};
|
||||
use crate::core_crypto::entities::Polynomial;
|
||||
use aligned_vec::avec;
|
||||
use dyn_stack::GlobalPodBuffer;
|
||||
|
||||
fn test_roundtrip<Scalar: UnsignedTorus>() {
|
||||
let mut generator = new_random_generator();
|
||||
|
||||
@@ -354,7 +354,6 @@ fn compact_bool_list_test_case(setup_fn: impl FnOnce() -> (ClientKey, Device)) {
|
||||
|
||||
mod cpu {
|
||||
use super::*;
|
||||
use crate::Device;
|
||||
|
||||
fn setup_default() -> ClientKey {
|
||||
let config = ConfigBuilder::default().build();
|
||||
|
||||
@@ -424,7 +424,6 @@ where
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::conformance::ParameterSetConformant;
|
||||
use crate::core_crypto::prelude::UnsignedInteger;
|
||||
use crate::prelude::*;
|
||||
use crate::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS;
|
||||
|
||||
@@ -199,7 +199,6 @@ impl<Id: FheUintId> ParameterSetConformant for CompactFheUintList<Id> {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::conformance::ParameterSetConformant;
|
||||
use crate::core_crypto::prelude::UnsignedInteger;
|
||||
use crate::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS;
|
||||
use crate::shortint::{CiphertextModulus, PBSOrder};
|
||||
|
||||
@@ -105,7 +105,6 @@ impl<Id: FheUintId> Named for CompressedFheUint<Id> {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::conformance::ParameterSetConformant;
|
||||
use crate::core_crypto::prelude::UnsignedInteger;
|
||||
use crate::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS;
|
||||
use crate::shortint::CiphertextModulus;
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::integer::server_key::radix_parallel::tests_cases_signed::{
|
||||
signed_default_add_test, signed_unchecked_add_test,
|
||||
};
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::PBSParameters;
|
||||
|
||||
create_gpu_parametrized_test!(integer_unchecked_add);
|
||||
create_gpu_parametrized_test!(integer_add);
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::integer::server_key::radix_parallel::tests_cases_signed::{
|
||||
signed_default_neg_test, signed_unchecked_neg_test,
|
||||
};
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::PBSParameters;
|
||||
|
||||
create_gpu_parametrized_test!(integer_unchecked_neg);
|
||||
create_gpu_parametrized_test!(integer_neg);
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::integer::server_key::radix_parallel::tests_cases_signed::{
|
||||
signed_default_sub_test, signed_unchecked_sub_test,
|
||||
};
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::PBSParameters;
|
||||
|
||||
create_gpu_parametrized_test!(integer_unchecked_sub);
|
||||
create_gpu_parametrized_test!(integer_sub);
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::integer::server_key::radix_parallel::tests_cases_unsigned::{
|
||||
default_add_test, unchecked_add_assign_test, unchecked_add_test,
|
||||
};
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::PBSParameters;
|
||||
|
||||
create_gpu_parametrized_test!(integer_unchecked_add);
|
||||
create_gpu_parametrized_test!(integer_unchecked_add_assign);
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::integer::server_key::radix_parallel::tests_cases_unsigned::{
|
||||
default_sub_test, unchecked_sub_test,
|
||||
};
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::PBSParameters;
|
||||
|
||||
create_gpu_parametrized_test!(integer_unchecked_sub);
|
||||
create_gpu_parametrized_test!(integer_sub);
|
||||
|
||||
@@ -112,7 +112,6 @@ mod tests {
|
||||
use crate::integer::keycache::KEY_CACHE;
|
||||
use crate::integer::IntegerKeyKind;
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::ClassicPBSParameters;
|
||||
|
||||
create_parametrized_test!(integer_public_key_decompression_small {
|
||||
PARAM_MESSAGE_2_CARRY_2_PBS_KS,
|
||||
|
||||
@@ -4,7 +4,6 @@ use crate::integer::{gen_keys, CompressedPublicKey, IntegerKeyKind, PublicKey};
|
||||
#[cfg(tarpaulin)]
|
||||
use crate::shortint::parameters::coverage_parameters::*;
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::ClassicPBSParameters;
|
||||
|
||||
use crate::integer::keycache::KEY_CACHE;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ use crate::integer::IntegerKeyKind;
|
||||
#[cfg(tarpaulin)]
|
||||
use crate::shortint::parameters::coverage_parameters::*;
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::ClassicPBSParameters;
|
||||
use rand::Rng;
|
||||
|
||||
create_parametrized_test!(integer_unchecked_crt_mul);
|
||||
|
||||
@@ -746,7 +746,6 @@ mod tests {
|
||||
#[cfg(tarpaulin)]
|
||||
use crate::shortint::parameters::coverage_parameters::*;
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::PBSParameters;
|
||||
|
||||
create_parametrized_test!(boolean_bitxor);
|
||||
create_parametrized_test!(boolean_bitor);
|
||||
|
||||
@@ -43,7 +43,7 @@ impl ServerKey {
|
||||
.iter_mut()
|
||||
.zip(ctxt.blocks[shift..].iter())
|
||||
{
|
||||
*res_i = c_i.clone();
|
||||
res_i.clone_from(c_i);
|
||||
}
|
||||
|
||||
result
|
||||
|
||||
@@ -1,23 +1,17 @@
|
||||
use crate::integer::keycache::KEY_CACHE;
|
||||
use crate::integer::server_key::radix_parallel::tests_cases_unsigned::*;
|
||||
use crate::integer::server_key::radix_parallel::tests_unsigned::test_add::smart_add_test;
|
||||
use crate::integer::server_key::radix_parallel::tests_unsigned::test_neg::smart_neg_test;
|
||||
use crate::integer::server_key::radix_parallel::tests_unsigned::test_sub::{
|
||||
default_overflowing_sub_test, smart_sub_test,
|
||||
};
|
||||
use crate::integer::server_key::radix_parallel::tests_unsigned::CpuFunctionExecutor;
|
||||
use crate::integer::{IntegerKeyKind, RadixCiphertext, ServerKey, SignedRadixCiphertext, U256};
|
||||
#[cfg(tarpaulin)]
|
||||
use crate::shortint::parameters::coverage_parameters::*;
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::ClassicPBSParameters;
|
||||
use rand::Rng;
|
||||
|
||||
use crate::integer::server_key::radix_parallel::tests_cases_unsigned::*;
|
||||
use crate::integer::server_key::radix_parallel::tests_unsigned::test_add::{
|
||||
smart_add_test, unchecked_add_test,
|
||||
};
|
||||
use crate::integer::server_key::radix_parallel::tests_unsigned::test_neg::{
|
||||
smart_neg_test, unchecked_neg_test,
|
||||
};
|
||||
use crate::integer::server_key::radix_parallel::tests_unsigned::test_sub::{
|
||||
default_overflowing_sub_test, smart_sub_test, unchecked_sub_test,
|
||||
};
|
||||
use crate::integer::server_key::radix_parallel::tests_unsigned::CpuFunctionExecutor;
|
||||
|
||||
/// Number of loop iteration within randomized tests
|
||||
#[cfg(not(tarpaulin))]
|
||||
pub(crate) const NB_TESTS: usize = 30;
|
||||
|
||||
@@ -1114,7 +1114,7 @@ pub(crate) mod tests_signed {
|
||||
random_non_zero_value, signed_add_under_modulus,
|
||||
};
|
||||
use crate::integer::server_key::radix_parallel::tests_signed::{NB_CTXT, NB_TESTS_SMALLER};
|
||||
use crate::integer::{IntegerKeyKind, RadixClientKey, SignedRadixCiphertext};
|
||||
use crate::integer::{IntegerKeyKind, RadixClientKey};
|
||||
use crate::shortint::PBSParameters;
|
||||
use rand::Rng;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ use crate::integer::{IntegerKeyKind, ServerKey, I256, U256};
|
||||
use crate::shortint::parameters::coverage_parameters::*;
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::ClassicPBSParameters;
|
||||
use rand;
|
||||
use rand::distributions::Standard;
|
||||
use rand::prelude::*;
|
||||
use rand_distr::num_traits::WrappingAdd;
|
||||
|
||||
@@ -52,18 +52,17 @@ pub(crate) trait FunctionExecutor<TestInput, TestOutput> {
|
||||
fn execute(&mut self, input: TestInput) -> TestOutput;
|
||||
}
|
||||
|
||||
pub(crate) use crate::integer::server_key::radix_parallel::tests_unsigned::test_add::unchecked_add_test;
|
||||
#[cfg(feature = "gpu")]
|
||||
pub(crate) use crate::integer::server_key::radix_parallel::tests_unsigned::test_add::{
|
||||
default_add_test, unchecked_add_assign_test, unchecked_add_test,
|
||||
default_add_test, unchecked_add_assign_test,
|
||||
};
|
||||
#[cfg(feature = "gpu")]
|
||||
pub(crate) use crate::integer::server_key::radix_parallel::tests_unsigned::test_neg::{
|
||||
default_neg_test, unchecked_neg_test,
|
||||
};
|
||||
pub(crate) use crate::integer::server_key::radix_parallel::tests_unsigned::test_neg::default_neg_test;
|
||||
pub(crate) use crate::integer::server_key::radix_parallel::tests_unsigned::test_neg::unchecked_neg_test;
|
||||
#[cfg(feature = "gpu")]
|
||||
pub(crate) use crate::integer::server_key::radix_parallel::tests_unsigned::test_sub::{
|
||||
default_sub_test, unchecked_sub_test,
|
||||
};
|
||||
pub(crate) use crate::integer::server_key::radix_parallel::tests_unsigned::test_sub::default_sub_test;
|
||||
pub(crate) use crate::integer::server_key::radix_parallel::tests_unsigned::test_sub::unchecked_sub_test;
|
||||
//=============================================================================
|
||||
// Unchecked Tests
|
||||
//=============================================================================
|
||||
|
||||
@@ -15,7 +15,6 @@ use crate::shortint::ciphertext::NoiseLevel;
|
||||
#[cfg(tarpaulin)]
|
||||
use crate::shortint::parameters::coverage_parameters::*;
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::PBSParameters;
|
||||
use rand::Rng;
|
||||
|
||||
create_parametrized_test!(integer_signed_unchecked_add);
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::integer::ServerKey;
|
||||
#[cfg(tarpaulin)]
|
||||
use crate::shortint::parameters::coverage_parameters::*;
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::PBSParameters;
|
||||
|
||||
create_parametrized_test!(integer_signed_unchecked_neg);
|
||||
create_parametrized_test!(integer_signed_smart_neg);
|
||||
|
||||
@@ -11,7 +11,6 @@ use crate::shortint::ciphertext::NoiseLevel;
|
||||
#[cfg(tarpaulin)]
|
||||
use crate::shortint::parameters::coverage_parameters::*;
|
||||
use crate::shortint::parameters::*;
|
||||
use crate::shortint::PBSParameters;
|
||||
use rand::Rng;
|
||||
|
||||
create_parametrized_test!(integer_signed_unchecked_sub);
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::integer::{gen_keys, IntegerKeyKind};
|
||||
use crate::shortint::ciphertext::Degree;
|
||||
use crate::shortint::parameters::parameters_wopbs::*;
|
||||
use crate::shortint::parameters::parameters_wopbs_message_carry::*;
|
||||
use crate::shortint::parameters::{ClassicPBSParameters, *};
|
||||
use crate::shortint::parameters::*;
|
||||
use rand::Rng;
|
||||
use std::cmp::max;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use wasm_bindgen::prelude::*;
|
||||
use wasm_bindgen::JsError;
|
||||
|
||||
use crate::high_level_api::prelude::*;
|
||||
use crate::integer::{I256, U256};
|
||||
|
||||
@@ -5,7 +5,6 @@ use crate::core_crypto::commons::parameters::{
|
||||
LweDimension, PolynomialSize, ThreadCount,
|
||||
};
|
||||
use crate::core_crypto::entities::*;
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::bootstrap::FourierLweBootstrapKey;
|
||||
use crate::shortint::ciphertext::{MaxDegree, MaxNoiseLevel};
|
||||
use crate::shortint::parameters::ShortintKeySwitchingParameters;
|
||||
use crate::shortint::server_key::{ShortintBootstrappingKey, ShortintCompressedBootstrappingKey};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
//! # WARNING: this module is experimental.
|
||||
use crate::core_crypto::algorithms::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::bootstrap::FourierLweBootstrapKey;
|
||||
use crate::shortint::ciphertext::{MaxDegree, MaxNoiseLevel};
|
||||
use crate::shortint::engine::{EngineResult, ShortintEngine};
|
||||
use crate::shortint::server_key::ShortintBootstrappingKey;
|
||||
|
||||
@@ -8,7 +8,6 @@ pub use crate::core_crypto::commons::parameters::{
|
||||
use crate::shortint::parameters::parameters_wopbs::*;
|
||||
use crate::shortint::parameters::parameters_wopbs_prime_moduli::*;
|
||||
use crate::shortint::parameters::{CarryModulus, EncryptionKeyChoice, MessageModulus};
|
||||
use crate::shortint::WopbsParameters;
|
||||
|
||||
pub const ALL_PARAMETER_VEC_WOPBS: [WopbsParameters; 116] = [
|
||||
WOPBS_PARAM_MESSAGE_1_CARRY_0_KS_PBS,
|
||||
|
||||
@@ -4,7 +4,7 @@ use super::MaxDegree;
|
||||
use crate::core_crypto::prelude::*;
|
||||
use crate::shortint::engine::ShortintEngine;
|
||||
use crate::shortint::parameters::{CarryModulus, CiphertextModulus, MessageModulus};
|
||||
use crate::shortint::{ClientKey, PBSOrder};
|
||||
use crate::shortint::ClientKey;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
||||
@@ -32,7 +32,6 @@ use crate::core_crypto::commons::parameters::{
|
||||
};
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
use crate::core_crypto::fft_impl::fft64::crypto::bootstrap::FourierLweBootstrapKey;
|
||||
use crate::core_crypto::fft_impl::fft64::math::fft::Fft;
|
||||
use crate::shortint::ciphertext::{Ciphertext, Degree, MaxDegree, MaxNoiseLevel, NoiseLevel};
|
||||
use crate::shortint::client_key::ClientKey;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use super::CiphertextNoiseDegree;
|
||||
use crate::core_crypto::algorithms::*;
|
||||
use crate::core_crypto::entities::*;
|
||||
use crate::core_crypto::prelude::lwe_encryption::trivially_encrypt_lwe_ciphertext;
|
||||
use crate::shortint::ciphertext::Degree;
|
||||
use crate::shortint::server_key::CheckError;
|
||||
use crate::shortint::{Ciphertext, ServerKey};
|
||||
|
||||
@@ -16,7 +16,7 @@ use crate::core_crypto::fft_impl::fft64::math::fft::Fft;
|
||||
use crate::shortint::ciphertext::*;
|
||||
use crate::shortint::engine::ShortintEngine;
|
||||
use crate::shortint::server_key::ShortintBootstrappingKey;
|
||||
use crate::shortint::{Ciphertext, ClientKey, ServerKey, WopbsParameters};
|
||||
use crate::shortint::{ClientKey, ServerKey, WopbsParameters};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -1 +1 @@
|
||||
nightly-2024-02-13
|
||||
nightly-2024-03-11
|
||||
|
||||
Reference in New Issue
Block a user