From c1435a20455b0469526f534354aa3f0ac7209d83 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Tue, 28 Feb 2023 00:00:29 -0500 Subject: [PATCH] 3.4.a Panic if generators.len() != scalars.len() for MultiDLEqProof --- crypto/dleq/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crypto/dleq/src/lib.rs b/crypto/dleq/src/lib.rs index 1936d5aa..71b9cb4b 100644 --- a/crypto/dleq/src/lib.rs +++ b/crypto/dleq/src/lib.rs @@ -215,6 +215,7 @@ pub struct MultiDLEqProof { impl MultiDLEqProof { /// 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( rng: &mut R, transcript: &mut T, @@ -224,6 +225,12 @@ impl MultiDLEqProof { 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![];