viff

changeset 1480:b0975eaed9bb

BeDOZa: Fixed bugs in multipleopen, related to keys.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Thu, 08 Jul 2010 10:57:48 +0200
parents aa1c7d6c98ca
children 2aa3bec0492e
files viff/bedoza.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/viff/bedoza.py	Thu Jul 08 10:36:21 2010 +0200
     1.2 +++ b/viff/bedoza.py	Thu Jul 08 10:57:48 2010 +0200
     1.3 @@ -211,7 +211,7 @@
     1.4  
     1.5          self.increment_pc()
     1.6  
     1.7 -        def recombine_value(player_shares_codes, keyList, num_shares):
     1.8 +        def recombine_value(player_shares_codes, keyLists, num_shares):
     1.9              def check(ls, x, isOK):
    1.10                  true_str = str(True)
    1.11                  if reduce(lambda x, y: true_str == y, ls):
    1.12 @@ -220,12 +220,12 @@
    1.13                      raise BeDOZaException("Wrong commitment. Some player revieved a wrong commitment. My commitments were: %s", isOK)
    1.14  
    1.15              n = len(self.players)
    1.16 -            alpha = keyList.alpha
    1.17 -            keys = keyList.keys
    1.18 +            alpha = keyLists[0].alpha
    1.19  
    1.20              values = num_shares * [0]
    1.21              isOK = num_shares * [True]
    1.22              for iny in xrange(num_shares):
    1.23 +                keys = keyLists[iny].keys
    1.24                  for inx, xs in enumerate(player_shares_codes):
    1.25                      xi, mi = xs[iny]
    1.26                      beta = keys[inx]
    1.27 @@ -243,11 +243,13 @@
    1.28          def exchange(ls, receivers):
    1.29              # Send share to all receivers.
    1.30              pc = tuple(self.program_counter)
    1.31 +            keyLists = []
    1.32              for other_id in receivers:
    1.33                  # self.protocols[other_id].sendShare(pc, xi)
    1.34                  # self.protocols[other_id].sendShare(pc, codes.auth_codes[other_id - 1])
    1.35                  message_string = ""
    1.36                  for inx, (xi, keyList, codes) in enumerate(ls):
    1.37 +                    keyLists.append(keyList)
    1.38                      message_string += "%s:%s;" % \
    1.39                             (xi.value, codes.auth_codes[other_id - 1].value)
    1.40                  self.protocols[other_id].sendData(pc, TEXT, message_string)
    1.41 @@ -267,7 +269,7 @@
    1.42                      self._expect_data(other_id, TEXT, d)
    1.43                      values[inx] = d
    1.44                  result = gatherResults(values)
    1.45 -                result.addCallbacks(recombine_value, self.error_handler, callbackArgs=(keyList, len(shares)))
    1.46 +                result.addCallbacks(recombine_value, self.error_handler, callbackArgs=(keyLists, len(shares)))
    1.47                  return result
    1.48  
    1.49          result = gather_shares(shares)
    1.50 @@ -279,7 +281,7 @@
    1.51  
    1.52          if self.id in receivers:
    1.53              return result
    1.54 -        
    1.55 +
    1.56      def open(self, share, receivers=None):
    1.57          """Share reconstruction."""
    1.58          assert isinstance(share, Share)