Skip to content

Commit

Permalink
fix(core): fix compact pke with single lwe
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarlin-zama committed Nov 14, 2024
1 parent 5a664aa commit 1e341f4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tfhe/src/core_crypto/algorithms/lwe_encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1986,9 +1986,7 @@ where
encryption_generator
.fill_slice_with_random_noise_from_distribution(&mut mask_noise, mask_noise_distribution);

let body_noise = vec![Scalar::ZERO; 1];
encryption_generator
.fill_slice_with_random_noise_from_distribution(&mut mask_noise, body_noise_distribution);
let body_noise = encryption_generator.random_noise_from_distribution(body_noise_distribution);

{
let (mut ct_mask, ct_body) = output.get_mut_mask_and_body();
Expand All @@ -2008,15 +2006,15 @@ where
{
*ct_body.data = slice_wrapping_dot_product(pk_body.as_ref(), &binary_random_vector);
// Noise from Chi_2 for the body part of the encryption
*ct_body.data = (*ct_body.data).wrapping_add(body_noise[0]);
*ct_body.data = (*ct_body.data).wrapping_add(body_noise);
*ct_body.data = (*ct_body.data).wrapping_add(encoded.0);
}
}

CompactPublicKeyRandomVectors {
binary_random_vector,
mask_noise,
body_noise,
body_noise: vec![body_noise],
}
}

Expand Down

0 comments on commit 1e341f4

Please sign in to comment.