Skip to content

Commit 6a42453

Browse files
committed
SoftSpokenOT.
1 parent e08a6ad commit 6a42453

File tree

171 files changed

+2179
-1023
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+2179
-1023
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,7 @@ _build/
119119

120120
# environment
121121
.env
122+
123+
# temp doc files
124+
doc/readme.md
125+
doc/xml

.gitmodules

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
[submodule "SimpleOT"]
2-
path = SimpleOT
2+
path = deps/SimpleOT
33
url = https://github.com/mkskeller/SimpleOT
44
[submodule "mpir"]
5-
path = mpir
5+
path = deps/mpir
66
url = https://github.com/wbhart/mpir
77
[submodule "Programs/Circuits"]
88
path = Programs/Circuits
99
url = https://github.com/mkskeller/bristol-fashion
1010
[submodule "simde"]
11-
path = simde
11+
path = deps/simde
1212
url = https://github.com/simd-everywhere/simde
13+
[submodule "deps/libOTe"]
14+
path = deps/libOTe
15+
url = https://github.com/mkskeller/softspoken-implementation
16+
[submodule "deps/SimplestOT_C"]
17+
path = deps/SimplestOT_C
18+
url = https://github.com/mkskeller/SimplestOT_C

BMR/Party.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ FakeProgramParty::FakeProgramParty(int argc, const char** argv) :
249249
}
250250
cout << "Compiler: " << prev << endl;
251251
P = new PlainPlayer(N, 0);
252+
Share<gf2n_long>::MAC_Check::setup(*P);
252253
if (argc > 4)
253254
threshold = atoi(argv[4]);
254255
cout << "Threshold for multi-threaded evaluation: " << threshold << endl;
@@ -280,6 +281,7 @@ FakeProgramParty::~FakeProgramParty()
280281
cerr << "Dynamic storage: " << 1e-9 * dynamic_memory.capacity_in_bytes()
281282
<< " GB" << endl;
282283
#endif
284+
Share<gf2n_long>::MAC_Check::teardown();
283285
}
284286

285287
void FakeProgramParty::_compute_prfs_outputs(Key* keys)

BMR/RealGarbleWire.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ class RealGarbleWire : public PRFRegister
4848
static void inputbvec(GC::Processor<GC::Secret<RealGarbleWire>>& processor,
4949
ProcessorBase& input_processor, const vector<int>& args);
5050

51-
RealGarbleWire(const Register& reg) : PRFRegister(reg) {}
52-
5351
void garble(PRFOutputs& prf_output, const RealGarbleWire<T>& left,
5452
const RealGarbleWire<T>& right);
5553

BMR/RealGarbleWire.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void RealGarbleWire<T>::inputbvec(
110110
{
111111
GarbleInputter<T> inputter;
112112
processor.inputbvec(inputter, input_processor, args,
113-
inputter.party.P->my_num());
113+
*inputter.party.P);
114114
}
115115

116116
template<class T>

BMR/RealProgramParty.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ RealProgramParty<T>::RealProgramParty(int argc, const char** argv) :
9797
if (online_opts.live_prep)
9898
{
9999
mac_key.randomize(prng);
100-
if (T::needs_ot)
101-
BaseMachine::s().ot_setups.push_back({*P, true});
102100
prep = new typename T::LivePrep(0, usage);
103101
}
104102
else
@@ -107,6 +105,7 @@ RealProgramParty<T>::RealProgramParty(int argc, const char** argv) :
107105
prep = new Sub_Data_Files<T>(N, prep_dir, usage);
108106
}
109107

108+
T::MAC_Check::setup(*P);
110109
MC = new typename T::MAC_Check(mac_key);
111110

112111
garble_processor.reset(program);
@@ -219,6 +218,7 @@ RealProgramParty<T>::~RealProgramParty()
219218
delete garble_inputter;
220219
delete garble_protocol;
221220
cout << "Data sent = " << data_sent * 1e-6 << " MB" << endl;
221+
T::MAC_Check::teardown();
222222
}
223223

224224
template<class T>

BMR/Register.h

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class Register {
152152
* for pipelining matters.
153153
*/
154154

155-
Register(int n_parties);
155+
Register();
156156

157157
void init(int n_parties);
158158
void init(int rfd, int n_parties);
@@ -278,10 +278,6 @@ class ProgramRegister : public Phase, public Register
278278

279279
static int threshold(int) { throw not_implemented(); }
280280

281-
static Register new_reg();
282-
static Register tmp_reg() { return new_reg(); }
283-
static Register and_reg() { return new_reg(); }
284-
285281
template<class T>
286282
static void store(NoMemory& dest,
287283
const vector<GC::WriteAccess<T> >& accesses) { (void)dest; (void)accesses; }
@@ -306,8 +302,6 @@ class ProgramRegister : public Phase, public Register
306302
void other_input(Input&, int) {}
307303

308304
char get_output() { return 0; }
309-
310-
ProgramRegister(const Register& reg) : Register(reg) {}
311305
};
312306

313307
class PRFRegister : public ProgramRegister
@@ -319,8 +313,6 @@ class PRFRegister : public ProgramRegister
319313
static void load(vector<GC::ReadAccess<T> >& accesses,
320314
const NoMemory& source);
321315

322-
PRFRegister(const Register& reg) : ProgramRegister(reg) {}
323-
324316
void op(const PRFRegister& left, const PRFRegister& right, Function func);
325317
void XOR(const Register& left, const Register& right);
326318
void input(party_id_t from, char input = -1);
@@ -396,8 +388,6 @@ class EvalRegister : public ProgramRegister
396388
static void convcbit(Integer& dest, const GC::Clear& source,
397389
GC::Processor<GC::Secret<EvalRegister>>& proc);
398390

399-
EvalRegister(const Register& reg) : ProgramRegister(reg) {}
400-
401391
void op(const ProgramRegister& left, const ProgramRegister& right, Function func);
402392
void XOR(const Register& left, const Register& right);
403393

@@ -427,8 +417,6 @@ class GarbleRegister : public ProgramRegister
427417
static void load(vector<GC::ReadAccess<T> >& accesses,
428418
const NoMemory& source);
429419

430-
GarbleRegister(const Register& reg) : ProgramRegister(reg) {}
431-
432420
void op(const Register& left, const Register& right, Function func);
433421
void XOR(const Register& left, const Register& right);
434422
void input(party_id_t from, char value = -1);
@@ -452,8 +440,6 @@ class RandomRegister : public ProgramRegister
452440
static void load(vector<GC::ReadAccess<T> >& accesses,
453441
const NoMemory& source);
454442

455-
RandomRegister(const Register& reg) : ProgramRegister(reg) {}
456-
457443
void randomize();
458444

459445
void op(const Register& left, const Register& right, Function func);
@@ -469,12 +455,6 @@ class RandomRegister : public ProgramRegister
469455
};
470456

471457

472-
inline Register::Register(int n_parties) :
473-
garbled_entry(n_parties), external(NO_SIGNAL),
474-
mask(NO_SIGNAL), keys(n_parties)
475-
{
476-
}
477-
478458
inline void KeyVector::operator=(const KeyVector& other)
479459
{
480460
resize(other.size());

BMR/Register.hpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,7 @@ void ProgramRegister::inputbvec(T& processor, ProcessorBase& input_processor,
1414
const vector<int>& args)
1515
{
1616
NoOpInputter inputter;
17-
int my_num = -1;
18-
try
19-
{
20-
my_num = ProgramParty::s().P->my_num();
21-
}
22-
catch (exception&)
23-
{
24-
}
25-
processor.inputbvec(inputter, input_processor, args, my_num);
17+
processor.inputbvec(inputter, input_processor, args, *ProgramParty::s().P);
2618
}
2719

2820
template<class T>
@@ -31,7 +23,7 @@ void EvalRegister::inputbvec(T& processor, ProcessorBase& input_processor,
3123
{
3224
EvalInputter inputter;
3325
processor.inputbvec(inputter, input_processor, args,
34-
ProgramParty::s().P->my_num());
26+
*ProgramParty::s().P);
3527
}
3628

3729
template <class T>

BMR/Register_inline.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
#include "CommonParty.h"
1010
#include "Party.h"
1111

12-
13-
inline Register ProgramRegister::new_reg()
12+
inline Register::Register() :
13+
garbled_entry(CommonParty::s().get_n_parties()), external(NO_SIGNAL),
14+
mask(NO_SIGNAL), keys(CommonParty::s().get_n_parties())
1415
{
15-
return Register(CommonParty::s().get_n_parties());
1616
}
1717

1818
#endif /* BMR_REGISTER_INLINE_H_ */

CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
The changelog explains changes pulled through from the private development repository. Bug fixes and small enhancements are committed between releases and not documented here.
22

3+
## 0.3.3 (Aug 25, 2022)
4+
5+
- Use SoftSpokenOT to avoid unclear security of KOS OT extension candidate
6+
- Fix security bug in MAC check when using multithreading
7+
- Fix security bug to prevent selective failure attack by checking earlier
8+
- Fix security bug in Mama: insufficient sacrifice.
9+
- Inverse permutation (@Quitlox)
10+
- Easier direct compilation (@eriktaubeneck)
11+
- Generally allow element-vector operations
12+
- Increase maximum register size to 2^54
13+
- Client example in Python
14+
- Uniform base OTs across platforms
15+
- Multithreaded base OT computation
16+
- Faster random bit generation in two-player Semi(2k)
17+
318
## 0.3.2 (May 27, 2022)
419

520
- Secure shuffling
621
- O(n log n) radix sorting
722
- Documented BGV encryption interface
823
- Optimized matrix multiplication in dealer protocol
924
- Fixed security bug in homomorphic encryption parameter generation
10-
- Fixed Security bug in Temi matrix multiplication
25+
- Fixed security bug in Temi matrix multiplication
1126

1227
## 0.3.1 (Apr 19, 2022)
1328

0 commit comments

Comments
 (0)