viff

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 diff
     1.1 --- a/doc/active.txt	Mon Sep 15 16:46:41 2008 +0200
     1.2 +++ b/doc/active.txt	Mon Sep 15 17:02:40 2008 +0200
     1.3 @@ -7,6 +7,9 @@
     1.4     .. autoclass:: ActiveRuntime
     1.5        :members:
     1.6  
     1.7 +   .. autoclass:: BasicActiveRuntime
     1.8 +      :members:
     1.9 +
    1.10     .. autoclass:: BrachaBroadcastMixin
    1.11        :members:
    1.12  
     2.1 --- a/viff/active.py	Mon Sep 15 16:46:41 2008 +0200
     2.2 +++ b/viff/active.py	Mon Sep 15 17:02:40 2008 +0200
     2.3 @@ -413,13 +413,13 @@
     2.4  
     2.5      @increment_pc
     2.6      @preprocess("generate_triple")
     2.7 -    def prss_get_triple(self, field):
     2.8 -        count, result = self.prss_generate_triple(field)
     2.9 +    def get_triple(self, field):
    2.10 +        count, result = self.generate_triple(field)
    2.11          result.addCallback(lambda triples: triples[0])
    2.12          return result
    2.13  
    2.14      @increment_pc
    2.15 -    def prss_generate_triple(self, field):
    2.16 +    def generate_triple(self, field):
    2.17          """Generate a multiplication triple using PRSS.
    2.18  
    2.19          These are random numbers *a*, *b*, and *c* such that ``c =
    2.20 @@ -442,11 +442,15 @@
    2.21          return 1, succeed([(a_t, b_t, c_t)])
    2.22  
    2.23  
    2.24 -class ActiveRuntime(Runtime, TriplesPRSSMixin):
    2.25 -    """A runtime secure against active adversaries.
    2.26 +class BasicActiveRuntime(Runtime):
    2.27 +    """Basic runtime secure against active adversaries.
    2.28  
    2.29 -    This class currently inherits most of its functionality from the
    2.30 -    normal :class:`Runtime` class and is thus **not** yet secure.
    2.31 +    This class depends on either
    2.32 +    :class:`TriplesHyperinvertibleMatricesMixin` or
    2.33 +    :class:`TriplesPRSSMixin` to provide a :meth:`get_triple` method.
    2.34 +
    2.35 +    Instead of using this class directly, one should probably use
    2.36 +    :class:`ActiveRuntime` instead.
    2.37      """
    2.38  
    2.39      @increment_pc
    2.40 @@ -494,8 +498,14 @@
    2.41          # This will be the result, a Share object.
    2.42          result = Share(self, share_x.field)
    2.43          # This is the Deferred we will do processing on.
    2.44 -        triple = self.prss_get_triple(share_x.field)
    2.45 +        triple = self.get_triple(share_x.field)
    2.46          self.schedule_callback(triple, finish_mul)
    2.47          # We add the result to the chains in triple.
    2.48          triple.chainDeferred(result)
    2.49          return result
    2.50 +
    2.51 +
    2.52 +class ActiveRuntime(BasicActiveRuntime, TriplesPRSSMixin):
    2.53 +    """Default mix of :class:`BasicActiveRuntime` and
    2.54 +    :class:`TriplesPRSSMixin`."""
    2.55 +    pass