mirror of
https://github.com/data61/MP-SPDZ.git
synced 2026-04-20 03:01:31 -04:00
59 lines
1.7 KiB
C++
59 lines
1.7 KiB
C++
/*
|
|
* ReplicatedMachine.cpp
|
|
*
|
|
*/
|
|
|
|
#include "Tools/ezOptionParser.h"
|
|
#include "Tools/benchmarking.h"
|
|
#include "Tools/NetworkOptions.h"
|
|
#include "Networking/Server.h"
|
|
#include "Protocols/Rep3Share.h"
|
|
#include "Processor/Machine.h"
|
|
#include "ReplicatedMachine.h"
|
|
|
|
template<class T, class U>
|
|
ReplicatedMachine<T, U>::ReplicatedMachine(int argc, const char** argv,
|
|
string name, ez::ezOptionParser& opt, int nplayers)
|
|
{
|
|
(void) name;
|
|
|
|
OnlineOptions online_opts(opt, argc, argv, 10000, true, T::clear::invertible);
|
|
ReplicatedMachine<T, U>(argc, argv, opt, online_opts, nplayers);
|
|
}
|
|
|
|
template<class T, class U>
|
|
ReplicatedMachine<T, U>::ReplicatedMachine(int argc, const char** argv,
|
|
ez::ezOptionParser& opt, OnlineOptions& online_opts,
|
|
int nplayers)
|
|
{
|
|
OnlineOptions::singleton = online_opts;
|
|
NetworkOptionsWithNumber network_opts(opt, argc, argv, nplayers, false);
|
|
opt.add(
|
|
"", // Default.
|
|
0, // Required?
|
|
0, // Number of args expected.
|
|
0, // Delimiter if expecting multiple args.
|
|
"Unencrypted communication.", // Help description.
|
|
"-u", // Flag token.
|
|
"--unencrypted" // Flag token.
|
|
);
|
|
online_opts.finalize(opt, argc, argv);
|
|
|
|
int playerno = online_opts.playerno;
|
|
string progname = online_opts.progname;
|
|
|
|
bool use_encryption = not opt.get("-u")->isSet;
|
|
|
|
if (not use_encryption)
|
|
insecure("unencrypted communication");
|
|
Names N;
|
|
Server* server = network_opts.start_networking(N, playerno);
|
|
|
|
Machine<T, U>(playerno, N, progname, online_opts.memtype,
|
|
gf2n::default_degree(), 0, 0, 0, 0, use_encryption,
|
|
online_opts.live_prep, online_opts).run();
|
|
|
|
if (server)
|
|
delete server;
|
|
}
|