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 208c55e commit 2b298af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
4 changes: 2 additions & 2 deletions tpke/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ impl<E: PairingEngine> PrivateDecryptionContextFast<E> {
decryption_share,
}
}

pub fn batch_verify_decryption_shares<R: RngCore>(
&self,
ciphertexts: &[Ciphertext<E>],
shares: &[Vec<DecryptionShareFast<E>>],
//ciphertexts_and_shares: &[(Ciphertext<E>, Vec<DecryptionShare<E>>)],
rng: &mut R,
) -> bool {
let num_ciphertexts = ciphertexts.len();
Expand Down Expand Up @@ -149,7 +149,7 @@ impl<E: PairingEngine> PrivateDecryptionContextSimple<E> {
let u = ciphertext.commitment;
let u_to_lagrange_coeff = u.mul(lagrange_coeff.into_repr());
let z_i = self.private_key_share.clone();
let z_i = z_i.private_key_shares[0];
let z_i = z_i.private_key_share;
// $C_{λ_i}=e(U_{λ_i},Z_i)$, where $U_{λ_i} = [λ_{i}(0)]U$$
let c_i = E::pairing(u_to_lagrange_coeff, z_i);
DecryptionShareSimplePrecomputed {
Expand Down
26 changes: 6 additions & 20 deletions tpke/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,23 +264,6 @@ pub fn setup_simple<E: PairingEngine>(
(pubkey.into(), privkey.into(), private_contexts)
}

pub fn generate_random<R: RngCore, E: PairingEngine>(
n: usize,
rng: &mut R,
) -> Vec<E::Fr> {
(0..n).map(|_| E::Fr::rand(rng)).collect::<Vec<_>>()
}

fn make_decryption_share<E: PairingEngine>(
private_share: &PrivateKeyShare<E>,
ciphertext: &Ciphertext<E>,
) -> E::Fqk {
let z_i = private_share;
let u = ciphertext.commitment;
let z_i = z_i.private_key_shares[0];
E::pairing(u, z_i)
}

#[cfg(test)]
mod tests {
use crate::*;
Expand Down Expand Up @@ -460,9 +443,12 @@ mod tests {

let ciphertext = encrypt::<_, E>(msg, aad, &pubkey, rng);

let lagrange_coeffs = prepare_combine_simple::<E>(
&contexts[0].public_decryption_contexts,
);
let domain = contexts[0]
.public_decryption_contexts
.iter()
.map(|c| c.domain)
.collect::<Vec<_>>();
let lagrange_coeffs = prepare_combine_simple::<E>(&domain);

let decryption_shares: Vec<_> = contexts
.iter()
Expand Down

0 comments on commit 2b298af

Please sign in to comment.