viff

changeset 652:9c6a43bbbf8c

Hide the generation of triples behind a get_triple method.
author Martin Geisler <mg@daimi.au.dk>
date Mon, 07 Apr 2008 22:46:15 +0200
parents e646854cca93
children 0743b624fb60
files viff/runtime.py
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line diff
     1.1 --- a/viff/runtime.py	Mon Apr 07 17:14:22 2008 +0200
     1.2 +++ b/viff/runtime.py	Mon Apr 07 22:46:15 2008 +0200
     1.3 @@ -988,13 +988,7 @@
     1.4  
     1.5          # At this point both share_x and share_y must be Share
     1.6          # objects. We multiply them via a multiplication triple.
     1.7 -
     1.8 -        # TODO: This is of course insecure... We should move
     1.9 -        # generate_triples to a preprocessing step and draw the
    1.10 -        # triples from a pool instead. Also, using only the first
    1.11 -        # triple is quite wasteful...
    1.12 -        a, b, c = self.generate_triples(share_x.field)[0]
    1.13 -
    1.14 +        a, b, c = self.get_triple(share_x.field)
    1.15          d = self.open(share_x - a)
    1.16          e = self.open(share_y - b)
    1.17  
    1.18 @@ -1051,6 +1045,14 @@
    1.19          return rvec1.rows[0][:T], rvec2.rows[0][:T]
    1.20  
    1.21      @increment_pc
    1.22 +    def get_triple(self, field):
    1.23 +        # TODO: This is of course insecure... We should move
    1.24 +        # generate_triples to a preprocessing step and draw the
    1.25 +        # triples from a pool instead. Also, using only the first
    1.26 +        # triple is quite wasteful...
    1.27 +        return self.generate_triples(field)[0]
    1.28 +
    1.29 +    @increment_pc
    1.30      def generate_triples(self, field):
    1.31          """Generate multiplication triples.
    1.32