diff --git a/.changelog/5914.trivial.md b/.changelog/5914.trivial.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/secret-sharing/src/churp/dealer.rs b/secret-sharing/src/churp/dealer.rs index aab3b9130d0..abe188b841a 100644 --- a/secret-sharing/src/churp/dealer.rs +++ b/secret-sharing/src/churp/dealer.rs @@ -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::::random(deg_x, deg_y, rng); let i = deg_x as usize; @@ -154,6 +154,8 @@ where return Ok(bp); } + + Err(Error::PolynomialGenerationFailed.into()) } } diff --git a/secret-sharing/src/churp/errors.rs b/secret-sharing/src/churp/errors.rs index 6e4d4a9aa07..e362472bcc2 100644 --- a/secret-sharing/src/churp/errors.rs +++ b/secret-sharing/src/churp/errors.rs @@ -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")]