forked from data61/MP-SPDZ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MaliciousRepSecret.h
109 lines (85 loc) · 2.18 KB
/
MaliciousRepSecret.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
* MaliciousRepSecret.h
*
*/
#ifndef GC_MALICIOUSREPSECRET_H_
#define GC_MALICIOUSREPSECRET_H_
#include "ShareSecret.h"
#include "Machine.h"
#include "ThreadMaster.h"
#include "Protocols/Beaver.h"
#include "Protocols/MaliciousRepMC.h"
#include "Processor/DummyProtocol.h"
template<class T> class MaliciousRepMC;
namespace GC
{
template<class T> class ShareThread;
template<class T> class RepPrep;
class SmallMalRepSecret : public FixedVec<BitVec_<unsigned char>, 2>
{
typedef FixedVec<BitVec_<unsigned char>, 2> super;
typedef SmallMalRepSecret This;
public:
typedef MaliciousRepMC<This> MC;
typedef BitVec_<unsigned char> open_type;
typedef open_type clear;
typedef NoValue mac_key_type;
static MC* new_mc(mac_key_type)
{
return new HashMaliciousRepMC<This>;
}
SmallMalRepSecret()
{
}
template<class T>
SmallMalRepSecret(const T& other) :
super(other)
{
}
This lsb() const
{
return *this & 1;
}
};
template<class U>
class MalRepSecretBase : public ReplicatedSecret<U>
{
typedef ReplicatedSecret<U> super;
public:
typedef Memory<U> DynamicMemory;
typedef MaliciousRepMC<U> MC;
typedef MC MAC_Check;
typedef ReplicatedInput<U> Input;
typedef RepPrep<U> LivePrep;
typedef U part_type;
typedef U whole_type;
static const bool expensive_triples = true;
static MC* new_mc(typename super::mac_key_type)
{
try
{
if (ThreadMaster<U>::s().machine.more_comm_less_comp)
return new CommMaliciousRepMC<U>;
}
catch(no_singleton& e)
{
}
return new HashMaliciousRepMC<U>;
}
MalRepSecretBase() {}
template<class T>
MalRepSecretBase(const T& other) : super(other) {}
};
class MaliciousRepSecret : public MalRepSecretBase<MaliciousRepSecret>
{
typedef MaliciousRepSecret This;
typedef MalRepSecretBase<This> super;
public:
typedef Beaver<MaliciousRepSecret> Protocol;
typedef SmallMalRepSecret small_type;
MaliciousRepSecret() {}
template<class T>
MaliciousRepSecret(const T& other) : super(other) {}
};
}
#endif /* GC_MALICIOUSREPSECRET_H_ */