Skip to content

Commit

Permalink
Move incorrect number of commitments check to part2 in the DKG
Browse files Browse the repository at this point in the history
  • Loading branch information
natalieesk committed Jan 17, 2024
1 parent db48fa2 commit 227dc3a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frost-core/src/keys/dkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ pub fn part2<C: Ciphersuite>(
return Err(Error::IncorrectNumberOfPackages);
}

for package in round1_packages.values() {
if package.commitment.0.len() != secret_package.min_signers as usize {
return Err(Error::IncorrectNumberOfCommitments);
}
}

let mut round2_packages = BTreeMap::new();

for (sender_identifier, round1_package) in round1_packages {
Expand Down Expand Up @@ -506,10 +512,6 @@ pub fn part3<C: Ciphersuite>(
commitment: commitment.clone(),
};

if secret_share.commitment.0.len() != round2_secret_package.min_signers {
return Err(Error::IncorrectNumberOfCommitments);
}

// Verify the share. We don't need the result.
let _ = secret_share.verify()?;

Expand Down

0 comments on commit 227dc3a

Please sign in to comment.