Skip to content

Commit

Permalink
secret-sharing/src/churp/dealer: Limit loop for polynomial generation
Browse files Browse the repository at this point in the history
  • Loading branch information
peternose committed Oct 21, 2024
1 parent 73eacc7 commit 30aa3e2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Empty file added .changelog/5914.trivial.md
Empty file.
4 changes: 3 additions & 1 deletion secret-sharing/src/churp/dealer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ where
// should execute once with an extremely high probability,
// so there is no need to optimize it by randomly selecting
// only the problematic coefficients.
loop {
for _ in 0..5 {
let bp = BivariatePolynomial::<G::Scalar>::random(deg_x, deg_y, rng);

let i = deg_x as usize;
Expand All @@ -154,6 +154,8 @@ where

return Ok(bp);
}

Err(Error::PolynomialGenerationFailed.into())
}
}

Expand Down
2 changes: 2 additions & 0 deletions secret-sharing/src/churp/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pub enum Error {
MergingNotFinished,
#[error("polynomial degree mismatch")]
PolynomialDegreeMismatch,
#[error("polynomial generation failed")]
PolynomialGenerationFailed,
#[error("shareholder encoding failed")]
ShareholderEncodingFailed,
#[error("shareholder proactivization already completed")]
Expand Down

0 comments on commit 30aa3e2

Please sign in to comment.