3.3.3 Add an assert if polynomial is called with 0

This will only be called with 0 if the code fails to do proper screening of its
arguments. If such a flaw is present, the DKG lib is critically broken (as this
function isn't public). If it was allowed to continue executing, it'd reveal
the secret share.
This commit is contained in:
Luke Parker 2023-02-23 04:56:05 -05:00
parent 8bee62609c
commit 87dea5e455
No known key found for this signature in database

View file

@ -151,6 +151,7 @@ impl<C: Ciphersuite> KeyGenMachine<C> {
}
fn polynomial<F: PrimeField + Zeroize>(coefficients: &[Zeroizing<F>], l: u16) -> Zeroizing<F> {
assert!(l != 0, "attempting to evaluate a polynomial with 0");
let l = F::from(u64::from(l));
let mut share = Zeroizing::new(F::zero());
for (idx, coefficient) in coefficients.iter().rev().enumerate() {