def start(parent_pipe=None): """The 'main' function of tasty. @type parent_pipe: multiprocessing.Pipe @keyword parent_pipe: An optional communication socket with an instrumenting parent process. """ state.parent_pipe = parent_pipe create_configuration() utils.init_log() validate_configuration() cost_results.CostSystem.get_costs() old_path = sys.path sys.path = [ state.config.protocol_dir, ] + sys.path # keep this import since we need all custom classes be registered before # compiler run if state.config.server: protocol_mode.process_server_mode() else: protocol_mode.process_client_mode() sys.path = old_path if __debug__: state.log.info("done - bye...")
def suite(): config.create_configuration(host="::1", port=8000, symmetric_security_parameter=80, asymmetric_security_parameter=1024, protocol_dir="/tmp", ot_chain=[ PaillierOT, ]) state.R = generate_R() suite = unittest.TestSuite() suite.addTest(InternalProtocolTestCase("test_transport")) suite.addTest(InternalProtocolTestCase("test_dummyot")) suite.addTest(InternalProtocolTestCase("test_paillierot")) suite.addTest(InternalProtocolTestCase("test_gcproto")) return suite
def setUp(self): state.config = config.create_configuration( security_level="short", asymmetric_security_parameter=1024, symmetric_security_parameter=80, ot_type="EC", host="::1", port=8000, protocol_dir="docs/millionaires_problem/") state.config.ot_chain = [PaillierOT]
def setUp(self): """Sets tasty config t o something meaningfull""" state.config = config.create_configuration( protocol_dir=self._protocol_dir, host="::1", port=9000, asymmetric_security_parameter=1024, symmetric_security_parameter=80, client=True) public_key, secret_key = key.generate_keys(1024) clean_tmpfiles()
def test_garbledconversions(self): """ simple server plain -> garbled -> plain test """ state.config = config.create_configuration( host="::1", port=8000, symmetric_security_parameter=80, asymetric_security_parameter=1024, protocol_dir="docs/millionaires_problem/") state.role = Party.SERVER state.R = generate_R() state.precompute = True p = state.active_party = Party(role=Party.SERVER, sock=None) p.gx = Garbled(bitlen=32, val=0) state.precompute = False val = 132421 p.x = Unsigned(length=32, val=val) p.gx = Garbled(length=32, val=p.x) p.rx = Unsigned(length=32, val=p.gx) self.assertEqual(p.x, p.rx)
def setUp(self): state.config = config.create_configuration(host="::1", port=8000, symmetric_security_parameter=80, asymmetric_security_parameter=1024, testing=True, protocol_dir=".") state.config.ot_chain = [PaillierOT] state.R = generate_R()
# -*- coding: utf-8 -*- from tasty import state, config class blah(object): pass state.config = config.create_configuration( host="::1", port=8000, security_level="short", asymmetric_security_parameter=1024, symmetric_security_parameter=80, protocol_dir="", ) import unittest import cPickle import random from copy import copy from gmpy import mpz from tasty.types import * from tasty.types.key import generate_keys from tasty.types import ModularVec from tasty.types import PaillierVec from tasty.types import key from tasty import cost_results
# -*- coding: utf-8 -*- from tasty.types import * from tasty import state from tasty import utils from tasty import config from tasty.types.key import generate_keys from tasty import cost_results state.config = config.create_configuration( host="::1", port=8000, client=True, verbose=2, symmetric_security_parameter=80, asymmetric_security_parameter=1024, testing=True, protocol_dir=utils.tasty_path("debug/dummy_protocol")) cost_results.CostSystem.create_costs() p, state.key = generate_keys(1024) utils.init_log() config.validate_configuration()