Skip to content
Snippets Groups Projects
Unverified Commit 566d149a authored by Nicolas Pouillard's avatar Nicolas Pouillard
Browse files

Additionally check for the length of the array of proofs

parent da246171
No related branches found
No related tags found
No related merge requests found
...@@ -547,6 +547,10 @@ class EGCiphertext: ...@@ -547,6 +547,10 @@ class EGCiphertext:
overall_challenge is what all of the challenges combined should yield. overall_challenge is what all of the challenges combined should yield.
""" """
if len(plaintexts) != len(proof.proofs):
print("bad number of proofs (expected %s, found %s)" % (len(plaintexts), len(proof.proofs)))
return False
for i in range(len(plaintexts)): for i in range(len(plaintexts)):
# if a proof fails, stop right there # if a proof fails, stop right there
if not self.verify_encryption_proof(plaintexts[i], proof.proofs[i]): if not self.verify_encryption_proof(plaintexts[i], proof.proofs[i]):
......
...@@ -409,6 +409,10 @@ class Ciphertext: ...@@ -409,6 +409,10 @@ class Ciphertext:
overall_challenge is what all of the challenges combined should yield. overall_challenge is what all of the challenges combined should yield.
""" """
if len(plaintexts) != len(proof.proofs):
print("bad number of proofs (expected %s, found %s)" % (len(plaintexts), len(proof.proofs)))
return False
for i in range(len(plaintexts)): for i in range(len(plaintexts)):
# if a proof fails, stop right there # if a proof fails, stop right there
if not self.verify_encryption_proof(plaintexts[i], proof.proofs[i]): if not self.verify_encryption_proof(plaintexts[i], proof.proofs[i]):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment