-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBeaver.mli
More file actions
66 lines (48 loc) · 2.3 KB
/
Copy pathBeaver.mli
File metadata and controls
66 lines (48 loc) · 2.3 KB
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
(** MPC with two participants and Boolean gates *)
(* Copyright Xavier Leroy.
License: LGPL 2.1 or later with OCaml LGPL Linking Exception *)
(** Using multiplicative triples as introduced in Beaver, 1991. *)
(** The computation is performed jointly by participants 1 and 2.
Participant 0 can share data with 1 and 2, and produces the initial
triples, but does not participate in the main computation. *)
type share
(** A Boolean value [b] is shared as two booleans [b1], [b2]
such that [b = b1 xor b2]. *)
val initialize: int -> unit
(** Initialization, to be performed by all three participants
(0, 1 and 2). Participant #0 produces multiplicative triples
and shares them with participants #1 and #2.
The integer argument is the number of triples to produce.
It must be at least as large as the number of nonlinear
Boolean operations that will be evaluated later. *)
val false_ : share
(** A share of [false]. *)
val true_ : share
(** A share of [true]. *)
val send : bool -> unit
(** To be executed by participant #0.
Send shares of the given Boolean to participants #1 and #2. *)
val receive : unit -> share
(** To be executed by participants #1 and #2.
Receive a share of the Boolean sent by participant #0. *)
val share : bool -> share * share
(** Share a secret [a] of participant #1 and a secret [b] of
participant #2. Both participants receive a pair of
a share of [a] and a share of [b]. *)
val reveal : share -> bool
(** Participants #1 and #2 put their shares of a Boolean in common.
Both participants learn the value of this Boolean. *)
val xor : share -> share -> share
(** Exclusive OR of two shared Booleans. Local computation. *)
val not : share -> share
(** Negation of a shared Boolean. Local computation. *)
val and_ : share -> share -> share
(** AND of two shared Booleans. Consumes one triple. *)
val or_ : share -> share -> share
(** OR of two shared Booleans. Consumes one triple. *)
val nand : share -> share -> share
(** Negated AND of two shared Booleans.
Consumes one triple. *)
val nor : share -> share -> share
(** Negated OR of two shared Booleans.
Consumes one triple. *)