changeset 1477:9b133830f06a

BeDOZa: Added the final broadcast to the open method.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Wed, 07 Jul 2010 16:30:01 +0200
parents 5eed4049d9bb
children 71012e8c4be5
files viff/bedoza.py
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/viff/bedoza.py	Wed Jul 07 16:11:48 2010 +0200
+++ b/viff/bedoza.py	Wed Jul 07 16:30:01 2010 +0200
@@ -231,9 +231,20 @@
                 beta = keys[inx]
                 x += xi
                 mi_prime = self.MAC(alpha, beta, xi)
-                if not (isOK and mi == mi_prime):
-                    raise BeDOZaException("Wrong commitment, expected %s, got %s = %s*%s + %s." % (mi.value, mi_prime.value, alpha.value, xi.value, beta.value))
-            return x
+                isOK = isOK and mi == mi_prime
+
+            def check(ls, x, isOK):
+                true_str = str(True)
+                if reduce(lambda x, y: true_str == y, ls):
+                    return x
+                else:
+                    raise BeDOZaException("Wrong commitment. Some player revieved a wrong commitment. My commitments were: %s", isOK)
+                
+            ds = self.broadcast(self.players.keys(), self.players.keys(),
+                                str(isOK))
+            ds = gatherResults(ds)
+            ds.addCallbacks(check, self.error_handler, callbackArgs=(x,isOK))
+            return ds
 
         def exchange((xi, keyList, codes), receivers):
             # Send share to all receivers.