changeset 1558:91f2daeb15a5

BeDOZa: Zero-knowledge proof now returns True or False.
author Thomas P Jakobsen <tpj@cs.au.dk>
date Tue, 28 Sep 2010 14:45:31 +0200
parents cc989536bad7
children 18b3699be9db
files viff/bedoza/zero_knowledge.py viff/test/bedoza/test_zero_knowledge.py
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/viff/bedoza/zero_knowledge.py	Tue Sep 28 14:33:35 2010 +0200
+++ b/viff/bedoza/zero_knowledge.py	Tue Sep 28 14:45:31 2010 +0200
@@ -101,9 +101,15 @@
             #print self.runtime.id, j, S[j] % n**2
             #print self.runtime.id, j, T[j]
             # TODO: Return false if S[j] != T[j].
+            if S[j] != T[j]:
+                # TODO: Proof failed, return false!
+                pass
             if abs(self.Z[j]) > 2**(2 * self.k):
-                print "WOOOOOOOOOOPS, PROOF NOT ACCEPTED"
+                # TODO: Proof failed, return false!
+                pass
 
+        return True
+        
 
     def _generate_u_v_and_d(self):
         self.u, self.v, self.d = [], [], []
--- a/viff/test/bedoza/test_zero_knowledge.py	Tue Sep 28 14:33:35 2010 +0200
+++ b/viff/test/bedoza/test_zero_knowledge.py	Tue Sep 28 14:45:31 2010 +0200
@@ -172,6 +172,9 @@
             zk = ZKProof(s, prover_id, k, runtime, c, paillier=paillier, random=player_random)
 
         deferred_proof = zk.start()
+        def verify(result):
+            self.assertTrue(result)
+        runtime.schedule_callback(deferred_proof, verify)
         return deferred_proof
 
 # TODO: Test succeeding proof.