Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(shortint): add ciphertext_modulus_after_packing_ks to compression… #1851

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions tfhe/src/shortint/list_compression/server_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl ClientKey {
params.packing_ks_base_log,
params.packing_ks_level,
params.packing_ks_key_noise_distribution,
self.parameters.ciphertext_modulus(),
params.ciphertext_modulus_after_packing_ks,
&mut engine.encryption_generator,
)
});
Expand Down Expand Up @@ -120,6 +120,7 @@ pub struct CompressionConformanceParameters {
pub storage_log_modulus: CiphertextModulusLog,
pub uncompressed_polynomial_size: PolynomialSize,
pub uncompressed_glwe_dimension: GlweDimension,
pub ciphertext_modulus_after_packing_ks: CiphertextModulus<u64>,
pub cipherext_modulus: CiphertextModulus<u64>,
}

Expand All @@ -137,6 +138,8 @@ impl From<(PBSParameters, CompressionParameters)> for CompressionConformancePara
uncompressed_polynomial_size: pbs_params.polynomial_size(),
uncompressed_glwe_dimension: pbs_params.glwe_dimension(),
cipherext_modulus: pbs_params.ciphertext_modulus(),
ciphertext_modulus_after_packing_ks: compression_params
.ciphertext_modulus_after_packing_ks,
}
}
}
Expand All @@ -159,7 +162,7 @@ impl ParameterSetConformant for CompressionKey {
.to_equivalent_lwe_dimension(parameter_set.uncompressed_polynomial_size),
output_glwe_size: parameter_set.packing_ks_glwe_dimension.to_glwe_size(),
output_polynomial_size: parameter_set.packing_ks_polynomial_size,
ciphertext_modulus: parameter_set.cipherext_modulus,
ciphertext_modulus: parameter_set.ciphertext_modulus_after_packing_ks,
};

packing_key_switching_key.is_conformant(&params)
Expand Down
3 changes: 3 additions & 0 deletions tfhe/src/shortint/parameters/list_compression.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use tfhe_versionable::Versionize;

use super::CiphertextModulus;
use crate::core_crypto::prelude::{CiphertextModulusLog, LweCiphertextCount};
use crate::shortint::backward_compatibility::parameters::list_compression::CompressionParametersVersions;
use crate::shortint::parameters::{
Expand All @@ -20,6 +21,7 @@ pub struct CompressionParameters {
pub lwe_per_glwe: LweCiphertextCount,
pub storage_log_modulus: CiphertextModulusLog,
pub packing_ks_key_noise_distribution: DynamicDistribution<u64>,
pub ciphertext_modulus_after_packing_ks: CiphertextModulus,
}

pub const COMP_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64: CompressionParameters =
Expand All @@ -33,4 +35,5 @@ pub const COMP_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64: CompressionParamete
lwe_per_glwe: LweCiphertextCount(256),
storage_log_modulus: CiphertextModulusLog(12),
packing_ks_key_noise_distribution: DynamicDistribution::new_t_uniform(42),
ciphertext_modulus_after_packing_ks: CiphertextModulus::new_native(),
};
Loading