Skip to content

Commit

Permalink
fix after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec committed Jan 23, 2023
1 parent 0370bd9 commit 208c55e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 34 deletions.
4 changes: 2 additions & 2 deletions tpke/benches/tpke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub fn bench_create_decryption_share(c: &mut Criterion) {
}
};
let simple_precomputed = {
let setup = SetupSimple::new(shares_num, rng);
let setup = SetupSimple::new(shares_num, MSG_SIZE_CASES[0], rng);
move || {
black_box(
setup
Expand Down Expand Up @@ -274,7 +274,7 @@ pub fn bench_share_combine(c: &mut Criterion) {
}
};
let simple_precomputed = {
let setup = SetupSimple::new(shares_num, rng);
let setup = SetupSimple::new(shares_num, MSG_SIZE_CASES[0], rng);

let decryption_shares: Vec<_> = setup
.contexts
Expand Down
32 changes: 0 additions & 32 deletions tpke/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,38 +390,6 @@ mod tests {
let msg: &[u8] = "abc".as_bytes();
let aad: &[u8] = "my-aad".as_bytes();

let (pubkey, _privkey, contexts) =
setup_fast::<E>(threshold, shares_num, &mut rng);
let ciphertext = encrypt::<_, E>(msg, aad, &pubkey, rng);

let mut shares: Vec<DecryptionShareFast<E>> = vec![];
for context in contexts.iter() {
shares.push(context.create_share(&ciphertext));
}

/*for pub_context in contexts[0].public_decryption_contexts.iter() {
assert!(pub_context
.blinded_key_shares
.verify_blinding(&pub_context.public_key_shares, rng));
}*/
let prepared_blinded_key_shares = prepare_combine_fast(
&contexts[0].public_decryption_contexts,
&shares,
);
let shared_secret =
share_combine_fast(&shares, &prepared_blinded_key_shares);

test_ciphertext_validation_fails(msg, aad, &ciphertext, &shared_secret);
}

#[test]
fn fast_threshold_encryption() {
let mut rng = &mut test_rng();
let threshold = 16 * 2 / 3;
let shares_num = 16;
let msg: &[u8] = "abc".as_bytes();
let aad: &[u8] = "my-aad".as_bytes();

let (pubkey, _, contexts) =
setup_fast::<E>(threshold, shares_num, &mut rng);
let ciphertext = encrypt::<_, E>(msg, aad, &pubkey, rng);
Expand Down

0 comments on commit 208c55e

Please sign in to comment.