conversions tests

This commit is contained in:
Pro7ech
2025-10-20 17:20:34 +02:00
parent 1e2478852e
commit d4c936e04c
9 changed files with 99 additions and 125 deletions

View File

@@ -17,7 +17,7 @@ impl GLWEToLWESwitchingKey<Vec<u8>> {
pub fn encrypt_sk_tmp_bytes<M, A, BE: Backend>(module: &M, infos: &A) -> usize
where
A: GGLWEInfos,
M: GLWEToLWESwitchingKeyEncrypt<BE>,
M: GLWEToLWESwitchingKeyEncryptSk<BE>,
{
module.glwe_to_lwe_switching_key_encrypt_sk_tmp_bytes(infos)
}
@@ -33,7 +33,7 @@ impl<D: DataMut> GLWEToLWESwitchingKey<D> {
source_xe: &mut Source,
scratch: &mut Scratch<BE>,
) where
M: GLWEToLWESwitchingKeyEncrypt<BE>,
M: GLWEToLWESwitchingKeyEncryptSk<BE>,
S1: LWESecretToRef,
S2: GLWESecretToRef,
Scratch<BE>: ScratchTakeCore<BE>,
@@ -42,7 +42,7 @@ impl<D: DataMut> GLWEToLWESwitchingKey<D> {
}
}
pub trait GLWEToLWESwitchingKeyEncrypt<BE: Backend> {
pub trait GLWEToLWESwitchingKeyEncryptSk<BE: Backend> {
fn glwe_to_lwe_switching_key_encrypt_sk_tmp_bytes<A>(&self, infos: &A) -> usize
where
A: GGLWEInfos;
@@ -61,7 +61,7 @@ pub trait GLWEToLWESwitchingKeyEncrypt<BE: Backend> {
R: GGLWEToMut;
}
impl<BE: Backend> GLWEToLWESwitchingKeyEncrypt<BE> for Module<BE>
impl<BE: Backend> GLWEToLWESwitchingKeyEncryptSk<BE> for Module<BE>
where
Self: ModuleN
+ GGLWEEncryptSk<BE>

View File

@@ -16,7 +16,7 @@ impl LWEToGLWESwitchingKey<Vec<u8>> {
pub fn encrypt_sk_tmp_bytes<M, A, BE: Backend>(module: &M, infos: &A) -> usize
where
A: GGLWEInfos,
M: LWEToGLWESwitchingKeyEncrypt<BE>,
M: LWEToGLWESwitchingKeyEncryptSk<BE>,
{
module.lwe_to_glwe_switching_key_encrypt_sk_tmp_bytes(infos)
}
@@ -34,14 +34,14 @@ impl<D: DataMut> LWEToGLWESwitchingKey<D> {
) where
S1: LWESecretToRef,
S2: GLWESecretPreparedToRef<BE>,
M: LWEToGLWESwitchingKeyEncrypt<BE>,
M: LWEToGLWESwitchingKeyEncryptSk<BE>,
Scratch<BE>: ScratchTakeCore<BE>,
{
module.lwe_to_glwe_switching_key_encrypt_sk(self, sk_lwe, sk_glwe, source_xa, source_xe, scratch);
}
}
pub trait LWEToGLWESwitchingKeyEncrypt<BE: Backend> {
pub trait LWEToGLWESwitchingKeyEncryptSk<BE: Backend> {
fn lwe_to_glwe_switching_key_encrypt_sk_tmp_bytes<A>(&self, infos: &A) -> usize
where
A: GGLWEInfos;
@@ -60,7 +60,7 @@ pub trait LWEToGLWESwitchingKeyEncrypt<BE: Backend> {
R: GGLWEToMut;
}
impl<BE: Backend> LWEToGLWESwitchingKeyEncrypt<BE> for Module<BE>
impl<BE: Backend> LWEToGLWESwitchingKeyEncryptSk<BE> for Module<BE>
where
Self: ModuleN
+ GGLWEEncryptSk<BE>