3.4.a Panic if generators.len() != scalars.len() for MultiDLEqProof

This commit is contained in:
Luke Parker 2023-02-28 00:00:29 -05:00
parent 969a5d94f2
commit c1435a2045
No known key found for this signature in database

View file

@ -215,6 +215,7 @@ pub struct MultiDLEqProof<G: PrimeGroup> {
impl<G: PrimeGroup> MultiDLEqProof<G> {
/// Prove for each scalar that the series of points created by multiplying it against its
/// matching generators share a discrete logarithm.
/// This function panics if `generators.len() != scalars.len()`.
pub fn prove<R: RngCore + CryptoRng, T: Transcript>(
rng: &mut R,
transcript: &mut T,
@ -224,6 +225,12 @@ impl<G: PrimeGroup> MultiDLEqProof<G> {
where
G::Scalar: Zeroize,
{
assert_eq!(
generators.len(),
scalars.len(),
"amount of series of generators doesn't match the amount of scalars"
);
transcript.domain_separate(b"multi_dleq");
let mut nonces = vec![];