Skip to content

Commit

Permalink
comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
hridambasu committed Sep 20, 2023
1 parent 2c4aea9 commit e68cdfd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
27 changes: 13 additions & 14 deletions src/auxinfo/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,28 +188,27 @@ impl AuxInfoProof {
mod tests {
use super::*;
use crate::{paillier::prime_gen, protocol::SharedContext, utils::testing::init_testing};
use rand::Rng;
use rand::{Rng, rngs::StdRng};

fn random_auxinfo_proof<R: RngCore + CryptoRng>(
_rng: &mut R,
rng: &mut StdRng,
test_code: impl FnOnce(CommonInput, AuxInfoProof) -> Result<()>,
) -> Result<()> {
let mut rng = init_testing();
let sid = Identifier::random(&mut rng);
//let mut rng = init_testing();
let sid = Identifier::random(rng);
let rho = rng.gen();
let setup_params = VerifiedRingPedersen::gen(&mut rng, &()).unwrap();
let (p, q) = prime_gen::get_prime_pair_from_pool_insecure(&mut rng).unwrap();
let setup_params = VerifiedRingPedersen::gen(rng, &()).unwrap();
let (p, q) = prime_gen::get_prime_pair_from_pool_insecure(rng).unwrap();
let modulus = &p * &q;
let shared_context = SharedContext::random(&mut rng);
let shared_context = SharedContext::random(rng);
let common_input = CommonInput::new(&shared_context, sid, rho, &setup_params, &modulus);
let proof = AuxInfoProof::prove(
&mut rng.clone(),
rng,
&common_input.clone(),
&p.clone(),
&q.clone(),
&p,
&q,
)
.unwrap();
//(Ok(proof.clone()), Ok(common_input.clone()))
test_code(common_input, proof)
}

Expand All @@ -224,7 +223,6 @@ mod tests {
let shared_context = SharedContext::random(&mut rng);
let common_input = CommonInput::new(&shared_context, sid, rho, &setup_params, &modulus);
let proof = AuxInfoProof::prove(&mut rng, &common_input, &p, &q)?;
let common_input = CommonInput::new(&shared_context, sid, rho, &setup_params, &modulus);
assert!(proof.verify(&common_input).is_ok());
Ok(())
}
Expand All @@ -247,11 +245,12 @@ mod tests {
assert!(mix_two.verify(&input1).is_err());
Ok(())
};
let _ = random_auxinfo_proof(&mut rng_clone, f1);
random_auxinfo_proof(&mut rng_clone, f1);
Ok(())
};
let _ = random_auxinfo_proof(&mut rng, f);
random_auxinfo_proof(&mut rng, f);
Ok(())

}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub(crate) const CRYPTOGRAPHIC_RETRY_MAX: usize = 500usize;
/// private type, `Debug` should be manually implemented with the field of this
/// type explicitly redacted!
#[derive(Eq, PartialEq, Debug, Clone, Copy, Zeroize)]
pub(crate) struct CurvePoint(pub k256::ProjectivePoint);
pub(crate) struct CurvePoint(k256::ProjectivePoint);

impl AsRef<CurvePoint> for CurvePoint {
fn as_ref(&self) -> &CurvePoint {
Expand Down

0 comments on commit e68cdfd

Please sign in to comment.