Skip to content

Commit 92a3fb0

Browse files
committed
edaBits, ChaiGear, TopGear, CCD.
1 parent 7d44986 commit 92a3fb0

File tree

285 files changed

+8250
-1466
lines changed

Some content is hidden

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

285 files changed

+8250
-1466
lines changed

BMR/Register.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ class Phase
233233
template <class T>
234234
static void ands(T& processor, const vector<int>& args) { processor.ands(args); }
235235
template <class T>
236+
static void xors(T& processor, const vector<int>& args) { processor.xors(args); }
237+
template <class T>
236238
static void inputb(T& processor, const vector<int>& args) { processor.input(args); }
237239
template <class T>
238240
static T get_input(int from, GC::Processor<T>& processor, int n_bits)

BMR/common.h

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <vector>
1212
using namespace std;
1313

14+
#include "Tools/CheckVector.h"
15+
1416
typedef unsigned long wire_id_t;
1517
typedef unsigned long gate_id_t;
1618
typedef unsigned int party_id_t;
@@ -37,20 +39,4 @@ class Function {
3739
bool call(bool left, bool right) { return rep[2 * left + right]; }
3840
};
3941

40-
template <class T>
41-
class CheckVector : public vector<T>
42-
{
43-
public:
44-
CheckVector() : vector<T>() {}
45-
CheckVector(size_t size) : vector<T>(size) {}
46-
CheckVector(size_t size, const T& def) : vector<T>(size, def) {}
47-
#ifdef CHECK_SIZE
48-
T& operator[](size_t i) { return this->at(i); }
49-
const T& operator[](size_t i) const { return this->at(i); }
50-
#else
51-
T& at(size_t i) { return (*this)[i]; }
52-
const T& at(size_t i) const { return (*this)[i]; }
53-
#endif
54-
};
55-
5642
#endif /* CIRCUIT_INC_COMMON_H_ */

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
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.1.5 (Mar 20, 2020)
4+
5+
- Faster conversion between arithmetic and binary secret sharing using [extended daBits](https://eprint.iacr.org/2020/338)
6+
- Optimized daBits
7+
- Optimized logistic regression
8+
- Faster compilation of repetitive code (compiler option `-C`)
9+
- ChaiGear: [HighGear](https://eprint.iacr.org/2017/1230) with covert key generation
10+
- [TopGear](https://eprint.iacr.org/2019/035) zero-knowledge proofs
11+
- Binary computation based on Shamir secret sharing
12+
- Fixed security bug: Prove correctness of ciphertexts in input tuple generation
13+
- Fixed security bug: Missing check in MASCOT bit generation and various binary computations
14+
315
## 0.1.4 (Dec 23, 2019)
416

517
- Mixed circuit computation with secret sharing

Compiler/GC/instructions.py

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class ClearBitsAF(base.RegisterArgFormat):
3636
STMSBI = 0x243,
3737
MOVSB = 0x244,
3838
INPUTB = 0x246,
39+
SPLIT = 0x248,
40+
CONVCBIT2S = 0x249,
3941
XORCBI = 0x210,
4042
BITDECC = 0x211,
4143
CONVCINT = 0x213,
@@ -49,15 +51,23 @@ class ClearBitsAF(base.RegisterArgFormat):
4951
MULCBI = 0x21c,
5052
SHRCBI = 0x21d,
5153
SHLCBI = 0x21e,
54+
CONVCINTVEC = 0x21f,
5255
PRINTREGSIGNED = 0x220,
5356
PRINTREGB = 0x221,
5457
PRINTREGPLAINB = 0x222,
5558
PRINTFLOATPLAINB = 0x223,
5659
CONDPRINTSTRB = 0x224,
5760
CONVCBIT = 0x230,
61+
CONVCBITVEC = 0x231,
5862
)
5963

60-
class xors(base.Instruction):
64+
class BinaryVectorInstruction(base.Instruction):
65+
is_vec = lambda self: True
66+
67+
def copy(self, size, subs):
68+
return type(self)(*self.get_new_args(size, subs))
69+
70+
class xors(BinaryVectorInstruction):
6171
code = opcodes['XORS']
6272
arg_format = tools.cycle(['int','sbw','sb','sb'])
6373

@@ -73,15 +83,21 @@ class xorcbi(base.Instruction):
7383
code = opcodes['XORCBI']
7484
arg_format = ['cbw','cb','int']
7585

76-
class andrs(base.Instruction):
86+
class andrs(BinaryVectorInstruction):
7787
code = opcodes['ANDRS']
7888
arg_format = tools.cycle(['int','sbw','sb','sb'])
7989

80-
class ands(base.Instruction):
90+
def add_usage(self, req_node):
91+
req_node.increment(('bit', 'triple'), sum(self.args[::4]))
92+
93+
class ands(BinaryVectorInstruction):
8194
code = opcodes['ANDS']
8295
arg_format = tools.cycle(['int','sbw','sb','sb'])
8396

84-
class andm(base.Instruction):
97+
def add_usage(self, req_node):
98+
req_node.increment(('bit', 'triple'), sum(self.args[::4]))
99+
100+
class andm(BinaryVectorInstruction):
85101
code = opcodes['ANDM']
86102
arg_format = ['int','sbw','sb','cb']
87103

@@ -181,6 +197,31 @@ class convcbit(base.Instruction):
181197
code = opcodes['CONVCBIT']
182198
arg_format = ['ciw','cb']
183199

200+
@base.vectorize
201+
class convcintvec(base.Instruction):
202+
code = opcodes['CONVCINTVEC']
203+
arg_format = tools.chain(['c'], tools.cycle(['cbw']))
204+
205+
class convcbitvec(BinaryVectorInstruction):
206+
code = opcodes['CONVCBITVEC']
207+
arg_format = ['int','ciw','cb']
208+
def __init__(self, *args):
209+
super(convcbitvec, self).__init__(*args)
210+
assert(args[2].n == args[0])
211+
args[1].set_size(args[0])
212+
213+
class convcbit2s(BinaryVectorInstruction):
214+
code = opcodes['CONVCBIT2S']
215+
arg_format = ['int','sbw','cb']
216+
217+
@base.vectorize
218+
class split(base.Instruction):
219+
code = opcodes['SPLIT']
220+
arg_format = tools.chain(['int','s'], tools.cycle(['sbw']))
221+
def __init__(self, *args, **kwargs):
222+
super(split_class, self).__init__(*args, **kwargs)
223+
assert (len(args) - 2) % args[0] == 0
224+
184225
class movsb(base.Instruction):
185226
code = opcodes['MOVSB']
186227
arg_format = ['sbw','sb']
@@ -196,9 +237,9 @@ class bitb(base.Instruction):
196237
code = opcodes['BITB']
197238
arg_format = ['sbw']
198239

199-
class reveal(base.Instruction):
240+
class reveal(BinaryVectorInstruction, base.VarArgsInstruction, base.Mergeable):
200241
code = opcodes['REVEAL']
201-
arg_format = ['int','cbw','sb']
242+
arg_format = tools.cycle(['int','cbw','sb'])
202243

203244
class inputb(base.DoNotEliminateInstruction, base.VarArgsInstruction):
204245
__slots__ = []

0 commit comments

Comments
 (0)