mirror of
https://github.com/data61/MP-SPDZ.git
synced 2026-01-09 13:37:58 -05:00
Respect direct-communication option in Tinier and CCD.
This commit is contained in:
@@ -26,7 +26,8 @@ public:
|
||||
typedef ReplicatedPrep<This> LivePrep;
|
||||
typedef ShamirInput<This> Input;
|
||||
|
||||
typedef ShamirMC<This> MAC_Check;
|
||||
typedef IndirectShamirMC<This> MAC_Check;
|
||||
typedef ShamirMC<This> Direct_MC;
|
||||
typedef Shamir<This> Protocol;
|
||||
|
||||
typedef This small_type;
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
typedef Beaver<This> Protocol;
|
||||
|
||||
typedef MaliciousShamirMC<This> MAC_Check;
|
||||
typedef MAC_Check Direct_MC;
|
||||
|
||||
typedef This small_type;
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
typedef This bit_prep_type;
|
||||
|
||||
typedef MAC_Check_<This> MAC_Check;
|
||||
typedef Direct_MAC_Check<This> Direct_MC;
|
||||
typedef TinierSharePrep<This> LivePrep;
|
||||
typedef ::Input<This> Input;
|
||||
typedef Beaver<This> Protocol;
|
||||
|
||||
29
GC/TinyMC.h
29
GC/TinyMC.h
@@ -7,6 +7,7 @@
|
||||
#define GC_TINYMC_H_
|
||||
|
||||
#include "Protocols/MAC_Check_Base.h"
|
||||
#include "Processor/OnlineOptions.h"
|
||||
|
||||
namespace GC
|
||||
{
|
||||
@@ -14,7 +15,7 @@ namespace GC
|
||||
template<class T>
|
||||
class TinyMC : public MAC_Check_Base<T>
|
||||
{
|
||||
typename T::part_type::MAC_Check part_MC;
|
||||
typename T::part_type::MAC_Check* part_MC;
|
||||
PointerVector<int> sizes;
|
||||
|
||||
public:
|
||||
@@ -28,20 +29,30 @@ public:
|
||||
T::part_type::MAC_Check::teardown();
|
||||
}
|
||||
|
||||
TinyMC(typename T::mac_key_type mac_key) :
|
||||
part_MC(mac_key)
|
||||
TinyMC(typename T::mac_key_type mac_key)
|
||||
{
|
||||
this->alphai = mac_key;
|
||||
|
||||
if (OnlineOptions::singleton.direct)
|
||||
part_MC = new typename T::part_type::Direct_MC(mac_key);
|
||||
else
|
||||
part_MC = new typename T::part_type::MAC_Check(mac_key);
|
||||
|
||||
}
|
||||
|
||||
~TinyMC()
|
||||
{
|
||||
delete part_MC;
|
||||
}
|
||||
|
||||
typename T::part_type::MAC_Check& get_part_MC()
|
||||
{
|
||||
return part_MC;
|
||||
return *part_MC;
|
||||
}
|
||||
|
||||
void init_open(const Player& P, int n)
|
||||
{
|
||||
part_MC.init_open(P);
|
||||
part_MC->init_open(P);
|
||||
sizes.clear();
|
||||
sizes.reserve(n);
|
||||
}
|
||||
@@ -49,13 +60,13 @@ public:
|
||||
void prepare_open(const T& secret, int = -1)
|
||||
{
|
||||
for (auto& part : secret.get_regs())
|
||||
part_MC.prepare_open(part);
|
||||
part_MC->prepare_open(part);
|
||||
sizes.push_back(secret.get_regs().size());
|
||||
}
|
||||
|
||||
void exchange(const Player& P)
|
||||
{
|
||||
part_MC.exchange(P);
|
||||
part_MC->exchange(P);
|
||||
}
|
||||
|
||||
typename T::open_type finalize_raw()
|
||||
@@ -63,13 +74,13 @@ public:
|
||||
int n = sizes.next();
|
||||
typename T::open_type opened = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
opened += typename T::open_type(part_MC.finalize_raw().get_bit(0)) << i;
|
||||
opened += typename T::open_type(part_MC->finalize_raw().get_bit(0)) << i;
|
||||
return opened;
|
||||
}
|
||||
|
||||
void Check(const Player& P)
|
||||
{
|
||||
part_MC.Check(P);
|
||||
part_MC->Check(P);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user