mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
compiling CBT but failing tests
This commit is contained in:
@@ -5,11 +5,11 @@ use poulpy_hal::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
AutomorphismKeyEncryptSk, GLWEAutomorphismKeyAutomorphism, GLWEDecrypt, ScratchTakeCore,
|
||||
GLWEAutomorphismKeyAutomorphism, GLWEAutomorphismKeyEncryptSk, GLWEDecrypt, ScratchTakeCore,
|
||||
encryption::SIGMA,
|
||||
layouts::{
|
||||
AutomorphismKey, AutomorphismKeyLayout, GGLWEInfos, GLWEAutomorphismKeyPreparedFactory, GLWEPlaintext, GLWESecret,
|
||||
GLWESecretPreparedFactory,
|
||||
GGLWEInfos, GLWEAutomorphismKey, GLWEAutomorphismKeyLayout, GLWEAutomorphismKeyPreparedFactory, GLWEPlaintext,
|
||||
GLWESecret, GLWESecretPreparedFactory,
|
||||
prepared::{GLWEAutomorphismKeyPrepared, GLWESecretPrepared},
|
||||
},
|
||||
noise::log2_std_noise_gglwe_product,
|
||||
@@ -18,7 +18,7 @@ use crate::{
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn test_gglwe_automorphism_key_automorphism<BE: Backend>(module: &Module<BE>)
|
||||
where
|
||||
Module<BE>: AutomorphismKeyEncryptSk<BE>
|
||||
Module<BE>: GLWEAutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyPreparedFactory<BE>
|
||||
+ GLWEAutomorphismKeyAutomorphism<BE>
|
||||
+ VecZnxAutomorphism
|
||||
@@ -46,7 +46,7 @@ where
|
||||
let dnum_out: usize = k_out / (base2k * di);
|
||||
let dnum_apply: usize = k_in.div_ceil(base2k * di);
|
||||
|
||||
let auto_key_in_infos: AutomorphismKeyLayout = AutomorphismKeyLayout {
|
||||
let auto_key_in_infos: GLWEAutomorphismKeyLayout = GLWEAutomorphismKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_in.into(),
|
||||
@@ -55,7 +55,7 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let auto_key_out_infos: AutomorphismKeyLayout = AutomorphismKeyLayout {
|
||||
let auto_key_out_infos: GLWEAutomorphismKeyLayout = GLWEAutomorphismKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_out.into(),
|
||||
@@ -64,7 +64,7 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let auto_key_apply_infos: AutomorphismKeyLayout = AutomorphismKeyLayout {
|
||||
let auto_key_apply_infos: GLWEAutomorphismKeyLayout = GLWEAutomorphismKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_apply.into(),
|
||||
@@ -73,18 +73,18 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let mut auto_key_in: AutomorphismKey<Vec<u8>> = AutomorphismKey::alloc_from_infos(&auto_key_in_infos);
|
||||
let mut auto_key_out: AutomorphismKey<Vec<u8>> = AutomorphismKey::alloc_from_infos(&auto_key_out_infos);
|
||||
let mut auto_key_apply: AutomorphismKey<Vec<u8>> = AutomorphismKey::alloc_from_infos(&auto_key_apply_infos);
|
||||
let mut auto_key_in: GLWEAutomorphismKey<Vec<u8>> = GLWEAutomorphismKey::alloc_from_infos(&auto_key_in_infos);
|
||||
let mut auto_key_out: GLWEAutomorphismKey<Vec<u8>> = GLWEAutomorphismKey::alloc_from_infos(&auto_key_out_infos);
|
||||
let mut auto_key_apply: GLWEAutomorphismKey<Vec<u8>> = GLWEAutomorphismKey::alloc_from_infos(&auto_key_apply_infos);
|
||||
|
||||
let mut source_xs: Source = Source::new([0u8; 32]);
|
||||
let mut source_xe: Source = Source::new([0u8; 32]);
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(
|
||||
AutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key_in_infos)
|
||||
| AutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key_apply_infos)
|
||||
| AutomorphismKey::automorphism_tmp_bytes(
|
||||
GLWEAutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key_in_infos)
|
||||
| GLWEAutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key_apply_infos)
|
||||
| GLWEAutomorphismKey::automorphism_tmp_bytes(
|
||||
module,
|
||||
&auto_key_out_infos,
|
||||
&auto_key_in_infos,
|
||||
@@ -187,7 +187,7 @@ where
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn test_gglwe_automorphism_key_automorphism_inplace<BE: Backend>(module: &Module<BE>)
|
||||
where
|
||||
Module<BE>: AutomorphismKeyEncryptSk<BE>
|
||||
Module<BE>: GLWEAutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyPreparedFactory<BE>
|
||||
+ GLWEAutomorphismKeyAutomorphism<BE>
|
||||
+ VecZnxAutomorphism
|
||||
@@ -213,7 +213,7 @@ where
|
||||
let dnum_in: usize = k_in / (base2k * di);
|
||||
let dnum_apply: usize = k_in.div_ceil(base2k * di);
|
||||
|
||||
let auto_key_layout: AutomorphismKeyLayout = AutomorphismKeyLayout {
|
||||
let auto_key_layout: GLWEAutomorphismKeyLayout = GLWEAutomorphismKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_in.into(),
|
||||
@@ -222,7 +222,7 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let auto_key_apply_layout: AutomorphismKeyLayout = AutomorphismKeyLayout {
|
||||
let auto_key_apply_layout: GLWEAutomorphismKeyLayout = GLWEAutomorphismKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_apply.into(),
|
||||
@@ -231,17 +231,17 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let mut auto_key: AutomorphismKey<Vec<u8>> = AutomorphismKey::alloc_from_infos(&auto_key_layout);
|
||||
let mut auto_key_apply: AutomorphismKey<Vec<u8>> = AutomorphismKey::alloc_from_infos(&auto_key_apply_layout);
|
||||
let mut auto_key: GLWEAutomorphismKey<Vec<u8>> = GLWEAutomorphismKey::alloc_from_infos(&auto_key_layout);
|
||||
let mut auto_key_apply: GLWEAutomorphismKey<Vec<u8>> = GLWEAutomorphismKey::alloc_from_infos(&auto_key_apply_layout);
|
||||
|
||||
let mut source_xs: Source = Source::new([0u8; 32]);
|
||||
let mut source_xe: Source = Source::new([0u8; 32]);
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(
|
||||
AutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key)
|
||||
| AutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key_apply)
|
||||
| AutomorphismKey::automorphism_tmp_bytes(module, &auto_key, &auto_key, &auto_key_apply),
|
||||
GLWEAutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key)
|
||||
| GLWEAutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key_apply)
|
||||
| GLWEAutomorphismKey::automorphism_tmp_bytes(module, &auto_key, &auto_key, &auto_key_apply),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&auto_key);
|
||||
|
||||
@@ -5,12 +5,12 @@ use poulpy_hal::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
AutomorphismKeyEncryptSk, GGSWAutomorphism, GGSWEncryptSk, GGSWNoise, ScratchTakeCore, TensorKeyEncryptSk,
|
||||
GGSWAutomorphism, GGSWEncryptSk, GGSWNoise, GLWEAutomorphismKeyEncryptSk, GLWETensorKeyEncryptSk, ScratchTakeCore,
|
||||
encryption::SIGMA,
|
||||
layouts::{
|
||||
AutomorphismKey, GGSW, GGSWLayout, GLWEAutomorphismKeyPreparedFactory, GLWESecret, GLWESecretPreparedFactory, TensorKey,
|
||||
TensorKeyLayout, TensorKeyPreparedFactory,
|
||||
prepared::{GLWEAutomorphismKeyPrepared, GLWESecretPrepared, TensorKeyPrepared},
|
||||
GGSW, GGSWLayout, GLWEAutomorphismKey, GLWEAutomorphismKeyPreparedFactory, GLWESecret, GLWESecretPreparedFactory,
|
||||
GLWETensorKey, GLWETensorKeyLayout, GLWETensorKeyPreparedFactory,
|
||||
prepared::{GLWEAutomorphismKeyPrepared, GLWESecretPrepared, GLWETensorKeyPrepared},
|
||||
},
|
||||
noise::noise_ggsw_keyswitch,
|
||||
};
|
||||
@@ -18,11 +18,11 @@ use crate::{
|
||||
pub fn test_ggsw_automorphism<BE: Backend>(module: &Module<BE>)
|
||||
where
|
||||
Module<BE>: GGSWEncryptSk<BE>
|
||||
+ AutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyPreparedFactory<BE>
|
||||
+ GGSWAutomorphism<BE>
|
||||
+ TensorKeyPreparedFactory<BE>
|
||||
+ TensorKeyEncryptSk<BE>
|
||||
+ GLWETensorKeyPreparedFactory<BE>
|
||||
+ GLWETensorKeyEncryptSk<BE>
|
||||
+ GLWESecretPreparedFactory<BE>
|
||||
+ VecZnxAutomorphismInplace<BE>
|
||||
+ GGSWNoise<BE>,
|
||||
@@ -64,7 +64,7 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let tensor_key_layout: TensorKeyLayout = TensorKeyLayout {
|
||||
let tensor_key_layout: GLWETensorKeyLayout = GLWETensorKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_tsk.into(),
|
||||
@@ -73,7 +73,7 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let auto_key_layout: TensorKeyLayout = TensorKeyLayout {
|
||||
let auto_key_layout: GLWETensorKeyLayout = GLWETensorKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_ksk.into(),
|
||||
@@ -84,8 +84,8 @@ where
|
||||
|
||||
let mut ct_in: GGSW<Vec<u8>> = GGSW::alloc_from_infos(&ggsw_in_layout);
|
||||
let mut ct_out: GGSW<Vec<u8>> = GGSW::alloc_from_infos(&ggsw_out_layout);
|
||||
let mut tensor_key: TensorKey<Vec<u8>> = TensorKey::alloc_from_infos(&tensor_key_layout);
|
||||
let mut auto_key: AutomorphismKey<Vec<u8>> = AutomorphismKey::alloc_from_infos(&auto_key_layout);
|
||||
let mut tensor_key: GLWETensorKey<Vec<u8>> = GLWETensorKey::alloc_from_infos(&tensor_key_layout);
|
||||
let mut auto_key: GLWEAutomorphismKey<Vec<u8>> = GLWEAutomorphismKey::alloc_from_infos(&auto_key_layout);
|
||||
let mut pt_scalar: ScalarZnx<Vec<u8>> = ScalarZnx::alloc(n, 1);
|
||||
|
||||
let mut source_xs: Source = Source::new([0u8; 32]);
|
||||
@@ -94,8 +94,8 @@ where
|
||||
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(
|
||||
GGSW::encrypt_sk_tmp_bytes(module, &ct_in)
|
||||
| AutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key)
|
||||
| TensorKey::encrypt_sk_tmp_bytes(module, &tensor_key)
|
||||
| GLWEAutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key)
|
||||
| GLWETensorKey::encrypt_sk_tmp_bytes(module, &tensor_key)
|
||||
| GGSW::automorphism_tmp_bytes(module, &ct_out, &ct_in, &auto_key, &tensor_key),
|
||||
);
|
||||
|
||||
@@ -138,8 +138,8 @@ where
|
||||
GLWEAutomorphismKeyPrepared::alloc_from_infos(module, &auto_key_layout);
|
||||
auto_key_prepared.prepare(module, &auto_key, scratch.borrow());
|
||||
|
||||
let mut tsk_prepared: TensorKeyPrepared<Vec<u8>, BE> =
|
||||
TensorKeyPrepared::alloc_from_infos(module, &tensor_key_layout);
|
||||
let mut tsk_prepared: GLWETensorKeyPrepared<Vec<u8>, BE> =
|
||||
GLWETensorKeyPrepared::alloc_from_infos(module, &tensor_key_layout);
|
||||
tsk_prepared.prepare(module, &tensor_key, scratch.borrow());
|
||||
|
||||
ct_out.automorphism(
|
||||
@@ -177,11 +177,11 @@ where
|
||||
pub fn test_ggsw_automorphism_inplace<BE: Backend>(module: &Module<BE>)
|
||||
where
|
||||
Module<BE>: GGSWEncryptSk<BE>
|
||||
+ AutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyPreparedFactory<BE>
|
||||
+ GGSWAutomorphism<BE>
|
||||
+ TensorKeyPreparedFactory<BE>
|
||||
+ TensorKeyEncryptSk<BE>
|
||||
+ GLWETensorKeyPreparedFactory<BE>
|
||||
+ GLWETensorKeyEncryptSk<BE>
|
||||
+ GLWESecretPreparedFactory<BE>
|
||||
+ VecZnxAutomorphismInplace<BE>
|
||||
+ GGSWNoise<BE>,
|
||||
@@ -211,7 +211,7 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let tensor_key_layout: TensorKeyLayout = TensorKeyLayout {
|
||||
let tensor_key_layout: GLWETensorKeyLayout = GLWETensorKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_tsk.into(),
|
||||
@@ -220,7 +220,7 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let auto_key_layout: TensorKeyLayout = TensorKeyLayout {
|
||||
let auto_key_layout: GLWETensorKeyLayout = GLWETensorKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_ksk.into(),
|
||||
@@ -230,8 +230,8 @@ where
|
||||
};
|
||||
|
||||
let mut ct: GGSW<Vec<u8>> = GGSW::alloc_from_infos(&ggsw_out_layout);
|
||||
let mut tensor_key: TensorKey<Vec<u8>> = TensorKey::alloc_from_infos(&tensor_key_layout);
|
||||
let mut auto_key: AutomorphismKey<Vec<u8>> = AutomorphismKey::alloc_from_infos(&auto_key_layout);
|
||||
let mut tensor_key: GLWETensorKey<Vec<u8>> = GLWETensorKey::alloc_from_infos(&tensor_key_layout);
|
||||
let mut auto_key: GLWEAutomorphismKey<Vec<u8>> = GLWEAutomorphismKey::alloc_from_infos(&auto_key_layout);
|
||||
let mut pt_scalar: ScalarZnx<Vec<u8>> = ScalarZnx::alloc(n, 1);
|
||||
|
||||
let mut source_xs: Source = Source::new([0u8; 32]);
|
||||
@@ -240,8 +240,8 @@ where
|
||||
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(
|
||||
GGSW::encrypt_sk_tmp_bytes(module, &ct)
|
||||
| AutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key)
|
||||
| TensorKey::encrypt_sk_tmp_bytes(module, &tensor_key)
|
||||
| GLWEAutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key)
|
||||
| GLWETensorKey::encrypt_sk_tmp_bytes(module, &tensor_key)
|
||||
| GGSW::automorphism_tmp_bytes(module, &ct, &ct, &auto_key, &tensor_key),
|
||||
);
|
||||
|
||||
@@ -284,8 +284,8 @@ where
|
||||
GLWEAutomorphismKeyPrepared::alloc_from_infos(module, &auto_key_layout);
|
||||
auto_key_prepared.prepare(module, &auto_key, scratch.borrow());
|
||||
|
||||
let mut tsk_prepared: TensorKeyPrepared<Vec<u8>, BE> =
|
||||
TensorKeyPrepared::alloc_from_infos(module, &tensor_key_layout);
|
||||
let mut tsk_prepared: GLWETensorKeyPrepared<Vec<u8>, BE> =
|
||||
GLWETensorKeyPrepared::alloc_from_infos(module, &tensor_key_layout);
|
||||
tsk_prepared.prepare(module, &tensor_key, scratch.borrow());
|
||||
|
||||
ct.automorphism_inplace(module, &auto_key_prepared, &tsk_prepared, scratch.borrow());
|
||||
|
||||
@@ -5,11 +5,11 @@ use poulpy_hal::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
AutomorphismKeyEncryptSk, GLWEAutomorphism, GLWEDecrypt, GLWEEncryptSk, GLWENoise, ScratchTakeCore,
|
||||
GLWEAutomorphism, GLWEAutomorphismKeyEncryptSk, GLWEDecrypt, GLWEEncryptSk, GLWENoise, ScratchTakeCore,
|
||||
encryption::SIGMA,
|
||||
layouts::{
|
||||
AutomorphismKey, AutomorphismKeyLayout, GLWE, GLWEAutomorphismKeyPreparedFactory, GLWELayout, GLWEPlaintext, GLWESecret,
|
||||
GLWESecretPreparedFactory,
|
||||
GLWE, GLWEAutomorphismKey, GLWEAutomorphismKeyLayout, GLWEAutomorphismKeyPreparedFactory, GLWELayout, GLWEPlaintext,
|
||||
GLWESecret, GLWESecretPreparedFactory,
|
||||
prepared::{GLWEAutomorphismKeyPrepared, GLWESecretPrepared},
|
||||
},
|
||||
noise::log2_std_noise_gglwe_product,
|
||||
@@ -22,7 +22,7 @@ where
|
||||
+ VecZnxFillUniform
|
||||
+ GLWEDecrypt<BE>
|
||||
+ GLWEAutomorphism<BE>
|
||||
+ AutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyPreparedFactory<BE>
|
||||
+ GLWENoise<BE>
|
||||
+ VecZnxAutomorphismInplace<BE>,
|
||||
@@ -55,7 +55,7 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let autokey_infos: AutomorphismKeyLayout = AutomorphismKeyLayout {
|
||||
let autokey_infos: GLWEAutomorphismKeyLayout = GLWEAutomorphismKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_out.into(),
|
||||
@@ -64,7 +64,7 @@ where
|
||||
dsize: di.into(),
|
||||
};
|
||||
|
||||
let mut autokey: AutomorphismKey<Vec<u8>> = AutomorphismKey::alloc_from_infos(&autokey_infos);
|
||||
let mut autokey: GLWEAutomorphismKey<Vec<u8>> = GLWEAutomorphismKey::alloc_from_infos(&autokey_infos);
|
||||
let mut ct_in: GLWE<Vec<u8>> = GLWE::alloc_from_infos(&ct_in_infos);
|
||||
let mut ct_out: GLWE<Vec<u8>> = GLWE::alloc_from_infos(&ct_out_infos);
|
||||
let mut pt_want: GLWEPlaintext<Vec<u8>> = GLWEPlaintext::alloc_from_infos(&ct_out_infos);
|
||||
@@ -76,7 +76,7 @@ where
|
||||
module.vec_znx_fill_uniform(base2k, &mut pt_want.data, 0, &mut source_xa);
|
||||
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(
|
||||
AutomorphismKey::encrypt_sk_tmp_bytes(module, &autokey)
|
||||
GLWEAutomorphismKey::encrypt_sk_tmp_bytes(module, &autokey)
|
||||
| GLWE::decrypt_tmp_bytes(module, &ct_out)
|
||||
| GLWE::encrypt_sk_tmp_bytes(module, &ct_in)
|
||||
| GLWE::automorphism_tmp_bytes(module, &ct_out, &ct_in, &autokey),
|
||||
@@ -140,7 +140,7 @@ where
|
||||
+ VecZnxFillUniform
|
||||
+ GLWEDecrypt<BE>
|
||||
+ GLWEAutomorphism<BE>
|
||||
+ AutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyPreparedFactory<BE>
|
||||
+ GLWENoise<BE>
|
||||
+ VecZnxAutomorphismInplace<BE>,
|
||||
@@ -165,7 +165,7 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let autokey_infos: AutomorphismKeyLayout = AutomorphismKeyLayout {
|
||||
let autokey_infos: GLWEAutomorphismKeyLayout = GLWEAutomorphismKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_ksk.into(),
|
||||
@@ -174,7 +174,7 @@ where
|
||||
dsize: di.into(),
|
||||
};
|
||||
|
||||
let mut autokey: AutomorphismKey<Vec<u8>> = AutomorphismKey::alloc_from_infos(&autokey_infos);
|
||||
let mut autokey: GLWEAutomorphismKey<Vec<u8>> = GLWEAutomorphismKey::alloc_from_infos(&autokey_infos);
|
||||
let mut ct: GLWE<Vec<u8>> = GLWE::alloc_from_infos(&ct_out_infos);
|
||||
let mut pt_want: GLWEPlaintext<Vec<u8>> = GLWEPlaintext::alloc_from_infos(&ct_out_infos);
|
||||
|
||||
@@ -185,7 +185,7 @@ where
|
||||
module.vec_znx_fill_uniform(base2k, &mut pt_want.data, 0, &mut source_xa);
|
||||
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(
|
||||
AutomorphismKey::encrypt_sk_tmp_bytes(module, &autokey)
|
||||
GLWEAutomorphismKey::encrypt_sk_tmp_bytes(module, &autokey)
|
||||
| GLWE::decrypt_tmp_bytes(module, &ct)
|
||||
| GLWE::encrypt_sk_tmp_bytes(module, &ct)
|
||||
| GLWE::automorphism_tmp_bytes(module, &ct, &ct, &autokey),
|
||||
|
||||
@@ -5,19 +5,20 @@ use poulpy_hal::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
AutomorphismKeyCompressedEncryptSk, AutomorphismKeyEncryptSk, GGLWEKeyswitch, GLWESwitchingKeyCompressedEncryptSk,
|
||||
GGLWEKeyswitch, GLWEAutomorphismKeyCompressedEncryptSk, GLWEAutomorphismKeyEncryptSk, GLWESwitchingKeyCompressedEncryptSk,
|
||||
GLWESwitchingKeyEncryptSk, ScratchTakeCore,
|
||||
encryption::SIGMA,
|
||||
layouts::{
|
||||
AutomorphismKey, AutomorphismKeyDecompress, AutomorphismKeyLayout, GLWEInfos, GLWESecret, GLWESecretPreparedFactory,
|
||||
GLWESwitchingKeyDecompress, compressed::GLWEAutomorphismKeyCompressed, prepared::GLWESecretPrepared,
|
||||
AutomorphismKeyDecompress, GLWEAutomorphismKey, GLWEAutomorphismKeyLayout, GLWEInfos, GLWESecret,
|
||||
GLWESecretPreparedFactory, GLWESwitchingKeyDecompress, compressed::GLWEAutomorphismKeyCompressed,
|
||||
prepared::GLWESecretPrepared,
|
||||
},
|
||||
noise::GGLWENoise,
|
||||
};
|
||||
|
||||
pub fn test_gglwe_automorphism_key_encrypt_sk<BE: Backend>(module: &Module<BE>)
|
||||
where
|
||||
Module<BE>: AutomorphismKeyEncryptSk<BE>
|
||||
Module<BE>: GLWEAutomorphismKeyEncryptSk<BE>
|
||||
+ GGLWEKeyswitch<BE>
|
||||
+ GLWESecretPreparedFactory<BE>
|
||||
+ GLWESwitchingKeyEncryptSk<BE>
|
||||
@@ -37,7 +38,7 @@ where
|
||||
let n: usize = module.n();
|
||||
let dnum: usize = (k_ksk - di * base2k) / (di * base2k);
|
||||
|
||||
let atk_infos: AutomorphismKeyLayout = AutomorphismKeyLayout {
|
||||
let atk_infos: GLWEAutomorphismKeyLayout = GLWEAutomorphismKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_ksk.into(),
|
||||
@@ -46,13 +47,15 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let mut atk: AutomorphismKey<Vec<u8>> = AutomorphismKey::alloc_from_infos(&atk_infos);
|
||||
let mut atk: GLWEAutomorphismKey<Vec<u8>> = GLWEAutomorphismKey::alloc_from_infos(&atk_infos);
|
||||
|
||||
let mut source_xs: Source = Source::new([0u8; 32]);
|
||||
let mut source_xe: Source = Source::new([0u8; 32]);
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(AutomorphismKey::encrypt_sk_tmp_bytes(module, &atk_infos));
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(GLWEAutomorphismKey::encrypt_sk_tmp_bytes(
|
||||
module, &atk_infos,
|
||||
));
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&atk_infos);
|
||||
sk.fill_ternary_prob(0.5, &mut source_xs);
|
||||
@@ -89,7 +92,7 @@ where
|
||||
|
||||
pub fn test_gglwe_automorphism_key_compressed_encrypt_sk<BE: Backend>(module: &Module<BE>)
|
||||
where
|
||||
Module<BE>: AutomorphismKeyCompressedEncryptSk<BE>
|
||||
Module<BE>: GLWEAutomorphismKeyCompressedEncryptSk<BE>
|
||||
+ GGLWEKeyswitch<BE>
|
||||
+ GLWESecretPreparedFactory<BE>
|
||||
+ GLWESwitchingKeyEncryptSk<BE>
|
||||
@@ -109,7 +112,7 @@ where
|
||||
let n: usize = module.n();
|
||||
let dnum: usize = (k_ksk - di * base2k) / (di * base2k);
|
||||
|
||||
let atk_infos: AutomorphismKeyLayout = AutomorphismKeyLayout {
|
||||
let atk_infos: GLWEAutomorphismKeyLayout = GLWEAutomorphismKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_ksk.into(),
|
||||
@@ -150,7 +153,7 @@ where
|
||||
let mut sk_out_prepared: GLWESecretPrepared<Vec<u8>, BE> = GLWESecretPrepared::alloc(module, sk_out.rank().into());
|
||||
sk_out_prepared.prepare(module, &sk_out);
|
||||
|
||||
let mut atk: AutomorphismKey<Vec<u8>> = AutomorphismKey::alloc_from_infos(&atk_infos);
|
||||
let mut atk: GLWEAutomorphismKey<Vec<u8>> = GLWEAutomorphismKey::alloc_from_infos(&atk_infos);
|
||||
atk.decompress(module, &atk_compressed);
|
||||
|
||||
atk.key
|
||||
|
||||
@@ -9,18 +9,18 @@ use poulpy_hal::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
GGLWETensorKeyCompressedEncryptSk, ScratchTakeCore, TensorKeyEncryptSk,
|
||||
GLWETensorKeyCompressedEncryptSk, GLWETensorKeyEncryptSk, ScratchTakeCore,
|
||||
decryption::GLWEDecrypt,
|
||||
encryption::SIGMA,
|
||||
layouts::{
|
||||
Dsize, GLWEPlaintext, GLWESecret, GLWESecretPreparedFactory, GLWETensorKeyCompressed, TensorKey, TensorKeyLayout,
|
||||
Dsize, GLWEPlaintext, GLWESecret, GLWESecretPreparedFactory, GLWETensorKey, GLWETensorKeyCompressed, GLWETensorKeyLayout,
|
||||
prepared::GLWESecretPrepared,
|
||||
},
|
||||
};
|
||||
|
||||
pub fn test_gglwe_tensor_key_encrypt_sk<BE: Backend>(module: &Module<BE>)
|
||||
where
|
||||
Module<BE>: TensorKeyEncryptSk<BE>
|
||||
Module<BE>: GLWETensorKeyEncryptSk<BE>
|
||||
+ GLWESecretPreparedFactory<BE>
|
||||
+ GLWEDecrypt<BE>
|
||||
+ VecZnxDftAlloc<BE>
|
||||
@@ -40,7 +40,7 @@ where
|
||||
let n: usize = module.n();
|
||||
let dnum: usize = k / base2k;
|
||||
|
||||
let tensor_key_infos = TensorKeyLayout {
|
||||
let tensor_key_infos = GLWETensorKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k.into(),
|
||||
@@ -49,13 +49,16 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let mut tensor_key: TensorKey<Vec<u8>> = TensorKey::alloc_from_infos(&tensor_key_infos);
|
||||
let mut tensor_key: GLWETensorKey<Vec<u8>> = GLWETensorKey::alloc_from_infos(&tensor_key_infos);
|
||||
|
||||
let mut source_xs: Source = Source::new([0u8; 32]);
|
||||
let mut source_xe: Source = Source::new([0u8; 32]);
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(TensorKey::encrypt_sk_tmp_bytes(module, &tensor_key_infos));
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(GLWETensorKey::encrypt_sk_tmp_bytes(
|
||||
module,
|
||||
&tensor_key_infos,
|
||||
));
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&tensor_key_infos);
|
||||
sk.fill_ternary_prob(0.5, &mut source_xs);
|
||||
@@ -111,9 +114,9 @@ where
|
||||
|
||||
pub fn test_gglwe_tensor_key_compressed_encrypt_sk<BE: Backend>(module: &Module<BE>)
|
||||
where
|
||||
Module<BE>: TensorKeyEncryptSk<BE>
|
||||
Module<BE>: GLWETensorKeyEncryptSk<BE>
|
||||
+ GLWESecretPreparedFactory<BE>
|
||||
+ GGLWETensorKeyCompressedEncryptSk<BE>
|
||||
+ GLWETensorKeyCompressedEncryptSk<BE>
|
||||
+ GLWEDecrypt<BE>
|
||||
+ VecZnxDftAlloc<BE>
|
||||
+ VecZnxBigAlloc<BE>
|
||||
@@ -133,7 +136,7 @@ where
|
||||
let n: usize = module.n();
|
||||
let dnum: usize = k / base2k;
|
||||
|
||||
let tensor_key_infos: TensorKeyLayout = TensorKeyLayout {
|
||||
let tensor_key_infos: GLWETensorKeyLayout = GLWETensorKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k.into(),
|
||||
@@ -162,7 +165,7 @@ where
|
||||
|
||||
tensor_key_compressed.encrypt_sk(module, &sk, seed_xa, &mut source_xe, scratch.borrow());
|
||||
|
||||
let mut tensor_key: TensorKey<Vec<u8>> = TensorKey::alloc_from_infos(&tensor_key_infos);
|
||||
let mut tensor_key: GLWETensorKey<Vec<u8>> = GLWETensorKey::alloc_from_infos(&tensor_key_infos);
|
||||
tensor_key.decompress(module, &tensor_key_compressed);
|
||||
|
||||
let mut pt: GLWEPlaintext<Vec<u8>> = GLWEPlaintext::alloc_from_infos(&tensor_key_infos);
|
||||
|
||||
@@ -5,12 +5,12 @@ use poulpy_hal::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
GGSWEncryptSk, GGSWKeyswitch, GGSWNoise, GLWESwitchingKeyEncryptSk, ScratchTakeCore, TensorKeyEncryptSk,
|
||||
GGSWEncryptSk, GGSWKeyswitch, GGSWNoise, GLWESwitchingKeyEncryptSk, GLWETensorKeyEncryptSk, ScratchTakeCore,
|
||||
encryption::SIGMA,
|
||||
layouts::{
|
||||
GGSW, GGSWLayout, GLWESecret, GLWESecretPreparedFactory, GLWESwitchingKey, GLWESwitchingKeyLayout,
|
||||
GLWESwitchingKeyPreparedFactory, TensorKey, TensorKeyLayout, TensorKeyPreparedFactory,
|
||||
prepared::{GLWESecretPrepared, GLWESwitchingKeyPrepared, TensorKeyPrepared},
|
||||
GLWESwitchingKeyPreparedFactory, GLWETensorKey, GLWETensorKeyLayout, GLWETensorKeyPreparedFactory,
|
||||
prepared::{GLWESecretPrepared, GLWESwitchingKeyPrepared, GLWETensorKeyPrepared},
|
||||
},
|
||||
noise::noise_ggsw_keyswitch,
|
||||
};
|
||||
@@ -20,10 +20,10 @@ pub fn test_ggsw_keyswitch<BE: Backend>(module: &Module<BE>)
|
||||
where
|
||||
Module<BE>: GGSWEncryptSk<BE>
|
||||
+ GLWESwitchingKeyEncryptSk<BE>
|
||||
+ TensorKeyEncryptSk<BE>
|
||||
+ GLWETensorKeyEncryptSk<BE>
|
||||
+ GGSWKeyswitch<BE>
|
||||
+ GLWESecretPreparedFactory<BE>
|
||||
+ TensorKeyPreparedFactory<BE>
|
||||
+ GLWETensorKeyPreparedFactory<BE>
|
||||
+ GLWESwitchingKeyPreparedFactory<BE>
|
||||
+ GGSWNoise<BE>,
|
||||
ScratchOwned<BE>: ScratchOwnedAlloc<BE> + ScratchOwnedBorrow<BE>,
|
||||
@@ -61,7 +61,7 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let tsk_infos: TensorKeyLayout = TensorKeyLayout {
|
||||
let tsk_infos: GLWETensorKeyLayout = GLWETensorKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_tsk.into(),
|
||||
@@ -82,7 +82,7 @@ where
|
||||
|
||||
let mut ggsw_in: GGSW<Vec<u8>> = GGSW::alloc_from_infos(&ggsw_in_infos);
|
||||
let mut ggsw_out: GGSW<Vec<u8>> = GGSW::alloc_from_infos(&ggsw_out_infos);
|
||||
let mut tsk: TensorKey<Vec<u8>> = TensorKey::alloc_from_infos(&tsk_infos);
|
||||
let mut tsk: GLWETensorKey<Vec<u8>> = GLWETensorKey::alloc_from_infos(&tsk_infos);
|
||||
let mut ksk: GLWESwitchingKey<Vec<u8>> = GLWESwitchingKey::alloc_from_infos(&ksk_apply_infos);
|
||||
let mut pt_scalar: ScalarZnx<Vec<u8>> = ScalarZnx::alloc(n, 1);
|
||||
|
||||
@@ -93,7 +93,7 @@ where
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(
|
||||
GGSW::encrypt_sk_tmp_bytes(module, &ggsw_in_infos)
|
||||
| GLWESwitchingKey::encrypt_sk_tmp_bytes(module, &ksk_apply_infos)
|
||||
| TensorKey::encrypt_sk_tmp_bytes(module, &tsk_infos)
|
||||
| GLWETensorKey::encrypt_sk_tmp_bytes(module, &tsk_infos)
|
||||
| GGSW::keyswitch_tmp_bytes(
|
||||
module,
|
||||
&ggsw_out_infos,
|
||||
@@ -148,7 +148,7 @@ where
|
||||
GLWESwitchingKeyPrepared::alloc_from_infos(module, &ksk);
|
||||
ksk_prepared.prepare(module, &ksk, scratch.borrow());
|
||||
|
||||
let mut tsk_prepared: TensorKeyPrepared<Vec<u8>, BE> = TensorKeyPrepared::alloc_from_infos(module, &tsk);
|
||||
let mut tsk_prepared: GLWETensorKeyPrepared<Vec<u8>, BE> = GLWETensorKeyPrepared::alloc_from_infos(module, &tsk);
|
||||
tsk_prepared.prepare(module, &tsk, scratch.borrow());
|
||||
|
||||
ggsw_out.keyswitch(
|
||||
@@ -185,10 +185,10 @@ pub fn test_ggsw_keyswitch_inplace<BE: Backend>(module: &Module<BE>)
|
||||
where
|
||||
Module<BE>: GGSWEncryptSk<BE>
|
||||
+ GLWESwitchingKeyEncryptSk<BE>
|
||||
+ TensorKeyEncryptSk<BE>
|
||||
+ GLWETensorKeyEncryptSk<BE>
|
||||
+ GGSWKeyswitch<BE>
|
||||
+ GLWESecretPreparedFactory<BE>
|
||||
+ TensorKeyPreparedFactory<BE>
|
||||
+ GLWETensorKeyPreparedFactory<BE>
|
||||
+ GLWESwitchingKeyPreparedFactory<BE>
|
||||
+ GGSWNoise<BE>,
|
||||
ScratchOwned<BE>: ScratchOwnedAlloc<BE> + ScratchOwnedBorrow<BE>,
|
||||
@@ -216,7 +216,7 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let tsk_infos: TensorKeyLayout = TensorKeyLayout {
|
||||
let tsk_infos: GLWETensorKeyLayout = GLWETensorKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_tsk.into(),
|
||||
@@ -236,7 +236,7 @@ where
|
||||
};
|
||||
|
||||
let mut ggsw_out: GGSW<Vec<u8>> = GGSW::alloc_from_infos(&ggsw_out_infos);
|
||||
let mut tsk: TensorKey<Vec<u8>> = TensorKey::alloc_from_infos(&tsk_infos);
|
||||
let mut tsk: GLWETensorKey<Vec<u8>> = GLWETensorKey::alloc_from_infos(&tsk_infos);
|
||||
let mut ksk: GLWESwitchingKey<Vec<u8>> = GLWESwitchingKey::alloc_from_infos(&ksk_apply_infos);
|
||||
let mut pt_scalar: ScalarZnx<Vec<u8>> = ScalarZnx::alloc(n, 1);
|
||||
|
||||
@@ -247,7 +247,7 @@ where
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(
|
||||
GGSW::encrypt_sk_tmp_bytes(module, &ggsw_out_infos)
|
||||
| GLWESwitchingKey::encrypt_sk_tmp_bytes(module, &ksk_apply_infos)
|
||||
| TensorKey::encrypt_sk_tmp_bytes(module, &tsk_infos)
|
||||
| GLWETensorKey::encrypt_sk_tmp_bytes(module, &tsk_infos)
|
||||
| GGSW::keyswitch_tmp_bytes(
|
||||
module,
|
||||
&ggsw_out_infos,
|
||||
@@ -302,7 +302,7 @@ where
|
||||
GLWESwitchingKeyPrepared::alloc_from_infos(module, &ksk);
|
||||
ksk_prepared.prepare(module, &ksk, scratch.borrow());
|
||||
|
||||
let mut tsk_prepared: TensorKeyPrepared<Vec<u8>, BE> = TensorKeyPrepared::alloc_from_infos(module, &tsk);
|
||||
let mut tsk_prepared: GLWETensorKeyPrepared<Vec<u8>, BE> = GLWETensorKeyPrepared::alloc_from_infos(module, &tsk);
|
||||
tsk_prepared.prepare(module, &tsk, scratch.borrow());
|
||||
|
||||
ggsw_out.keyswitch_inplace(module, &ksk_prepared, &tsk_prepared, scratch.borrow());
|
||||
|
||||
@@ -7,10 +7,10 @@ use poulpy_hal::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
AutomorphismKeyEncryptSk, GLWEDecrypt, GLWEEncryptSk, GLWEPacker, GLWEPacking, GLWERotate, GLWESub, ScratchTakeCore,
|
||||
GLWEAutomorphismKeyEncryptSk, GLWEDecrypt, GLWEEncryptSk, GLWEPacker, GLWEPacking, GLWERotate, GLWESub, ScratchTakeCore,
|
||||
layouts::{
|
||||
AutomorphismKey, AutomorphismKeyLayout, GLWE, GLWEAutomorphismKeyPreparedFactory, GLWELayout, GLWEPlaintext, GLWESecret,
|
||||
GLWESecretPreparedFactory,
|
||||
GLWE, GLWEAutomorphismKey, GLWEAutomorphismKeyLayout, GLWEAutomorphismKeyPreparedFactory, GLWELayout, GLWEPlaintext,
|
||||
GLWESecret, GLWESecretPreparedFactory,
|
||||
prepared::{GLWEAutomorphismKeyPrepared, GLWESecretPrepared},
|
||||
},
|
||||
};
|
||||
@@ -18,7 +18,7 @@ use crate::{
|
||||
pub fn test_glwe_packing<BE: Backend>(module: &Module<BE>)
|
||||
where
|
||||
Module<BE>: GLWEEncryptSk<BE>
|
||||
+ AutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyPreparedFactory<BE>
|
||||
+ GLWEPacking<BE>
|
||||
+ GLWESecretPreparedFactory<BE>
|
||||
@@ -49,7 +49,7 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let key_infos: AutomorphismKeyLayout = AutomorphismKeyLayout {
|
||||
let key_infos: GLWEAutomorphismKeyLayout = GLWEAutomorphismKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_ksk.into(),
|
||||
@@ -60,7 +60,7 @@ where
|
||||
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(
|
||||
GLWE::encrypt_sk_tmp_bytes(module, &glwe_out_infos)
|
||||
| AutomorphismKey::encrypt_sk_tmp_bytes(module, &key_infos)
|
||||
| GLWEAutomorphismKey::encrypt_sk_tmp_bytes(module, &key_infos)
|
||||
| GLWEPacker::tmp_bytes(module, &glwe_out_infos, &key_infos),
|
||||
);
|
||||
|
||||
@@ -81,7 +81,7 @@ where
|
||||
let gal_els: Vec<i64> = GLWEPacker::galois_elements(module);
|
||||
|
||||
let mut auto_keys: HashMap<i64, GLWEAutomorphismKeyPrepared<Vec<u8>, BE>> = HashMap::new();
|
||||
let mut tmp: AutomorphismKey<Vec<u8>> = AutomorphismKey::alloc_from_infos(&key_infos);
|
||||
let mut tmp: GLWEAutomorphismKey<Vec<u8>> = GLWEAutomorphismKey::alloc_from_infos(&key_infos);
|
||||
gal_els.iter().for_each(|gal_el| {
|
||||
tmp.encrypt_sk(
|
||||
module,
|
||||
|
||||
@@ -7,12 +7,12 @@ use poulpy_hal::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
AutomorphismKeyEncryptSk, GLWEDecrypt, GLWEEncryptSk, ScratchTakeCore,
|
||||
GLWEAutomorphismKeyEncryptSk, GLWEDecrypt, GLWEEncryptSk, ScratchTakeCore,
|
||||
encryption::SIGMA,
|
||||
glwe_trace::GLWETrace,
|
||||
layouts::{
|
||||
AutomorphismKey, AutomorphismKeyLayout, GLWE, GLWEAutomorphismKeyPreparedFactory, GLWELayout, GLWEPlaintext, GLWESecret,
|
||||
GLWESecretPreparedFactory, LWEInfos,
|
||||
GLWE, GLWEAutomorphismKey, GLWEAutomorphismKeyLayout, GLWEAutomorphismKeyPreparedFactory, GLWELayout, GLWEPlaintext,
|
||||
GLWESecret, GLWESecretPreparedFactory, LWEInfos,
|
||||
prepared::{GLWEAutomorphismKeyPrepared, GLWESecretPrepared},
|
||||
},
|
||||
noise::var_noise_gglwe_product,
|
||||
@@ -23,7 +23,7 @@ where
|
||||
Module<BE>: GLWETrace<BE>
|
||||
+ GLWEEncryptSk<BE>
|
||||
+ GLWEDecrypt<BE>
|
||||
+ AutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyEncryptSk<BE>
|
||||
+ GLWEAutomorphismKeyPreparedFactory<BE>
|
||||
+ VecZnxFillUniform
|
||||
+ GLWESecretPreparedFactory<BE>
|
||||
@@ -49,7 +49,7 @@ where
|
||||
rank: rank.into(),
|
||||
};
|
||||
|
||||
let key_infos: AutomorphismKeyLayout = AutomorphismKeyLayout {
|
||||
let key_infos: GLWEAutomorphismKeyLayout = GLWEAutomorphismKeyLayout {
|
||||
n: n.into(),
|
||||
base2k: base2k.into(),
|
||||
k: k_autokey.into(),
|
||||
@@ -69,7 +69,7 @@ where
|
||||
let mut scratch: ScratchOwned<BE> = ScratchOwned::alloc(
|
||||
GLWE::encrypt_sk_tmp_bytes(module, &glwe_out_infos)
|
||||
| GLWE::decrypt_tmp_bytes(module, &glwe_out_infos)
|
||||
| AutomorphismKey::encrypt_sk_tmp_bytes(module, &key_infos)
|
||||
| GLWEAutomorphismKey::encrypt_sk_tmp_bytes(module, &key_infos)
|
||||
| GLWE::trace_tmp_bytes(module, &glwe_out_infos, &glwe_out_infos, &key_infos),
|
||||
);
|
||||
|
||||
@@ -98,7 +98,7 @@ where
|
||||
|
||||
let mut auto_keys: HashMap<i64, GLWEAutomorphismKeyPrepared<Vec<u8>, BE>> = HashMap::new();
|
||||
let gal_els: Vec<i64> = GLWE::trace_galois_elements(module);
|
||||
let mut tmp: AutomorphismKey<Vec<u8>> = AutomorphismKey::alloc_from_infos(&key_infos);
|
||||
let mut tmp: GLWEAutomorphismKey<Vec<u8>> = GLWEAutomorphismKey::alloc_from_infos(&key_infos);
|
||||
gal_els.iter().for_each(|gal_el| {
|
||||
tmp.encrypt_sk(
|
||||
module,
|
||||
|
||||
Reference in New Issue
Block a user