From 618758bd954204c3535df67eb1714cd787a496bb Mon Sep 17 00:00:00 2001 From: Arthur Meyre Date: Thu, 22 Feb 2024 15:20:28 +0100 Subject: [PATCH] fix(core): fix unsigned noise addition for custom modulus --- tfhe/src/core_crypto/commons/math/random/generator.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tfhe/src/core_crypto/commons/math/random/generator.rs b/tfhe/src/core_crypto/commons/math/random/generator.rs index ba15e9f58b..61d39acf11 100644 --- a/tfhe/src/core_crypto/commons/math/random/generator.rs +++ b/tfhe/src/core_crypto/commons/math/random/generator.rs @@ -665,10 +665,10 @@ impl RandomGenerator { custom_modulus_as_scalar, ); if let Some(elem) = s.get_mut(0) { - *elem = (*elem).wrapping_add(g1); + *elem = (*elem).wrapping_add_custom_mod(g1, custom_modulus_as_scalar); } if let Some(elem) = s.get_mut(1) { - *elem = (*elem).wrapping_add(g2); + *elem = (*elem).wrapping_add_custom_mod(g2, custom_modulus_as_scalar); } }); }