/rev/d93acdb61f34
changeset: 1370:d93acdb61f34
user: Janus Dam Nielsen <[email protected]>
date: Thu Oct 29 13:46:21 2009 +0100
summary: Orlandi: Use NaCl Paillier, if available.
diffstat:
viff/orlandi.py | 6 +++++-
viff/test/test_orlandi_runtime.py | 21 ++++++++++++++++++++-
viff/test/util.py | 5 ++++-
3 files changed, 29 insertions(+), 3 deletions(-)
diffs (97 lines):
diff -r 7115ba16f72a -r d93acdb61f34 viff/orlandi.py
--- a/viff/orlandi.py Thu Oct 29 13:46:21 2009 +0100
+++ b/viff/orlandi.py Thu Oct 29 13:46:21 2009 +0100
@@ -28,6 +28,7 @@
from hash_broadcast import HashBroadcastMixin
try:
+ from pypaillier import encrypt_r, decrypt
import commitment
commitment.set_reference_string(23434347834783478783478L,
489237823478234783478020L)
@@ -36,7 +37,10 @@
# import to work. Catching the ImportError here allows the
# benchmark and tests to import viff.orlandi without blowing up.
# It is only if the OrlandiRuntime is used that things blow up.
- pass
+
+ # The pypaillier module is not released yet, so we cannot expect
+ # the import to work.
+ from viff.paillier import encrypt_r, decrypt
# import logging
# LOG_FILENAME = 'logging_example.out'
diff -r 7115ba16f72a -r d93acdb61f34 viff/test/test_orlandi_runtime.py
--- a/viff/test/test_orlandi_runtime.py Thu Oct 29 13:46:21 2009 +0100
+++ b/viff/test/test_orlandi_runtime.py Thu Oct 29 13:46:21 2009 +0100
@@ -19,6 +19,9 @@
from viff.test.util import RuntimeTestCase, protocol
from viff.runtime import gather_shares, Share
+from viff.paillierutil import NaClPaillier
+from viff.config import generate_configs
+
try:
from viff.orlandi import OrlandiRuntime, OrlandiShare
import commitment
@@ -255,6 +258,9 @@
return d
+keys = None
+
+
class OrlandiAdvancedCommandsTest(RuntimeTestCase):
"""Test for advanced commands."""
@@ -263,7 +269,14 @@
runtime_class = OrlandiRuntime
- timeout = 700
+ timeout = 25
+
+ def generate_configs(self, *args):
+ global keys
+ if not keys:
+ keys = generate_configs(*args, paillier=NaClPaillier(1024))
+ return keys
+
@protocol
def test_shift(self, runtime):
@@ -623,6 +636,12 @@
timeout = 1600
+ def generate_configs(self, *args):
+ global keys
+ if not keys:
+ keys = generate_configs(*args, paillier=NaClPaillier(1024))
+ return keys
+
@protocol
def test_tripleGen(self, runtime):
"""Test the triple_gen command."""
diff -r 7115ba16f72a -r d93acdb61f34 viff/test/util.py
--- a/viff/test/util.py Thu Oct 29 13:46:21 2009 +0100
+++ b/viff/test/util.py Thu Oct 29 13:46:21 2009 +0100
@@ -111,6 +111,9 @@
msg = "Type should be %s, but is %s" % (wanted_type, var.__class__)
raise self.failureException(msg)
+ def generate_configs(self, *args):
+ return generate_configs(*args)
+
def setUp(self):
"""Configure and connect three Runtimes.
@@ -123,7 +126,7 @@
# Our standard 65 bit Blum prime
self.Zp = GF(30916444023318367583)
- configs = generate_configs(self.num_players, self.threshold)
+ configs = self.generate_configs(self.num_players, self.threshold)
self.protocols = {}
# initialize the dictionary of random generators
_______________________________________________
viff-commits mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-commits-viff.dk