From 07a1d7227ebf499cec649594a3f10f393b9e83eb Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bossuat Date: Tue, 15 Jul 2025 20:16:38 +0200 Subject: [PATCH] More fixes --- core/src/glwe/external_product.rs | 24 ++++++++++++------------ core/src/glwe/test_fft64/encryption.rs | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core/src/glwe/external_product.rs b/core/src/glwe/external_product.rs index e765b85..a95c5ac 100644 --- a/core/src/glwe/external_product.rs +++ b/core/src/glwe/external_product.rs @@ -2,7 +2,7 @@ use backend::{ FFT64, MatZnxDftOps, MatZnxDftScratch, Module, Scratch, VecZnxBig, VecZnxBigOps, VecZnxDftAlloc, VecZnxDftOps, VecZnxScratch, }; -use crate::{FourierGLWECiphertext, GGSWCiphertext, GLWECiphertext, Infos}; +use crate::{GGSWCiphertext, GLWECiphertext, Infos}; impl GLWECiphertext> { pub fn external_product_scratch_space( @@ -14,21 +14,21 @@ impl GLWECiphertext> { digits: usize, rank: usize, ) -> usize { - let res_dft: usize = FourierGLWECiphertext::bytes_of(module, basek, k_ggsw, rank); let in_size: usize = k_in.div_ceil(basek).div_ceil(digits); let out_size: usize = k_out.div_ceil(basek); let ggsw_size: usize = k_ggsw.div_ceil(basek); - let vmp: usize = module.bytes_of_vec_znx_dft(rank + 1, ggsw_size) - + module.vmp_apply_tmp_bytes( - out_size, - in_size, - in_size, // rows - rank + 1, // cols in - rank + 1, // cols out - ggsw_size, - ); + let res_dft: usize = module.bytes_of_vec_znx_dft(rank + 1, ggsw_size); + let a_dft: usize = module.bytes_of_vec_znx_dft(rank + 1, in_size); + let vmp: usize = module.vmp_apply_tmp_bytes( + out_size, + in_size, + in_size, // rows + rank + 1, // cols in + rank + 1, // cols out + ggsw_size, + ); let normalize: usize = module.vec_znx_normalize_tmp_bytes(); - res_dft + (vmp | normalize) + res_dft + a_dft + (vmp | normalize) } pub fn external_product_inplace_scratch_space( diff --git a/core/src/glwe/test_fft64/encryption.rs b/core/src/glwe/test_fft64/encryption.rs index 55cd5a9..7909cb3 100644 --- a/core/src/glwe/test_fft64/encryption.rs +++ b/core/src/glwe/test_fft64/encryption.rs @@ -111,7 +111,7 @@ fn test_encrypt_pk(log_n: usize, basek: usize, k_ct: usize, k_pk: usize, sigma: let module: Module = Module::::new(1 << log_n); let mut ct: GLWECiphertext> = GLWECiphertext::alloc(&module, basek, k_ct, rank); - let mut pt_have = GLWEPlaintext::alloc(&module, basek, k_ct); + let mut pt_have: GLWEPlaintext> = GLWEPlaintext::alloc(&module, basek, k_ct); let mut pt_want: GLWEPlaintext> = GLWEPlaintext::alloc(&module, basek, k_ct); let mut source_xs: Source = Source::new([0u8; 32]);