Skip to content

Commit

Permalink
Update KeyRefresh
Browse files Browse the repository at this point in the history
  • Loading branch information
fjarri committed Dec 31, 2024
1 parent 9f0022f commit 0ca10d8
Show file tree
Hide file tree
Showing 4 changed files with 419 additions and 450 deletions.
13 changes: 1 addition & 12 deletions synedrion/src/cggmp21/aux_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,6 @@ impl<P: SchemeParams, I: PartyId + Serialize> Round<I> for Round3<P, I> {
(
id,
PublicAuxInfo {
el_gamal_pk: data.data.cap_y,
paillier_pk: data.paillier_pk.into_wire(),
rp_params: data.rp_params.to_wire(),
},
Expand All @@ -612,7 +611,6 @@ impl<P: SchemeParams, I: PartyId + Serialize> Round<I> for Round3<P, I> {

let secret_aux = SecretAuxInfo {
paillier_sk: self.context.paillier_sk.into_wire(),
el_gamal_sk: self.context.y,
};

let aux_info = AuxInfo {
Expand Down Expand Up @@ -654,18 +652,9 @@ mod tests {
})
.collect::<Vec<_>>();

let aux_infos = run_sync::<_, TestSessionParams<BinaryFormat>>(&mut OsRng, entry_points)
let _aux_infos = run_sync::<_, TestSessionParams<BinaryFormat>>(&mut OsRng, entry_points)
.unwrap()
.results()
.unwrap();

for (id, aux_info) in aux_infos.iter() {
for other_aux_info in aux_infos.values() {
assert_eq!(
aux_info.secret_aux.el_gamal_sk.mul_by_generator(),
other_aux_info.public_aux[id].el_gamal_pk
);
}
}
}
}
10 changes: 0 additions & 10 deletions synedrion/src/cggmp21/entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ pub struct AuxInfo<P: SchemeParams, I: Ord> {
#[serde(bound(deserialize = "SecretKeyPaillierWire<P::Paillier>: for <'x> Deserialize<'x>"))]
pub(crate) struct SecretAuxInfo<P: SchemeParams> {
pub(crate) paillier_sk: SecretKeyPaillierWire<P::Paillier>,
pub(crate) el_gamal_sk: Secret<Scalar>, // `y_i`
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(bound(serialize = "PublicKeyPaillierWire<P::Paillier>: Serialize"))]
#[serde(bound(deserialize = "PublicKeyPaillierWire<P::Paillier>: for <'x> Deserialize<'x>"))]
pub(crate) struct PublicAuxInfo<P: SchemeParams> {
pub(crate) el_gamal_pk: Point, // `Y_i`
/// The Paillier public key.
pub(crate) paillier_pk: PublicKeyPaillierWire<P::Paillier>,
/// The ring-Pedersen parameters.
Expand All @@ -68,14 +66,10 @@ pub(crate) struct AuxInfoPrecomputed<P: SchemeParams, I> {
#[derive(Debug, Clone)]
pub(crate) struct SecretAuxInfoPrecomputed<P: SchemeParams> {
pub(crate) paillier_sk: SecretKeyPaillier<P::Paillier>,
#[allow(dead_code)] // TODO (#36): this will be needed for the 6-round presigning protocol.
pub(crate) el_gamal_sk: Secret<Scalar>, // `y_i`
}

#[derive(Debug, Clone)]
pub(crate) struct PublicAuxInfoPrecomputed<P: SchemeParams> {
#[allow(dead_code)] // TODO (#36): this will be needed for the 6-round presigning protocol.
pub(crate) el_gamal_pk: Point,
pub(crate) paillier_pk: PublicKeyPaillier<P::Paillier>,
pub(crate) rp_params: RPParams<P::Paillier>,
}
Expand Down Expand Up @@ -259,7 +253,6 @@ impl<P: SchemeParams, I: Ord + Clone> AuxInfo<P, I> {
let secret_aux = (0..ids.len())
.map(|_| SecretAuxInfo {
paillier_sk: SecretKeyPaillierWire::<P::Paillier>::random(rng),
el_gamal_sk: Secret::init_with(|| Scalar::random(rng)),
})
.collect::<Vec<_>>();

Expand All @@ -271,7 +264,6 @@ impl<P: SchemeParams, I: Ord + Clone> AuxInfo<P, I> {
id.clone(),
PublicAuxInfo {
paillier_pk: secret.paillier_sk.public_key(),
el_gamal_pk: secret.el_gamal_sk.mul_by_generator(),
rp_params: RPParams::random(rng).to_wire(),
},
)
Expand All @@ -297,7 +289,6 @@ impl<P: SchemeParams, I: Ord + Clone> AuxInfo<P, I> {
AuxInfoPrecomputed {
secret_aux: SecretAuxInfoPrecomputed {
paillier_sk: self.secret_aux.paillier_sk.clone().into_precomputed(),
el_gamal_sk: self.secret_aux.el_gamal_sk.clone(),
},
public_aux: self
.public_aux
Expand All @@ -307,7 +298,6 @@ impl<P: SchemeParams, I: Ord + Clone> AuxInfo<P, I> {
(
id.clone(),
PublicAuxInfoPrecomputed {
el_gamal_pk: public_aux.el_gamal_pk,
paillier_pk: paillier_pk.clone(),
rp_params: public_aux.rp_params.to_precomputed(),
},
Expand Down
Loading

0 comments on commit 0ca10d8

Please sign in to comment.