Skip to content

Commit

Permalink
fix(shortint): use proper noise value during compact list encryption
Browse files Browse the repository at this point in the history
  • Loading branch information
IceTDrinker committed Feb 28, 2024
1 parent 5b65386 commit e9c19b4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tfhe/src/shortint/public_key/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ impl CompactPublicKey {
self.parameters.ciphertext_modulus(),
);

let encryption_noise = match self.pbs_order {
crate::shortint::PBSOrder::KeyswitchBootstrap => self.parameters.glwe_modular_std_dev(),
crate::shortint::PBSOrder::BootstrapKeyswitch => self.parameters.lwe_modular_std_dev(),
};

// No parallelism allowed
#[cfg(all(feature = "__wasm_api", not(feature = "parallel-wasm-api")))]
{
Expand All @@ -220,8 +225,8 @@ impl CompactPublicKey {
&self.key,
&mut ct_list,
&plaintext_list,
self.parameters.glwe_modular_std_dev(),
self.parameters.lwe_modular_std_dev(),
encryption_noise,
encryption_noise,
&mut engine.secret_generator,
&mut engine.encryption_generator,
);
Expand All @@ -237,8 +242,8 @@ impl CompactPublicKey {
&self.key,
&mut ct_list,
&plaintext_list,
self.parameters.glwe_modular_std_dev(),
self.parameters.lwe_modular_std_dev(),
encryption_noise,
encryption_noise,
&mut engine.secret_generator,
&mut engine.encryption_generator,
);
Expand Down

0 comments on commit e9c19b4

Please sign in to comment.