viff

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 diff
     1.1 --- a/viff/bedoza.py	Wed Jul 07 16:11:48 2010 +0200
     1.2 +++ b/viff/bedoza.py	Wed Jul 07 16:30:01 2010 +0200
     1.3 @@ -231,9 +231,20 @@
     1.4                  beta = keys[inx]
     1.5                  x += xi
     1.6                  mi_prime = self.MAC(alpha, beta, xi)
     1.7 -                if not (isOK and mi == mi_prime):
     1.8 -                    raise BeDOZaException("Wrong commitment, expected %s, got %s = %s*%s + %s." % (mi.value, mi_prime.value, alpha.value, xi.value, beta.value))
     1.9 -            return x
    1.10 +                isOK = isOK and mi == mi_prime
    1.11 +
    1.12 +            def check(ls, x, isOK):
    1.13 +                true_str = str(True)
    1.14 +                if reduce(lambda x, y: true_str == y, ls):
    1.15 +                    return x
    1.16 +                else:
    1.17 +                    raise BeDOZaException("Wrong commitment. Some player revieved a wrong commitment. My commitments were: %s", isOK)
    1.18 +                
    1.19 +            ds = self.broadcast(self.players.keys(), self.players.keys(),
    1.20 +                                str(isOK))
    1.21 +            ds = gatherResults(ds)
    1.22 +            ds.addCallbacks(check, self.error_handler, callbackArgs=(x,isOK))
    1.23 +            return ds
    1.24  
    1.25          def exchange((xi, keyList, codes), receivers):
    1.26              # Send share to all receivers.