Skip to content

Commit 69ae3df

Browse files
committed
add check that n is a power of two for ipp
1 parent 00374bc commit 69ae3df

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/inner_product_proof.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ impl InnerProductProof {
2828
/// The `verifier` is passed in as a parameter so that the
2929
/// challenges depend on the *entire* transcript (including parent
3030
/// protocols).
31+
///
32+
/// The lengths of the vectors must all be the same, and must all be
33+
/// either 0 or a power of 2.
3134
pub fn create<I>(
3235
verifier: &mut ProofTranscript,
3336
Q: &RistrettoPoint,
@@ -57,6 +60,9 @@ impl InnerProductProof {
5760
assert_eq!(a.len(), n);
5861
assert_eq!(b.len(), n);
5962

63+
// All of the input vectors must have a length that is a power of two.
64+
assert!(n.is_power_of_two());
65+
6066
// XXX save these scalar mults by unrolling them into the
6167
// first iteration of the loop below
6268
for (H_i, h_i) in H.iter_mut().zip(Hprime_factors.into_iter()) {

0 commit comments

Comments
 (0)