File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ pub enum ProofError {
2121 /// proof with non-power-of-two aggregation size.
2222 #[ fail( display = "Invalid aggregation size, m must be a power of 2" ) ]
2323 InvalidAggregation ,
24+ /// This error occurs when the generators are of the wrong length.
25+ #[ fail( display = "Invalid generators length, must be equal to n." ) ]
26+ InvalidGeneratorsLength ,
2427 /// This error results from an internal error during proving.
2528 ///
2629 /// The single-party prover is implemented by performing
Original file line number Diff line number Diff line change @@ -78,6 +78,12 @@ impl RangeProof {
7878 if values. len ( ) != blindings. len ( ) {
7979 return Err ( ProofError :: WrongNumBlindingFactors ) ;
8080 }
81+ if generators. n != n {
82+ return Err ( ProofError :: InvalidGeneratorsLength ) ;
83+ }
84+ if !( n == 8 || n == 16 || n == 32 || n == 64 ) {
85+ return Err ( ProofError :: InvalidBitsize ) ;
86+ }
8187
8288 let dealer = Dealer :: new ( generators, n, values. len ( ) , transcript) ?;
8389
@@ -145,6 +151,12 @@ impl RangeProof {
145151 ) -> Result < ( ) , ProofError > {
146152 // First, replay the "interactive" protocol using the proof
147153 // data to recompute all challenges.
154+ if gens. n != n {
155+ return Err ( ProofError :: InvalidGeneratorsLength ) ;
156+ }
157+ if !( n == 8 || n == 16 || n == 32 || n == 64 ) {
158+ return Err ( ProofError :: InvalidBitsize ) ;
159+ }
148160
149161 let m = value_commitments. len ( ) ;
150162
You can’t perform that action at this time.
0 commit comments