viff

changeset 1389:eb56e865f32b

active: let _verify_double use _verify_single
author Martin Geisler <mg@cs.au.dk>
date Thu, 05 Nov 2009 11:29:48 +0100
parents 1f0250d3bd69
children b4b94221beee
files viff/active.py
diffstat 1 files changed, 2 insertions(+), 16 deletions(-) [+]
line diff
     1.1 --- a/viff/active.py	Wed Nov 04 16:09:17 2009 +0100
     1.2 +++ b/viff/active.py	Thu Nov 05 11:29:48 2009 +0100
     1.3 @@ -196,15 +196,8 @@
     1.4          otherwise the errback is called.
     1.5          """
     1.6          shares = map(lambda (i, s): (field(i+1), s), enumerate(shares))
     1.7 -
     1.8 -        # Verify the sharings. If any of the assertions fail and
     1.9 -        # raise an exception, the errbacks will be called on the
    1.10 -        # share returned by single_share_random.
    1.11          assert shamir.verify_sharing(shares, degree), \
    1.12                 "Could not verify %s, degree %d" % (shares, degree)
    1.13 -
    1.14 -        # If we reach this point the n - T shares were verified
    1.15 -        # and we can safely return the first T shares.
    1.16          return rvec[:T]
    1.17  
    1.18      def _verify_double(self, shares, rvec1, rvec2, T, field, d1, d2):
    1.19 @@ -218,21 +211,14 @@
    1.20          returned, otherwise the errback is called.
    1.21          """
    1.22          si_1, si_2 = shares
    1.23 +        self._verify_single(si_1, rvec1, T, field, d1)
    1.24 +        self._verify_single(si_2, rvec2, T, field, d2)
    1.25          si_1 = map(lambda (i, s): (field(i+1), s), enumerate(si_1))
    1.26          si_2 = map(lambda (i, s): (field(i+1), s), enumerate(si_2))
    1.27  
    1.28 -        # Verify the sharings. If any of the assertions fail and
    1.29 -        # raise an exception, the errbacks will be called on the
    1.30 -        # double share returned by double_share_random.
    1.31 -        assert shamir.verify_sharing(si_1, d1), \
    1.32 -               "Could not verify %s, degree %d" % (si_1, d1)
    1.33 -        assert shamir.verify_sharing(si_2, d2), \
    1.34 -               "Could not verify %s, degree %d" % (si_2, d2)
    1.35          assert shamir.recombine(si_1[:d1+1]) == shamir.recombine(si_2[:d2+1]), \
    1.36              "Shares do not recombine to the same value"
    1.37  
    1.38 -        # If we reach this point the n - T shares were verified
    1.39 -        # and we can safely return the first T shares.
    1.40          return (rvec1[:T], rvec2[:T])
    1.41  
    1.42      def _exchange_single(self, svec, rvec, T, field, degree):