viff

changeset 1547:dae353266aa6

Merged.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Tue, 21 Sep 2010 11:51:35 +0200
parents 7db2fafaab44 da966a4620f4
children 6191f86d814b
files viff/test/test_bedoza_runtime.py viff/test/test_bedoza_triple.py
diffstat 5 files changed, 136 insertions(+), 120 deletions(-) [+]
line diff
     1.1 --- a/viff/bedoza/bedoza_triple.py	Tue Sep 21 10:05:02 2010 +0200
     1.2 +++ b/viff/bedoza/bedoza_triple.py	Tue Sep 21 11:51:35 2010 +0200
     1.3 @@ -35,6 +35,8 @@
     1.4  from viff.bedoza.add_macs import add_macs
     1.5  from viff.bedoza.modified_paillier import ModifiedPaillier
     1.6  from viff.bedoza.util import fast_pow
     1.7 +from viff.bedoza.util import _convolute
     1.8 +from viff.bedoza.share import Share
     1.9  
    1.10  from viff.triple import Triple
    1.11  
    1.12 @@ -52,7 +54,7 @@
    1.13  
    1.14  class TripleGenerator(object):
    1.15  
    1.16 -    def __init__(self, runtime, p, random):
    1.17 +    def __init__(self, runtime, security_parameter, p, random):
    1.18          assert p > 1
    1.19          self.random = random
    1.20          # TODO: Generate Paillier cipher with N_i sufficiently larger than p
    1.21 @@ -60,7 +62,8 @@
    1.22          self.p = p
    1.23          self.Zp = GF(p)
    1.24          self.k = self._bit_length_of(p)
    1.25 -        self.u_bound = 2**(4 * self.k)
    1.26 +        self.security_parameter = security_parameter
    1.27 +        self.u_bound = 2**(self.security_parameter + 4 * self.k)
    1.28  
    1.29          paillier_random = Random(self.random.getrandbits(128))
    1.30          alpha_random = Random(self.random.getrandbits(128))
    1.31 @@ -85,6 +88,10 @@
    1.32              bit_length += 1
    1.33          return bit_length
    1.34  
    1.35 +    def generate_triples(self):
    1.36 +        """Generates and returns a set with *self.security_parameter* triples."""
    1.37 +        return generate_triples(self, self.security_parameter)
    1.38 +        
    1.39      def generate_triples(self, n):
    1.40          """Generates and returns a set of n triples.
    1.41          
    1.42 @@ -172,12 +179,10 @@
    1.43          """Multiply each of the field elements in *ais* with the
    1.44          corresponding encrypted elements in *cjs*.
    1.45          
    1.46 -        Returns a deferred which will yield a list of PartialShareContents.
    1.47 +        Returns a deferred which will yield a list of field elements.
    1.48          """
    1.49          CKIND = 1
    1.50 -        DiKIND = 2
    1.51 -        DjKIND = 3
    1.52 -
    1.53 + 
    1.54          """The transmission_restraint_constant is the number of
    1.55          encrypted shares we can safely transmit in one call to
    1.56          sendData. The sendData method can only transmit up to
    1.57 @@ -197,33 +202,24 @@
    1.58  
    1.59          pc = tuple(self.runtime.program_counter)
    1.60  
    1.61 -        deferreds = []
    1.62 +        deferred = []
    1.63          zis = []
    1.64          if self.runtime.id == inx:
    1.65              Nj_square = self.paillier.get_modulus_square(jnx)
    1.66              all_cs = []
    1.67 -            all_dis = []
    1.68              for iny, (ai, cj) in enumerate(zip(ais, cjs)):
    1.69                  if iny % transmission_restraint_constant == 0:
    1.70                      cs = []
    1.71                      all_cs.append(cs)
    1.72 -                    dis = []
    1.73 -                    all_dis.append(dis)
    1.74                  u = rand.randint(0, self.u_bound)
    1.75                  Ej_u = self.paillier.encrypt(u, jnx)
    1.76                  cs.append( (fast_pow(cj, ai.value, Nj_square) * Ej_u) % Nj_square )
    1.77                  zi = self.Zp(-u)
    1.78                  zis.append(zi)
    1.79 -                dis.append(self.paillier.encrypt(zi.value, inx))
    1.80                  
    1.81              for cs in all_cs:
    1.82                  self.runtime.protocols[jnx].sendData(pc, CKIND, str(cs))
    1.83  
    1.84 -            for dis in all_dis:
    1.85 -                for player_id in self.runtime.players:
    1.86 -                    self.runtime.protocols[player_id].sendData(pc, DiKIND,
    1.87 -                                                               str(dis))
    1.88 -
    1.89          if self.runtime.id == jnx:
    1.90              all_cs = []
    1.91              for _ in xrange(number_of_packets):
    1.92 @@ -234,66 +230,24 @@
    1.93              def decrypt(all_cs, pc, zis):
    1.94                  zjs = []
    1.95                  cs = reduce(lambda x, y: x + eval(y), all_cs, [])
    1.96 -                all_djs = []
    1.97                  for iny, c in enumerate(cs):
    1.98 -                    if iny % transmission_restraint_constant == 0:
    1.99 -                        djs = []
   1.100 -                        all_djs.append(djs)
   1.101                      t = self.paillier.decrypt(c)
   1.102                      zj = self.Zp(t)
   1.103                      zjs.append(zj)
   1.104 -                    djs.append(self.paillier.encrypt(zj.value, jnx))
   1.105 -                for djs in all_djs:
   1.106 -                    for player_id in self.runtime.players:
   1.107 -                        self.runtime.protocols[player_id].sendData(pc, DjKIND,
   1.108 -                                                                   str(djs))
   1.109                  if not zis == []:
   1.110                      return [x + y for x, y in zip(zis, zjs)]
   1.111                  else:
   1.112                      return zjs 
   1.113              all_cs_d = gatherResults(all_cs)
   1.114              all_cs_d.addCallback(decrypt, pc, zis)
   1.115 -            deferreds.append(all_cs_d)
   1.116 +            deferred = all_cs_d
   1.117          else:
   1.118              zis_deferred = Deferred()
   1.119              zis_deferred.callback(zis)
   1.120 -            deferreds.append(zis_deferred)
   1.121 +            deferred = zis_deferred
   1.122  
   1.123 -        all_dis = []
   1.124 -        for _ in xrange(number_of_packets):
   1.125 -            dis = Deferred()
   1.126 -            self.runtime._expect_data(inx, DiKIND, dis)
   1.127 -            all_dis.append(dis)
   1.128 -        all_djs = []
   1.129 -        for _ in xrange(number_of_packets):
   1.130 -            djs = Deferred()
   1.131 -            self.runtime._expect_data(jnx, DjKIND, djs)
   1.132 -            all_djs.append(djs)
   1.133 -
   1.134 -        deferreds.append(gatherResults(all_dis))
   1.135 -        deferreds.append(gatherResults(all_djs))
   1.136 -        r = gatherResults(deferreds)
   1.137 -        def wrap((values, dis, djs), inx, jnx):
   1.138 -            dis = reduce(lambda x, y: x + eval(y), dis, [])
   1.139 -            djs = reduce(lambda x, y: x + eval(y), djs, [])
   1.140 -            n_square_i = self.paillier.get_modulus_square(inx)
   1.141 -            n_square_j = self.paillier.get_modulus_square(jnx)
   1.142 -            N_squared_list = [self.paillier.get_modulus_square(player_id)
   1.143 -                              for player_id in self.runtime.players]
   1.144 -            ps = []
   1.145 -            
   1.146 -            for v, di, dj in itertools.izip_longest(values, dis, djs,
   1.147 -                                                    fillvalue=self.Zp(0)):
   1.148 -                value = v
   1.149 -                enc_shares = len(self.runtime.players) * [1]
   1.150 -                enc_shares[inx - 1] = (enc_shares[inx - 1] * di) % n_square_i
   1.151 -                enc_shares[jnx - 1] = (enc_shares[jnx - 1] * dj) % n_square_j
   1.152 -                ps.append(PartialShareContents(value, enc_shares,
   1.153 -                                               N_squared_list))
   1.154 -            return ps
   1.155 -        r.addCallback(wrap, inx, jnx)
   1.156 -        return r
   1.157 -
   1.158 +        return deferred
   1.159 +       
   1.160      def _full_mul(self, a, b):
   1.161          """Multiply each of the PartialShares in the list *a* with the
   1.162          corresponding PartialShare in the list *b*.
   1.163 @@ -302,41 +256,50 @@
   1.164          """
   1.165          self.runtime.increment_pc()
   1.166          
   1.167 -        def do_full_mul(shares, result_shares):
   1.168 +        def do_full_mul(shareContents, result_shares):
   1.169              """Share content belonging to ai, bi are at:
   1.170 -            shares[i], shares[len(shares) + i].
   1.171 +            shareContents[i], shareContents[len(shareContents) + i].
   1.172              """
   1.173              deferreds = []
   1.174 -            len_shares = len(shares)
   1.175 -            a_values = [s.value for s in shares[0:len_shares/2]]
   1.176 +            len_shares = len(shareContents)
   1.177 +
   1.178 +            ais = [shareContent.value for shareContent in shareContents[0:len_shares/2]]
   1.179 +            bis = [shareContent.value for shareContent in shareContents[len_shares/2:]]
   1.180 +            
   1.181              b_enc_shares = []
   1.182 -            for inx in self.runtime.players:              
   1.183 +            for inx in self.runtime.players:
   1.184                  b_enc_shares.append([s.enc_shares[inx - 1]
   1.185 -                                     for s in shares[len_shares/2:]])
   1.186 +                                     for s in shareContents[len_shares/2:]])
   1.187 +
   1.188 +            values = len(ais) * [0]
   1.189 +
   1.190              for inx in xrange(0, len(self.runtime.players)):
   1.191                  for jnx in xrange(0, len(self.runtime.players)):
   1.192                      deferreds.append(self._mul(inx + 1,
   1.193                                                 jnx + 1,
   1.194 -                                               len(a_values),
   1.195 -                                               a_values,
   1.196 +                                               len(ais),
   1.197 +                                               ais,
   1.198                                                 b_enc_shares[jnx]))
   1.199 -                        
   1.200 -            def compute_shares(partialShareContents, len_shares, result_shares):
   1.201 -                num_players = len(self.runtime.players)
   1.202 -                pcs = len(partialShareContents[0]) * [None]
   1.203 -                for ps in partialShareContents:
   1.204 -                    for inx in xrange(0, len(ps)):
   1.205 -                        if pcs[inx] == None:
   1.206 -                            pcs[inx] = ps[inx]
   1.207 -                        else:
   1.208 -                            pcs[inx] += ps[inx]
   1.209 -                for p, s in zip(pcs, result_shares):
   1.210 -                    s.callback(p)
   1.211 +            
   1.212 +            def compute_shares(zils, values, result_shares):
   1.213 +                for zil in zils:
   1.214 +                    for inx, zi in enumerate(zil):
   1.215 +                        values[inx] += zi
   1.216 +
   1.217 +                return values
   1.218 +            
   1.219 +            d = gatherResults(deferreds)
   1.220 +            d.addCallback(compute_shares, values, result_shares)
   1.221 +            
   1.222 +            def callBackPartialShareContents(partialShareContents, result_shares):
   1.223 +                for v, s in zip(partialShareContents, result_shares):
   1.224 +                    s.callback(v)
   1.225                  return None
   1.226 -            d = gatherResults(deferreds)
   1.227 -            d.addCallback(compute_shares, len_shares, result_shares)
   1.228 +            
   1.229 +            d.addCallback(lambda values: Share(values, self.runtime, self.paillier))
   1.230 +            d.addCallback(callBackPartialShareContents, result_shares)
   1.231              return d
   1.232 -        result_shares = [Share(self.runtime, self.Zp) for x in a]
   1.233 +        result_shares = [PartialShare(self.runtime, self.Zp) for _ in a]
   1.234          self.runtime.schedule_callback(gatherResults(a + b),
   1.235                                         do_full_mul,
   1.236                                         result_shares)
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/viff/bedoza/share.py	Tue Sep 21 11:51:35 2010 +0200
     2.3 @@ -0,0 +1,53 @@
     2.4 +# Copyright 2010 VIFF Development Team.
     2.5 +#
     2.6 +# This file is part of VIFF, the Virtual Ideal Functionality Framework.
     2.7 +#
     2.8 +# VIFF is free software: you can redistribute it and/or modify it
     2.9 +# under the terms of the GNU Lesser General Public License (LGPL) as
    2.10 +# published by the Free Software Foundation, either version 3 of the
    2.11 +# License, or (at your option) any later version.
    2.12 +#
    2.13 +# VIFF is distributed in the hope that it will be useful, but WITHOUT
    2.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    2.15 +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
    2.16 +# Public License for more details.
    2.17 +#
    2.18 +# You should have received a copy of the GNU Lesser General Public
    2.19 +# License along with VIFF. If not, see <http://www.gnu.org/licenses/>.
    2.20 +
    2.21 +from viff.bedoza.shares import PartialShareContents
    2.22 +from viff.bedoza.util import _convolute
    2.23 +
    2.24 +def Share(field_elements, runtime, paillier):
    2.25 +    """Each party input a list of field elements *field_elements*.
    2.26 +    The value of the field elements are encrypted and the encrypted
    2.27 +    values are exchanged.
    2.28 +
    2.29 +    Returns a deferred, which yields a list of PartialShareContents.  
    2.30 +    """
    2.31 +    
    2.32 +    runtime.increment_pc()
    2.33 +
    2.34 +    N_squared_list = [paillier.get_modulus_square(player_id)
    2.35 +                      for player_id in runtime.players]
    2.36 +
    2.37 +    list_of_enc_shares = []
    2.38 +    for field_element in field_elements:
    2.39 +        list_of_enc_shares.append(paillier.encrypt(field_element.value))
    2.40 +        
    2.41 +    list_of_enc_shares = _convolute(runtime, list_of_enc_shares, deserialize=eval)
    2.42 +    def create_partial_share(list_of_enc_shares, field_elements):
    2.43 +
    2.44 +        reordered_encrypted_shares = [[] for _ in list_of_enc_shares[0]]
    2.45 +        for enc_shares in list_of_enc_shares:
    2.46 +            for inx, enc_share in enumerate(enc_shares):
    2.47 +                reordered_encrypted_shares[inx].append(enc_share)
    2.48 +
    2.49 +        partialShareContents = []
    2.50 +        for enc_shares, field_element in zip(reordered_encrypted_shares, field_elements):
    2.51 +            partialShareContents.append(PartialShareContents(field_element, enc_shares, N_squared_list))
    2.52 +        return partialShareContents
    2.53 +    
    2.54 +    runtime.schedule_callback(list_of_enc_shares, create_partial_share, field_elements)
    2.55 +    return list_of_enc_shares
    2.56 +        
     3.1 --- a/viff/bedoza/share_generators.py	Tue Sep 21 10:05:02 2010 +0200
     3.2 +++ b/viff/bedoza/share_generators.py	Tue Sep 21 11:51:35 2010 +0200
     3.3 @@ -31,7 +31,7 @@
     3.4      def generate_share(self, value):
     3.5          self.runtime.increment_pc()
     3.6          
     3.7 -        # TODO: Exclusve?
     3.8 +        # TODO: Exclusive?
     3.9          r = [self.Zp(self.random.randint(0, self.Zp.modulus - 1))
    3.10               for _ in range(self.runtime.num_players - 1)]
    3.11          if self.runtime.id == 1:
     4.1 --- a/viff/test/test_bedoza_runtime.py	Tue Sep 21 10:05:02 2010 +0200
     4.2 +++ b/viff/test/test_bedoza_runtime.py	Tue Sep 21 11:51:35 2010 +0200
     4.3 @@ -79,7 +79,8 @@
     4.4          RuntimeTestCase.setUp(self)
     4.5          self.Zp = GF(17)
     4.6          bits_in_p = 5
     4.7 -        self.u_bound = 2**(4 * bits_in_p)
     4.8 +        self.security_parameter = 32
     4.9 +        self.u_bound = 2**(self.security_parameter + 4 * bits_in_p)
    4.10          self.alpha = 15
    4.11  
    4.12      @protocol
    4.13 @@ -344,7 +345,7 @@
    4.14              return d
    4.15  
    4.16          random = Random(3423993)
    4.17 -        gen = TripleGenerator(runtime, self.Zp.modulus, random)
    4.18 +        gen = TripleGenerator(runtime, self.security_parameter, self.Zp.modulus, random)
    4.19          [triple] = gen.generate_triples(1)
    4.20          triple.addCallback(open)
    4.21          return triple
    4.22 @@ -377,7 +378,7 @@
    4.23              d.addCallback(check)
    4.24              return d
    4.25  
    4.26 -        gen = TripleGenerator(runtime, self.Zp.modulus, Random(3423993))
    4.27 +        gen = TripleGenerator(runtime, self.security_parameter, self.Zp.modulus, Random(3423993))
    4.28          alpha = gen.alpha
    4.29          [triple] = gen.generate_triples(1)
    4.30          runtime.schedule_callback(triple, do_stuff, alpha)
    4.31 @@ -393,7 +394,7 @@
    4.32          def check(v):
    4.33              self.assertEquals(v, self.Zp(x1 * y1))
    4.34  
    4.35 -        gen = TripleGenerator(runtime, self.Zp.modulus, Random(3423993))
    4.36 +        gen = TripleGenerator(runtime, self.security_parameter, self.Zp.modulus, Random(3423993))
    4.37          alpha = gen.alpha
    4.38          triples = gen.generate_triples(1)
    4.39          
    4.40 @@ -444,7 +445,7 @@
    4.41              d.addCallback(check)
    4.42              return d
    4.43  
    4.44 -        gen = TripleGenerator(runtime, self.Zp.modulus, Random(3423993))
    4.45 +        gen = TripleGenerator(runtime, self.security_parameter, self.Zp.modulus, Random(3423993))
    4.46          alpha = gen.alpha
    4.47          [triple] = gen.generate_triples(1)
    4.48          runtime.schedule_callback(triple, do_stuff, alpha)
    4.49 @@ -478,7 +479,7 @@
    4.50              d.addCallback(check)
    4.51              return d
    4.52  
    4.53 -        gen = TripleGenerator(runtime, self.Zp.modulus, Random(3423993))
    4.54 +        gen = TripleGenerator(runtime, self.security_parameter, self.Zp.modulus, Random(3423993))
    4.55          alpha = gen.alpha
    4.56          [triple] = gen.generate_triples(1)
    4.57          runtime.schedule_callback(triple, do_stuff, alpha)
     5.1 --- a/viff/test/test_bedoza_triple.py	Tue Sep 21 10:05:02 2010 +0200
     5.2 +++ b/viff/test/test_bedoza_triple.py	Tue Sep 21 11:51:35 2010 +0200
     5.3 @@ -76,6 +76,10 @@
     5.4  
     5.5      runtime_class = BeDOZaRuntime
     5.6  
     5.7 +    def setUp(self):
     5.8 +        RuntimeTestCase.setUp(self)
     5.9 +        self.security_parameter = 32
    5.10 +
    5.11      # TODO: During test, we would like generation of Paillier keys to
    5.12      # be deterministic. How do we obtain that?
    5.13      def generate_configs(self, *args):
    5.14 @@ -407,9 +411,9 @@
    5.15          p = 17
    5.16  
    5.17          Zp = GF(p)
    5.18 -        
    5.19 +      
    5.20          random = Random(283883)        
    5.21 -        triple_generator = TripleGenerator(runtime, p, random)
    5.22 +        triple_generator = TripleGenerator(runtime, self.security_parameter, p, random)
    5.23  
    5.24          triples = triple_generator.generate_triples(10)
    5.25  
    5.26 @@ -433,9 +437,9 @@
    5.27          p = 17
    5.28  
    5.29          Zp = GF(p)
    5.30 -        
    5.31 +       
    5.32          random = Random(283883)        
    5.33 -        triple_generator = TripleGenerator(runtime, p, random)
    5.34 +        triple_generator = TripleGenerator(runtime, self.security_parameter, p, random)
    5.35  
    5.36          triples = triple_generator._generate_passive_triples(5)
    5.37          def verify(triples):
    5.38 @@ -456,8 +460,9 @@
    5.39      @protocol
    5.40      def test_mul_computes_correct_result(self, runtime):
    5.41          p = 17
    5.42 +       
    5.43          random = Random(283883)        
    5.44 -        triple_generator = TripleGenerator(runtime, p, random)
    5.45 +        triple_generator = TripleGenerator(runtime, 32, p, random)
    5.46  
    5.47          Zp = GF(p)
    5.48  
    5.49 @@ -471,35 +476,28 @@
    5.50          
    5.51          if runtime.id == 1:
    5.52              r1 = triple_generator._mul(1, 2, n, ais, cs)
    5.53 -            def check1(partialShares):
    5.54 -                for partialShare in partialShares:
    5.55 -                    zi = triple_generator.paillier.decrypt(partialShare.enc_shares[0])
    5.56 -                    self.assertEquals(partialShare.value.value, zi)
    5.57 +            def check1(shares):
    5.58 +                for share in shares:
    5.59                      pc = tuple(runtime.program_counter)
    5.60 -                    runtime.protocols[2].sendData(pc, TEXT, str(zi))
    5.61 +                    runtime.protocols[2].sendData(pc, TEXT, str(share.value))
    5.62                  return True
    5.63              r1.addCallback(check1)
    5.64              return r1
    5.65          else:
    5.66              r1 = triple_generator._mul(1, 2, n)
    5.67 -            def check(partialShares):
    5.68 +            def check(shares):
    5.69                  deferreds = []
    5.70 -                for partialShare in partialShares:
    5.71 +                for share in shares:
    5.72                      if runtime.id == 2:
    5.73 -                        zj = triple_generator.paillier.decrypt(partialShare.enc_shares[1])
    5.74 -                        self.assertEquals(partialShare.value.value, zj)
    5.75                          def check_additivity(zi, zj):
    5.76                              self.assertEquals((Zp(long(zi)) + zj).value, 8)
    5.77                              return None
    5.78                          d = Deferred()
    5.79 -                        d.addCallback(check_additivity, partialShare.value)
    5.80 +                        d.addCallback(check_additivity, share.value)
    5.81                          runtime._expect_data(1, TEXT, d)
    5.82                          deferreds.append(d)
    5.83                      else:
    5.84 -                        self.assertEquals(partialShare.value, 0)
    5.85 -                        self.assertNotEquals(partialShare.enc_shares[0], 0)
    5.86 -                        self.assertNotEquals(partialShare.enc_shares[1], 0)
    5.87 -                        self.assertEquals(partialShare.enc_shares[2], 1)
    5.88 +                        self.assertEquals(share.value, 0)
    5.89                  return gatherResults(deferreds)
    5.90              r1.addCallback(check)
    5.91              return r1
    5.92 @@ -507,8 +505,9 @@
    5.93      @protocol
    5.94      def test_mul_same_player_inputs_and_receives(self, runtime):
    5.95          p = 17
    5.96 +      
    5.97          random = Random(283883)        
    5.98 -        triple_generator = TripleGenerator(runtime, p, random)
    5.99 +        triple_generator = TripleGenerator(runtime, self.security_parameter, p, random)
   5.100  
   5.101          Zp = GF(p)
   5.102  
   5.103 @@ -521,12 +520,10 @@
   5.104          n = len(ais)
   5.105          
   5.106          r1 = triple_generator._mul(2, 2, n, ais, cs)
   5.107 -        def check(partialShareContents):
   5.108 -            for partialShareContent in partialShareContents:
   5.109 +        def check(shares):
   5.110 +            for share in shares:
   5.111                  if runtime.id == 2:
   5.112 -                    zi_enc = Zp(triple_generator.paillier.decrypt(partialShareContent.enc_shares[1]))
   5.113 -                    self.assertEquals(zi_enc, partialShareContent.value)
   5.114 -                    self.assertEquals(partialShareContent.value, 8)
   5.115 +                    self.assertEquals(share.value, 8)
   5.116              return True
   5.117              
   5.118          r1.addCallback(check)
   5.119 @@ -535,7 +532,9 @@
   5.120  
   5.121  class FullMulTest(BeDOZaTestCase): 
   5.122      num_players = 3
   5.123 -    
   5.124 +
   5.125 +    timeout = 10
   5.126 +        
   5.127      @protocol
   5.128      def test_fullmul_computes_the_correct_result(self, runtime):
   5.129          p = 17
   5.130 @@ -543,7 +542,7 @@
   5.131          Zp = GF(p)
   5.132          
   5.133          random = Random(283883)        
   5.134 -        triple_generator = TripleGenerator(runtime, p, random)
   5.135 +        triple_generator = TripleGenerator(runtime, self.security_parameter, p, random)
   5.136  
   5.137          paillier = triple_generator.paillier
   5.138          
   5.139 @@ -582,7 +581,7 @@
   5.140          Zp = GF(p)
   5.141          
   5.142          random = Random(283883)        
   5.143 -        triple_generator = TripleGenerator(runtime, p, random)
   5.144 +        triple_generator = TripleGenerator(runtime, self.security_parameter, p, random)
   5.145  
   5.146          paillier = triple_generator.paillier
   5.147