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

merge queue: embarking main (09206ae) and #506 together #515

Closed
wants to merge 2 commits into from
Closed
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
44 changes: 44 additions & 0 deletions frost-core/src/tests/ciphersuite_generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,13 @@ where
// for each signature before being aggregated.
let mut pubkey_packages_by_participant = HashMap::new();

check_part3_different_participants(
max_signers,
round2_secret_packages.clone(),
received_round1_packages.clone(),
received_round2_packages.clone(),
);

// For each participant, perform the third part of the DKG protocol.
// In practice, each participant will perform this on their own environments.
for participant_index in 1..=max_signers {
Expand Down Expand Up @@ -457,6 +464,43 @@ where
check_sign(min_signers, key_packages, rng, pubkeys)
}

/// Check that calling dkg::part3() with distinct sets of participants fail.
fn check_part3_different_participants<C: Ciphersuite>(
max_signers: u16,
round2_secret_packages: HashMap<Identifier<C>, frost::keys::dkg::round2::SecretPackage<C>>,
received_round1_packages: HashMap<
Identifier<C>,
HashMap<Identifier<C>, frost::keys::dkg::round1::Package<C>>,
>,
received_round2_packages: HashMap<
Identifier<C>,
HashMap<Identifier<C>, frost::keys::dkg::round2::Package<C>>,
>,
) {
// For each participant, perform the third part of the DKG protocol.
// In practice, each participant will perform this on their own environments.
for participant_index in 1..=max_signers {
let participant_identifier = participant_index.try_into().expect("should be nonzero");

// Remove the first package from the map, and reinsert it with an unrelated
// Do the same for Round 2 packages
let mut received_round2_packages =
received_round2_packages[&participant_identifier].clone();
let package = received_round2_packages
.remove(&received_round2_packages.keys().next().unwrap().clone())
.unwrap();
received_round2_packages.insert(42u16.try_into().unwrap(), package);

let r = frost::keys::dkg::part3(
&round2_secret_packages[&participant_identifier],
&received_round1_packages[&participant_identifier],
&received_round2_packages,
)
.expect_err("Should have failed due to different identifier sets");
assert_eq!(r, Error::IncorrectPackage)
}
}

/// Test FROST signing with trusted dealer with a Ciphersuite, using specified
/// Identifiers.
pub fn check_sign_with_dealer_and_identifiers<C: Ciphersuite, R: RngCore + CryptoRng>(
Expand Down
Loading