changeset 911:47734eb343ed

New BasicActiveRuntime class. This class is ready to be mixed with a class providing a get_triple method, such as the TriplesHyperinvertibleMatricesMixin or TriplesPRSSMixin classes.
author Martin Geisler <mg@daimi.au.dk>
date Mon, 15 Sep 2008 17:02:40 +0200
parents 3f5367d1fcc7
children 201381ab3c4b
files doc/active.txt viff/active.py
diffstat 2 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/doc/active.txt	Mon Sep 15 16:46:41 2008 +0200
+++ b/doc/active.txt	Mon Sep 15 17:02:40 2008 +0200
@@ -7,6 +7,9 @@
    .. autoclass:: ActiveRuntime
       :members:
 
+   .. autoclass:: BasicActiveRuntime
+      :members:
+
    .. autoclass:: BrachaBroadcastMixin
       :members:
 
--- a/viff/active.py	Mon Sep 15 16:46:41 2008 +0200
+++ b/viff/active.py	Mon Sep 15 17:02:40 2008 +0200
@@ -413,13 +413,13 @@
 
     @increment_pc
     @preprocess("generate_triple")
-    def prss_get_triple(self, field):
-        count, result = self.prss_generate_triple(field)
+    def get_triple(self, field):
+        count, result = self.generate_triple(field)
         result.addCallback(lambda triples: triples[0])
         return result
 
     @increment_pc
-    def prss_generate_triple(self, field):
+    def generate_triple(self, field):
         """Generate a multiplication triple using PRSS.
 
         These are random numbers *a*, *b*, and *c* such that ``c =
@@ -442,11 +442,15 @@
         return 1, succeed([(a_t, b_t, c_t)])
 
 
-class ActiveRuntime(Runtime, TriplesPRSSMixin):
-    """A runtime secure against active adversaries.
+class BasicActiveRuntime(Runtime):
+    """Basic runtime secure against active adversaries.
 
-    This class currently inherits most of its functionality from the
-    normal :class:`Runtime` class and is thus **not** yet secure.
+    This class depends on either
+    :class:`TriplesHyperinvertibleMatricesMixin` or
+    :class:`TriplesPRSSMixin` to provide a :meth:`get_triple` method.
+
+    Instead of using this class directly, one should probably use
+    :class:`ActiveRuntime` instead.
     """
 
     @increment_pc
@@ -494,8 +498,14 @@
         # This will be the result, a Share object.
         result = Share(self, share_x.field)
         # This is the Deferred we will do processing on.
-        triple = self.prss_get_triple(share_x.field)
+        triple = self.get_triple(share_x.field)
         self.schedule_callback(triple, finish_mul)
         # We add the result to the chains in triple.
         triple.chainDeferred(result)
         return result
+
+
+class ActiveRuntime(BasicActiveRuntime, TriplesPRSSMixin):
+    """Default mix of :class:`BasicActiveRuntime` and
+    :class:`TriplesPRSSMixin`."""
+    pass