Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update no small factor protocol to match cggmp24 version #1

Open
wants to merge 1 commit into
base: m
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions src/no_small_factor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ pub struct Commitment {
pub b: Integer,
#[udigest(as = crate::common::encoding::Integer)]
pub t: Integer,
#[udigest(as = crate::common::encoding::Integer)]
pub sigma: Integer,
}

/// Verifier's challenge to prover. Can be obtained deterministically by
Expand Down Expand Up @@ -198,7 +196,6 @@ pub mod interactive {
let beta = Integer::from_rng_pm(&n_root_modulo, &mut rng);
let mu = Integer::from_rng_pm(&l_n_circ_modulo, &mut rng);
let nu = Integer::from_rng_pm(&l_n_circ_modulo, &mut rng);
let sigma = Integer::from_rng_pm(&(&two_to_l * &n_n_circ).complete(), &mut rng);
let r = Integer::from_rng_pm(&(&two_to_l_plus_e * &n_n_circ).complete(), &mut rng);
let x = Integer::from_rng_pm(&l_e_n_circ_modulo, &mut rng);
let y = Integer::from_rng_pm(&l_e_n_circ_modulo, &mut rng);
Expand All @@ -215,7 +212,6 @@ pub mod interactive {
a,
b,
t,
sigma,
};
let private_commitment = PrivateCommitment {
alpha,
Expand All @@ -239,18 +235,17 @@ pub mod interactive {
/// Compute proof for given data and prior protocol values
pub fn prove(
pdata: PrivateData,
comm: &Commitment,
pcomm: &PrivateCommitment,
challenge: &Challenge,
) -> Result<Proof, Error> {
let sigma_circ = (&comm.sigma - &pcomm.nu * pdata.p).complete();
let nu_p = (&pcomm.nu * pdata.p).complete();

Ok(Proof {
z1: (&pcomm.alpha + challenge * pdata.p).complete(),
z2: (&pcomm.beta + challenge * pdata.q).complete(),
w1: (&pcomm.x + challenge * &pcomm.mu).complete(),
w2: (&pcomm.y + challenge * &pcomm.nu).complete(),
v: &pcomm.r + challenge * sigma_circ,
v: &pcomm.r - challenge * nu_p,
})
}

Expand Down Expand Up @@ -279,7 +274,7 @@ pub mod interactive {
}
// check 3
{
let r = aux.combine(data.n, &commitment.sigma)?;
let r = aux.pow_mod(&aux.s, &data.n)?;
let q_to_z1 = aux.pow_mod(&commitment.q, &proof.z1)?;
let t_to_v = aux.pow_mod(&aux.t, &proof.v)?;
let lhs = (q_to_z1 * t_to_v).modulo(&aux.rsa_modulo);
Expand Down Expand Up @@ -328,7 +323,7 @@ pub mod non_interactive {
) -> Result<Proof, Error> {
let (commitment, pcomm) = super::interactive::commit(aux, data, pdata, security, rng)?;
let challenge = challenge::<D>(shared_state, aux, data, &commitment, security);
let proof = super::interactive::prove(pdata, &commitment, &pcomm, &challenge)?;
let proof = super::interactive::prove(pdata, &pcomm, &challenge)?;
Ok(Proof { commitment, proof })
}

Expand Down