prototype of borrowing tmp structs & working gadget product with stacked rows

This commit is contained in:
Jean-Philippe Bossuat
2025-02-14 20:51:49 +01:00
parent e7a6ba17ee
commit fdc2f3ac42
11 changed files with 400 additions and 182 deletions

View File

@@ -1,11 +1,13 @@
use crate::{
ciphertext::{Ciphertext, GadgetCiphertext},
elem::Elem,
ciphertext::Ciphertext,
elem::{Elem, ElemBasics},
keys::SecretKey,
parameters::Parameters,
plaintext::Plaintext,
};
use base2k::{Module, SvpPPol, SvpPPolOps, VecZnxDft};
use base2k::{
Infos, VecZnx, Module, SvpPPol, SvpPPolOps, VecZnxApi, VecZnxBigOps, VecZnxDft, VecZnxDftOps,
};
use std::cmp::min;
pub struct Decryptor {
@@ -34,7 +36,7 @@ impl Parameters {
pub fn decrypt_rlwe_thread_safe(
&self,
res: &mut Plaintext,
res: &mut Plaintext<VecZnx>,
ct: &Ciphertext,
sk: &SvpPPol,
tmp_bytes: &mut [u8],
@@ -43,13 +45,15 @@ impl Parameters {
}
}
pub fn decrypt_rlwe_thread_safe(
pub fn decrypt_rlwe_thread_safe<T>(
module: &Module,
res: &mut Elem,
a: &Elem,
res: &mut Elem<T>,
a: &Elem<T>,
sk: &SvpPPol,
tmp_bytes: &mut [u8],
) {
) where
T: VecZnxApi + Infos,
{
assert!(
tmp_bytes.len() >= decrypt_rlwe_thread_safe_tmp_byte(module, a.limbs()),
"invalid tmp_bytes: tmp_bytes.len()={} < decrypt_rlwe_thread_safe_tmp_byte={}",