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 wrap: on
line diff
--- a/viff/runtime.py	Mon Apr 07 17:14:22 2008 +0200
+++ b/viff/runtime.py	Mon Apr 07 22:46:15 2008 +0200
@@ -988,13 +988,7 @@
 
         # At this point both share_x and share_y must be Share
         # objects. We multiply them via a multiplication triple.
-
-        # TODO: This is of course insecure... We should move
-        # generate_triples to a preprocessing step and draw the
-        # triples from a pool instead. Also, using only the first
-        # triple is quite wasteful...
-        a, b, c = self.generate_triples(share_x.field)[0]
-
+        a, b, c = self.get_triple(share_x.field)
         d = self.open(share_x - a)
         e = self.open(share_y - b)
 
@@ -1051,6 +1045,14 @@
         return rvec1.rows[0][:T], rvec2.rows[0][:T]
 
     @increment_pc
+    def get_triple(self, field):
+        # TODO: This is of course insecure... We should move
+        # generate_triples to a preprocessing step and draw the
+        # triples from a pool instead. Also, using only the first
+        # triple is quite wasteful...
+        return self.generate_triples(field)[0]
+
+    @increment_pc
     def generate_triples(self, field):
         """Generate multiplication triples.