changeset 1400:3a225dcdaccb

Orlandi: Made dijs be longs instead of fields.
author Thomas P Jakobsen <tpj@cs.au.dk>
date Fri, 27 Nov 2009 16:25:50 +0100
parents 2cbe81569dd0
children 4e9747693979
files viff/orlandi.py
diffstat 1 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/viff/orlandi.py	Fri Nov 27 16:13:56 2009 +0100
+++ b/viff/orlandi.py	Fri Nov 27 16:25:50 2009 +0100
@@ -926,11 +926,7 @@
                       broadcast ``C_i = Com_ck(c_i, t_i)``
             """
             # c_i = SUM_j Dec_sk_i(gamma_ij) - SUM_j d_ji mod p.
-            dls = []
-            for dij in dijs:
-                dls.append(dij.value)
-
-            ls = [list(x) for x in zip(gammas, dls)]
+            ls = [list(x) for x in zip(gammas, dijs)]
             ci = field(tripple_3a(ls, self.players[self.id].seckey))
             # (b) pick random t_i in (Z_p)^2.
             t1 = random_number(field.modulus)
@@ -962,9 +958,9 @@
             p3 = field.modulus**3
             for pi in self.players.keys():
                 # choose random d_i,j in Z_p^3
-                dij = random_number(p3)
+                dij = random_number(p3).value
                 # gamma_ij = alpha_i^b_j Enc_ek_i(1;1)^d_ij
-                gammaij = tripple_2c(alphas[pi - 1], bj.value, dij.value, self.players[pi].pubkey)
+                gammaij = tripple_2c(alphas[pi - 1], bj.value, dij, self.players[pi].pubkey)
                 # Broadcast gamma_ij
                 if pi != self.id:
                     self.protocols[pi].sendData(pc, PAILLIER, str(gammaij))
@@ -1220,7 +1216,7 @@
                         raise OrlandiException("Inconsistent random value dij %i from player %i" % (dij, j + 1))
                     # gamma_ij = alpha_i^b_j Enc_ek_i(1;1)^d_ij
                     gammaij = tripple_2c(alphas[self.id - 1], bis[j][0].value, 
-                                      dij.value, self.players[self.id].pubkey)
+                                      dij, self.players[self.id].pubkey)
                     if gammaij != gammas[j]:
                         raise OrlandiException("Inconsistent gammaij, %i, %i" % (gammaij, gammas[j]))
 
@@ -1249,13 +1245,13 @@
                         send_share(player_id, pc, b)
                         send_share(player_id, pc, c)
                         send_long(player_id, pc, alpha_randomness)
-                        self.protocols[player_id].sendShare(pc, dijs[player_id - 1])
+                        send_long(player_id, pc, dijs[player_id - 1])
 
                         ds_a[player_id - 1] = receive_shares(player_id)
                         ds_b[player_id - 1] = receive_shares(player_id)
                         ds_c[player_id - 1] = receive_shares(player_id)
                         ds_alpha_randomness[player_id - 1] = receive_long(player_id)
-                        ds_dijs[player_id - 1] = self._expect_share(player_id, field)
+                        ds_dijs[player_id - 1] = receive_long(player_id)
                 dls_a = gatherResults(ds_a)
                 dls_b = gatherResults(ds_b)
                 dls_c = gatherResults(ds_c)