Compare commits

..

1 Commits

Author SHA1 Message Date
Arthur Meyre
e810b42eb6 chore(tfhe): remove wildcard deps 2023-06-21 16:24:22 +02:00
10 changed files with 14 additions and 25 deletions

View File

@@ -37,10 +37,10 @@ itertools = "0.10.5"
num_cpus = "1.15"
# For erf and normality test
libm = "0.2.6"
test-case = "*"
combine = "*"
env_logger = "*"
log = "*"
test-case = "3.1.0"
combine = "4.6.6"
env_logger = "0.10.0"
log = "0.4.19"
[build-dependencies]
cbindgen = { version = "0.24.3", optional = true }

View File

@@ -20,7 +20,7 @@ use std::fmt::{Debug, Formatter};
/// * `parameters` - the cryptographic parameter set.
#[derive(Clone, Serialize, Deserialize)]
pub struct ClientKey {
pub lwe_secret_key: LweSecretKeyOwned<u32>,
pub(crate) lwe_secret_key: LweSecretKeyOwned<u32>,
pub(crate) glwe_secret_key: GlweSecretKeyOwned<u32>,
pub(crate) parameters: BooleanParameters,
}

View File

@@ -18,9 +18,9 @@ use rayon::prelude::*;
/// A random number generator which can be used to encrypt messages.
pub struct EncryptionRandomGenerator<G: ByteRandomGenerator> {
// A separate mask generator, only used to generate the mask elements.
pub mask: RandomGenerator<G>,
mask: RandomGenerator<G>,
// A separate noise generator, only used to generate the noise elements.
pub noise: RandomGenerator<G>,
noise: RandomGenerator<G>,
}
impl<G: ByteRandomGenerator> EncryptionRandomGenerator<G> {

View File

@@ -19,7 +19,7 @@ impl<G: ByteRandomGenerator> SecretRandomGenerator<G> {
self.0.remaining_bytes()
}
pub fn fill_slice_with_random_uniform_binary<Scalar>(&mut self, slice: &mut [Scalar])
pub(crate) fn fill_slice_with_random_uniform_binary<Scalar>(&mut self, slice: &mut [Scalar])
where
Scalar: RandomGenerable<UniformBinary>,
{

View File

@@ -636,10 +636,6 @@ impl<Scalar: UnsignedInteger, C: Container<Element = Scalar>> LweCiphertext<C> {
pub fn ciphertext_modulus(&self) -> CiphertextModulus<C::Element> {
self.ciphertext_modulus
}
pub fn data(&self) -> &C {
&self.data
}
}
impl<Scalar: UnsignedInteger, C: ContainerMut<Element = Scalar>> LweCiphertext<C> {

View File

@@ -7,7 +7,6 @@ mod crt;
mod radix;
pub(crate) mod utils;
use crate::core_crypto::prelude::LweSecretKeyOwned;
use crate::integer::block_decomposition::BlockRecomposer;
use crate::integer::ciphertext::{CompressedCrtCiphertext, CrtCiphertext};
use crate::integer::client_key::utils::i_crt;
@@ -34,7 +33,7 @@ use super::ciphertext::{CompressedRadixCiphertext, RadixCiphertext};
/// use the same crypto parameters.
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct ClientKey {
pub key: ShortintClientKey,
pub(crate) key: ShortintClientKey,
}
impl From<ShortintClientKey> for ClientKey {
@@ -464,9 +463,4 @@ impl ClientKey {
{
encrypt_crt(&self.key, message, base_vec, encrypt_block)
}
pub fn get_small_secret_vec(&self) -> Vec<u64> {
let container = LweSecretKeyOwned::into_container(self.key.small_lwe_secret_key.clone());
container
}
}

View File

@@ -11,7 +11,7 @@ use crate::shortint::{
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CompactPublicKey {
pub key: ShortintCompactPublicKey,
pub(crate) key: ShortintCompactPublicKey,
}
impl CompactPublicKey {

View File

@@ -4,7 +4,6 @@ use crate::core_crypto::entities::*;
use crate::shortint::ciphertext::{Ciphertext, CompressedCiphertext};
use crate::shortint::engine::ShortintEngine;
use crate::shortint::parameters::{MessageModulus, ShortintParameterSet};
use pulp::Scalar;
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
@@ -22,7 +21,7 @@ pub struct ClientKey {
pub(crate) large_lwe_secret_key: LweSecretKeyOwned<u64>,
pub(crate) glwe_secret_key: GlweSecretKeyOwned<u64>,
/// Key used as the output of the keyswitch operation
pub small_lwe_secret_key: LweSecretKeyOwned<u64>,
pub(crate) small_lwe_secret_key: LweSecretKeyOwned<u64>,
pub parameters: ShortintParameterSet,
}
@@ -512,7 +511,7 @@ impl ClientKey {
/// assert_eq!(msg, dec % modulus as u64);
/// ```
pub fn decrypt_message_native_crt(&self, ct: &Ciphertext, message_modulus: u8) -> u64 {
ShortintEngine::with_thread_local_mut(|engine: &mut ShortintEngine| {
ShortintEngine::with_thread_local_mut(|engine| {
engine
.decrypt_message_native_crt(self, ct, message_modulus as u64)
.unwrap()

View File

@@ -21,7 +21,7 @@ pub fn shortint_public_key_zero_encryption_count(
impl ShortintEngine {
pub(crate) fn new_public_key(&mut self, client_key: &ClientKey) -> EngineResult<PublicKey> {
let client_parameters: crate::shortint::ShortintParameterSet = client_key.parameters;
let client_parameters = client_key.parameters;
let (secret_encryption_key, encryption_noise) =
match client_parameters.encryption_key_choice().into() {

View File

@@ -15,7 +15,7 @@ use crate::shortint::engine::ShortintEngine;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CompactPublicKey {
pub key: LweCompactPublicKeyOwned<u64>,
pub(crate) key: LweCompactPublicKeyOwned<u64>,
pub parameters: ShortintParameterSet,
pub pbs_order: PBSOrder,
}