Skip to content

Commit dbe7ee1

Browse files
committed
update for ggh15 plt evaluator
1 parent 2f03191 commit dbe7ee1

8 files changed

Lines changed: 281 additions & 384 deletions

Cargo.lock

Lines changed: 39 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
config_id = "secpar_0_height_1_p_6.params.toml"
2+
target_secpar = 0
3+
crt_depth = 15
4+
crt_bits = 24
5+
ring_dimension = 16
6+
knapsack_size = 46
7+
e_b_sigma = 4.0
8+
trapdoor_sigma = 4.578
9+
base_bits = 8
10+
p_moduli_bits = 6
11+
scale = 256
12+
arith_input_size = 2
13+
arith_height = 1

abe/run_configs/secpar_20_height_1_p_6.params.toml

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
target_secpar = 0
2+
crt_bits = 24
3+
crt_depth_min = 11
4+
crt_depth_max = 15
5+
base_bits_min = 8
6+
base_bits_max = 8
7+
log_dim_min = 4
8+
log_dim_max = 4
9+
p_moduli_bits = 6
10+
scale_bits = 8
11+
height = 1

abe/sim_configs/secpar_20_height_1_p_6.params.toml

Lines changed: 0 additions & 11 deletions
This file was deleted.

abe/src/main.rs

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use mxx::{
1414
matrix::dcrt_poly::DCRTPolyMatrix,
1515
poly::dcrt::params::DCRTPolyParams,
1616
sampler::{
17-
PolyTrapdoorSampler, hash::DCRTPolyHashSampler, trapdoor::DCRTPolyTrapdoorSampler,
17+
hash::DCRTPolyHashSampler, trapdoor::DCRTPolyTrapdoorSampler,
1818
uniform::DCRTPolyUniformSampler,
1919
},
2020
utils::{log_mem, timed_read, timed_read_async},
@@ -203,8 +203,7 @@ async fn run_bench_offline(config: RunConfig, data_dir: PathBuf) -> Result<()> {
203203
config.crt_bits as usize,
204204
config.base_bits,
205205
);
206-
let trapdoor_sampler =
207-
DCRTPolyTrapdoorSampler::new(&params, config.trapdoor_sigma.expect("trapdoor sigma exist"));
206+
let trapdoor_sigma = config.trapdoor_sigma.expect("trapdoor sigma exist");
208207
let abe = KeyPolicyABE::<
209208
DCRTPolyMatrix,
210209
DCRTPolyHashSampler<Keccak256>,
@@ -216,7 +215,7 @@ async fn run_bench_offline(config: RunConfig, data_dir: PathBuf) -> Result<()> {
216215
&params,
217216
config.knapsack_size,
218217
config.e_b_sigma,
219-
trapdoor_sampler,
218+
trapdoor_sigma,
220219
);
221220
let mut t_setup = Duration::ZERO;
222221
let mut t_keygen = Duration::ZERO;
@@ -226,7 +225,7 @@ async fn run_bench_offline(config: RunConfig, data_dir: PathBuf) -> Result<()> {
226225
// 1) setup
227226
log_mem("starting setup");
228227
let (mpk, msk): (MasterPK<DCRTPolyMatrix>, MasterSK<DCRTPolyMatrix, DCRTPolyTrapdoorSampler>) =
229-
timed_read("setup", || abe.setup(params.clone(), config.arith_input_size), &mut t_setup);
228+
timed_read("setup", || abe.setup(&params, config.arith_input_size), &mut t_setup);
230229
log_mem("finished setup");
231230

232231
let dir_path = if data_dir.exists() {
@@ -239,15 +238,7 @@ async fn run_bench_offline(config: RunConfig, data_dir: PathBuf) -> Result<()> {
239238
log_mem("starting keygen");
240239
let fsk: FuncSK<DCRTPolyMatrix> = timed_read_async(
241240
"keygen",
242-
|| {
243-
abe.keygen(
244-
params.clone(),
245-
mpk.clone(),
246-
msk.clone(),
247-
config.arith_height,
248-
dir_path.clone(),
249-
)
250-
},
241+
|| abe.keygen(&params, mpk.clone(), msk.clone(), config.arith_height, dir_path.clone()),
251242
&mut t_keygen,
252243
)
253244
.await;
@@ -268,8 +259,7 @@ async fn run_bench_online(config: RunConfig, data_dir: PathBuf) -> Result<()> {
268259
config.crt_bits as usize,
269260
config.base_bits,
270261
);
271-
let trapdoor_sampler =
272-
DCRTPolyTrapdoorSampler::new(&params, config.trapdoor_sigma.expect("trapdoor sigma exist"));
262+
let trapdoor_sigma = config.trapdoor_sigma.expect("trapdoor sigma exist");
273263
let abe = KeyPolicyABE::<
274264
DCRTPolyMatrix,
275265
DCRTPolyHashSampler<Keccak256>,
@@ -281,7 +271,7 @@ async fn run_bench_online(config: RunConfig, data_dir: PathBuf) -> Result<()> {
281271
&params,
282272
config.knapsack_size,
283273
config.e_b_sigma,
284-
trapdoor_sampler,
274+
trapdoor_sigma,
285275
);
286276
let mut t_read_mpk = Duration::ZERO;
287277
let mut t_enc = Duration::ZERO;
@@ -304,7 +294,7 @@ async fn run_bench_online(config: RunConfig, data_dir: PathBuf) -> Result<()> {
304294
);
305295
let ct: Ciphertext<DCRTPolyMatrix> = timed_read(
306296
"enc",
307-
|| abe.enc(params.clone(), mpk, &vec![BigUint::ZERO; config.arith_input_size], true),
297+
|| abe.enc(&params, mpk, &vec![BigUint::ZERO; config.arith_input_size], true),
308298
&mut t_enc,
309299
);
310300
log_mem("finished enc");
@@ -333,11 +323,8 @@ async fn run_bench_online(config: RunConfig, data_dir: PathBuf) -> Result<()> {
333323
},
334324
&mut t_read_fsk,
335325
);
336-
let bit: bool = timed_read(
337-
"dec",
338-
|| abe.dec(params.clone(), ct, mpk, fsk, config.arith_height),
339-
&mut t_dec,
340-
);
326+
let bit: bool =
327+
timed_read("dec", || abe.dec(&params, ct, mpk, fsk, config.arith_height), &mut t_dec);
341328
log_mem(format!("finished decryption: result={}", bit));
342329
Ok(())
343330
}

0 commit comments

Comments
 (0)