@atlasauth/pca-mpc 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +65 -2
- package/dist/beaver.d.ts +49 -0
- package/dist/beaver.js +72 -0
- package/dist/beaver.js.map +1 -0
- package/dist/compose.d.ts +21 -0
- package/dist/compose.js +33 -0
- package/dist/compose.js.map +1 -0
- package/dist/csprng.d.ts +46 -0
- package/dist/csprng.js +86 -0
- package/dist/csprng.js.map +1 -0
- package/dist/ec.d.ts +130 -0
- package/dist/ec.js +475 -0
- package/dist/ec.js.map +1 -0
- package/dist/endemic-ot.d.ts +209 -0
- package/dist/endemic-ot.js +405 -0
- package/dist/endemic-ot.js.map +1 -0
- package/dist/field.d.ts +34 -0
- package/dist/field.js +65 -0
- package/dist/field.js.map +1 -0
- package/dist/gf128.d.ts +23 -0
- package/dist/gf128.js +59 -0
- package/dist/gf128.js.map +1 -0
- package/dist/hybrid-ot.d.ts +153 -0
- package/dist/hybrid-ot.js +241 -0
- package/dist/hybrid-ot.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/kem-ot.d.ts +292 -0
- package/dist/kem-ot.js +559 -0
- package/dist/kem-ot.js.map +1 -0
- package/dist/mascot.d.ts +189 -0
- package/dist/mascot.js +322 -0
- package/dist/mascot.js.map +1 -0
- package/dist/ot.d.ts +212 -0
- package/dist/ot.js +536 -0
- package/dist/ot.js.map +1 -0
- package/dist/party.d.ts +38 -0
- package/dist/party.js +40 -0
- package/dist/party.js.map +1 -0
- package/dist/runner.d.ts +56 -0
- package/dist/runner.js +97 -0
- package/dist/runner.js.map +1 -0
- package/dist/sharing.d.ts +40 -0
- package/dist/sharing.js +97 -0
- package/dist/sharing.js.map +1 -0
- package/dist/spdz-runner.d.ts +50 -0
- package/dist/spdz-runner.js +107 -0
- package/dist/spdz-runner.js.map +1 -0
- package/dist/spdz.d.ts +136 -0
- package/dist/spdz.js +243 -0
- package/dist/spdz.js.map +1 -0
- package/dist/thermometer.d.ts +22 -0
- package/dist/thermometer.js +41 -0
- package/dist/thermometer.js.map +1 -0
- package/package.json +58 -3
package/dist/mascot.d.ts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NO-DEALER offline phase (MASCOT-style) — the last trust assumption removed.
|
|
3
|
+
*
|
|
4
|
+
* The SPDZ online layer (`spdz.ts`/`spdz-runner.ts`) is maliciously secure with abort, but until now
|
|
5
|
+
* its *preprocessing* — the global MAC key α, the authenticated Beaver triples, and the authenticated
|
|
6
|
+
* input sharings — came from a TRUSTED DEALER who knew α and generated everything. This module removes
|
|
7
|
+
* that dealer. All preprocessing is derived from real oblivious transfer (`ot.ts`), so:
|
|
8
|
+
*
|
|
9
|
+
* • **The MAC key α is distributed, never reconstructed.** Each party i samples its own share α_i
|
|
10
|
+
* locally; `α = Σ α_i` is a value no party ever holds and the protocol never forms. (The in-process
|
|
11
|
+
* simulator can sum the shares for test assertions — see `MacContext.alpha` — but no per-party view
|
|
12
|
+
* and no protocol step contains α.)
|
|
13
|
+
*
|
|
14
|
+
* • **Beaver triples are generated by the parties from OT, no dealer.** Each party samples its own
|
|
15
|
+
* shares a_i, b_i of two random values; the product share `c = a·b` is obtained by OT-multiplying
|
|
16
|
+
* the share vectors (Gilboa), and the SPDZ MACs on a, b, c are obtained by OT-multiplying α's shares
|
|
17
|
+
* against each value's shares. No party learns a, b or c; no party learns α.
|
|
18
|
+
*
|
|
19
|
+
* ## The one OT-based primitive: `otShareMultiply`
|
|
20
|
+
*
|
|
21
|
+
* Given additive sharings `⟨x⟩ = (x_0,…,x_{n−1})` and `⟨y⟩`, the parties want an additive sharing
|
|
22
|
+
* `⟨z⟩` with `Σ z = (Σ x)(Σ y)`, learning nothing else. Expand:
|
|
23
|
+
*
|
|
24
|
+
* (Σ_i x_i)(Σ_j y_j) = Σ_i x_i·y_i + Σ_{i≠j} x_i·y_j.
|
|
25
|
+
*
|
|
26
|
+
* The diagonal `x_i·y_i` each party computes locally. Each cross term `x_i·y_j` (i≠j) is turned into an
|
|
27
|
+
* additive sharing between party i and party j by **Gilboa's OT multiplication**: party i (holding x_i)
|
|
28
|
+
* is the OT RECEIVER using the bits of x_i as choices; party j (holding y_j) is the OT SENDER. For bit
|
|
29
|
+
* k of x_i, the sender offers `(ρ_k, ρ_k + 2^k·y_j)` for a fresh random ρ_k; the receiver's choice bit
|
|
30
|
+
* `(x_i)_k` selects `ρ_k + (x_i)_k·2^k·y_j`. Summed over k the receiver gets `x_i·y_j + Σρ_k` and the
|
|
31
|
+
* sender keeps `−Σρ_k`, an additive sharing of `x_i·y_j`. Because the OT hides both the choice and the
|
|
32
|
+
* unchosen message, neither party learns the other's share.
|
|
33
|
+
*
|
|
34
|
+
* ## Malicious security (docs §7.1)
|
|
35
|
+
*
|
|
36
|
+
* The OT is now **malicious-secure**: Chou–Orlandi base OT + IKNP extension **with the KOS correlation
|
|
37
|
+
* check** (`ot.ts`), so a cheating OT-extension receiver is caught and the extension aborts. On top of
|
|
38
|
+
* that, triple generation runs the **MASCOT sacrifice**: every delivered triple is generated as a PAIR
|
|
39
|
+
* `(a,b,c)` and `(â,b,ĉ)` sharing `b`, and one is *sacrificed* to check the other under the MACs — a
|
|
40
|
+
* party that fed wrong OT inputs (producing `c ≠ a·b`, even one that is internally MAC-consistent) is
|
|
41
|
+
* caught when the sacrifice residual `τ = e·c − ĉ − (e·a−â)·b` opens to a non-zero value, or when the
|
|
42
|
+
* commit-then-open MAC-check on the sacrifice openings fails. There is also an **input-consistency
|
|
43
|
+
* check** (`checkInputConsistency`): a random masked combination of authenticated inputs is opened and
|
|
44
|
+
* MAC-checked, catching any input whose MAC does not match its value. Both the sacrifice and the input
|
|
45
|
+
* check ABORT (throw `MacCheckAbort`) rather than emit a bad triple / bad input.
|
|
46
|
+
*
|
|
47
|
+
* So the whole stack is now **malicious-with-abort, dishonest-majority** end to end: malicious-secure
|
|
48
|
+
* no-dealer OFFLINE (KOS OT + MASCOT sacrifice + input check, `α` never reconstructed) feeding the
|
|
49
|
+
* malicious-with-abort SPDZ ONLINE phase (the MAC-check still catches any online deviation). The base
|
|
50
|
+
* OTs are themselves malicious-secure (committed Chou–Orlandi: Schnorr PoK + point validation, `ot.ts`
|
|
51
|
+
* / `ec.ts`), and all randomness here is the CSPRNG by DEFAULT — construct `NoDealerOffline` WITHOUT a
|
|
52
|
+
* seed for production (`SecureFieldRng` + `secureOtRandom`); passing a seed selects the deterministic
|
|
53
|
+
* SplitMix64 stream for reproducible tests only. Residual boundary (docs §7.1): just two honestly
|
|
54
|
+
* unavoidable items — constant-time field arithmetic (a native/WASM workstream) and a real async
|
|
55
|
+
* network/transport (including the interactive secure coin-flip for the public MAC-check challenge).
|
|
56
|
+
*/
|
|
57
|
+
import { type SharedValue } from './sharing';
|
|
58
|
+
import { type AuthSV, type AuthTriple, type MacContext } from './spdz';
|
|
59
|
+
/**
|
|
60
|
+
* A TEST-ONLY injection modelling a MALICIOUS party in the OFFLINE phase: when the triple PRODUCT
|
|
61
|
+
* multiplication at index `productMul` runs (0-based, counting only the OT multiplications that form a
|
|
62
|
+
* triple's `c = a·b`), `delta` is XOR... added into one party's product share. The resulting triple has
|
|
63
|
+
* `c = a·b + delta` but is still internally MAC-consistent (the authentication runs on the corrupted
|
|
64
|
+
* share) — exactly the "bad OT input" a malicious party can mount, which MACs ALONE cannot catch and
|
|
65
|
+
* the MASCOT SACRIFICE is designed to catch. Models "corrupting an OT message/share in the offline".
|
|
66
|
+
*/
|
|
67
|
+
export interface OfflineDeviation {
|
|
68
|
+
/** Which triple-product OT multiplication to corrupt (0-based across all products this instance makes). */
|
|
69
|
+
productMul: number;
|
|
70
|
+
/** Field delta added to party 0's product share, making c = a·b + delta (self-consistently MAC'd). */
|
|
71
|
+
delta: bigint;
|
|
72
|
+
}
|
|
73
|
+
/** Options for the no-dealer offline phase. */
|
|
74
|
+
export interface NoDealerOptions {
|
|
75
|
+
/** Run the MASCOT sacrifice on every delivered triple (default true = malicious-secure). */
|
|
76
|
+
sacrifice?: boolean;
|
|
77
|
+
/** A test-only offline deviation (a malicious party corrupting a product share). */
|
|
78
|
+
deviation?: OfflineDeviation;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The no-dealer offline phase for a fixed party count `n`. Holds the distributed MAC key (α_i only),
|
|
82
|
+
* and a reusable set of per-ordered-pair OT-extension channels so the κ base OTs are amortized across
|
|
83
|
+
* every triple and input it produces. Deterministic given its seed (production: a CSPRNG per party).
|
|
84
|
+
*
|
|
85
|
+
* MALICIOUS-secure: the OT extension carries the KOS correlation check (`ot.ts`), and every delivered
|
|
86
|
+
* triple survives the MASCOT sacrifice. `checkInputConsistency` provides the input check.
|
|
87
|
+
*/
|
|
88
|
+
export declare class NoDealerOffline {
|
|
89
|
+
readonly n: number;
|
|
90
|
+
/** α_i: party i's locally-sampled share of the MAC key. Σ α_i = α (never formed by any party). */
|
|
91
|
+
readonly alphaShares: bigint[];
|
|
92
|
+
private readonly rng;
|
|
93
|
+
private readonly seed;
|
|
94
|
+
/** Whether randomness is a deterministic (test) seed; when false, all randomness is the CSPRNG. */
|
|
95
|
+
private readonly deterministic;
|
|
96
|
+
/** OT channels keyed "i->j": receiver = party i, sender = party j. Base OTs run on first use. */
|
|
97
|
+
private readonly channels;
|
|
98
|
+
/** Whether to run the MASCOT sacrifice per delivered triple (malicious-secure when true). */
|
|
99
|
+
private readonly sacrificeOn;
|
|
100
|
+
/** Test-only offline deviation (a malicious party corrupting a product share). */
|
|
101
|
+
private readonly deviation?;
|
|
102
|
+
/** Count of triple-product OT multiplications performed (for targeting `deviation.productMul`). */
|
|
103
|
+
private productMulCount;
|
|
104
|
+
constructor(n: number, seed?: bigint, opts?: NoDealerOptions);
|
|
105
|
+
/**
|
|
106
|
+
* The SPDZ MAC context the online runner consumes. It carries ONLY `alphaShares` for the protocol;
|
|
107
|
+
* `alpha` is the sum the in-process simulator computes for TEST ASSERTIONS and is never used by any
|
|
108
|
+
* protocol step or held by any party.
|
|
109
|
+
*/
|
|
110
|
+
get macContext(): MacContext;
|
|
111
|
+
private channel;
|
|
112
|
+
/**
|
|
113
|
+
* Gilboa OT multiplication of two scalars held by different parties. Party `i` holds `xi` (OT
|
|
114
|
+
* receiver, choice bits = bits of xi); party `j` holds `yj` (OT sender). Returns `[shareI, shareJ]`
|
|
115
|
+
* with `shareI + shareJ = xi·yj (mod p)`, neither party learning the other's input or share.
|
|
116
|
+
*/
|
|
117
|
+
private gilboa;
|
|
118
|
+
/**
|
|
119
|
+
* OT-based share multiplication: given additive sharings `x`, `y` (length n), returns an additive
|
|
120
|
+
* sharing `z` with `Σ z = (Σ x)(Σ y) mod p`. Diagonal terms are local; each cross term is a Gilboa OT
|
|
121
|
+
* multiplication. No party learns Σx, Σy, or Σz.
|
|
122
|
+
*/
|
|
123
|
+
otShareMultiply(x: SharedValue, y: SharedValue): SharedValue;
|
|
124
|
+
/** Authenticate a value sharing: produce MAC shares γ with Σ γ = α·(Σ value), via OT (no dealer). */
|
|
125
|
+
private authenticate;
|
|
126
|
+
/**
|
|
127
|
+
* The product sharing `c` (Σc = a·b) for a triple, via OT. Counts as a triple PRODUCT so a test
|
|
128
|
+
* `deviation` can corrupt one — modelling a malicious party that feeds a wrong OT input and gets a
|
|
129
|
+
* wrong-but-self-MAC-consistent product share (only the sacrifice catches this).
|
|
130
|
+
*/
|
|
131
|
+
private tripleProduct;
|
|
132
|
+
/** A RAW authenticated triple (a, b, c=a·b) from OT, before the sacrifice. No dealer. */
|
|
133
|
+
private rawTriple;
|
|
134
|
+
/** A RAW authenticated triple (â, b, ĉ=â·b) SHARING the given authenticated `b` — the sacrifice pair. */
|
|
135
|
+
private rawTripleWithB;
|
|
136
|
+
/**
|
|
137
|
+
* The MASCOT **sacrifice** check. Given two triples sharing `b`, `(a,b,c)` (the one to KEEP) and
|
|
138
|
+
* `(â,b,ĉ)` (the one to SACRIFICE), draw a public random challenge `e`, open `ρ = e·a − â`, form the
|
|
139
|
+
* authenticated residual `⟦τ⟧ = e·⟦c⟧ − ⟦ĉ⟧ − ρ·⟦b⟧`, open `τ`, run the commit-then-open MAC-check on
|
|
140
|
+
* both openings, and require `τ = 0`. If both triples are correct, `τ = e·(c−ab) − (ĉ−âb) = 0`; if the
|
|
141
|
+
* kept triple has `c = ab + δ`, then `τ = e·δ`, which is non-zero (e ≠ 0, δ ≠ 0) — ABORT. Lying in the
|
|
142
|
+
* `τ` opening to force a zero value is caught by the MAC-check (the forged MAC won't reconcile). The
|
|
143
|
+
* sacrificed triple is consumed by the check and discarded; the kept triple is certified `c = a·b`.
|
|
144
|
+
*/
|
|
145
|
+
private sacrifice;
|
|
146
|
+
/**
|
|
147
|
+
* Generate ONE authenticated Beaver triple with NO dealer, MALICIOUS-secure. Each party samples its
|
|
148
|
+
* own a_i, b_i; the product sharing c (Σc = a·b) comes from OT; every component is MAC'd via OT
|
|
149
|
+
* against the α shares. When the sacrifice is on (default), a SECOND triple sharing `b` is generated
|
|
150
|
+
* and sacrificed to certify `c = a·b` under the MACs, so a malformed triple ABORTS rather than being
|
|
151
|
+
* emitted. No party learns a, b, c, or α.
|
|
152
|
+
*/
|
|
153
|
+
genAuthTriple(): AuthTriple;
|
|
154
|
+
/** Generate `count` authenticated triples (channels/base-OTs amortized across all of them). */
|
|
155
|
+
genAuthTriples(count: number): AuthTriple[];
|
|
156
|
+
/**
|
|
157
|
+
* Authenticated input sharing of `value`, owned by party `owner`, with NO dealer. The owner splits
|
|
158
|
+
* its own value into additive shares (local); the MAC `α·value` is computed via OT against the α
|
|
159
|
+
* shares. A malicious owner can of course choose any value (inputs are unconstrained in SPDZ), but it
|
|
160
|
+
* cannot make the sharing inconsistent with its MAC — the online MAC-check binds it.
|
|
161
|
+
*/
|
|
162
|
+
authInput(value: bigint, owner: number): AuthSV;
|
|
163
|
+
/**
|
|
164
|
+
* The MASCOT **input-consistency check**: verify that a batch of authenticated inputs each satisfy
|
|
165
|
+
* `Σγ = α·(Σvalue)` — i.e. their MACs match their values — WITHOUT revealing any value, and ABORT if
|
|
166
|
+
* not. A malicious party that produced an input whose MAC does not match its value (e.g. by feeding a
|
|
167
|
+
* bad OT input to the authentication) is caught here rather than only downstream.
|
|
168
|
+
*
|
|
169
|
+
* Method: draw public random coefficients `e_k`, generate ONE fresh OT-authenticated random mask
|
|
170
|
+
* `⟦r⟧`, form `⟦w⟧ = Σ_k e_k·⟦x_k⟧ + ⟦r⟧`, partial-open `w` (masked by the uniform `r`, so no input
|
|
171
|
+
* leaks), and run the commit-then-open MAC-check on that opening. If some input's MAC is off by `δ`,
|
|
172
|
+
* the opened `w` carries MAC residual `Σ e_k·δ_k ≠ 0` w.h.p. over the random `e_k`, and the MAC-check
|
|
173
|
+
* aborts. No-op for an empty batch.
|
|
174
|
+
*/
|
|
175
|
+
checkInputConsistency(inputs: ReadonlyArray<AuthSV>): void;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The offline material a malicious-secure runner consumes. A `NoDealerOffline` IS one of these
|
|
179
|
+
* (duck-typed by `macContext`/`genAuthTriple`/`authInput`), so the runner can take either this or the
|
|
180
|
+
* trusted-dealer functions behind the same tiny interface.
|
|
181
|
+
*/
|
|
182
|
+
export interface OfflineProvider {
|
|
183
|
+
readonly n: number;
|
|
184
|
+
readonly macContext: MacContext;
|
|
185
|
+
genAuthTriple(): AuthTriple;
|
|
186
|
+
authInput(value: bigint, owner: number): AuthSV;
|
|
187
|
+
}
|
|
188
|
+
/** Convenience: a fresh no-dealer offline phase for `n` parties (malicious-secure by default). */
|
|
189
|
+
export declare function makeNoDealerOffline(n: number, seed?: bigint, opts?: NoDealerOptions): NoDealerOffline;
|
package/dist/mascot.js
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The NO-DEALER offline phase (MASCOT-style) — the last trust assumption removed.
|
|
4
|
+
*
|
|
5
|
+
* The SPDZ online layer (`spdz.ts`/`spdz-runner.ts`) is maliciously secure with abort, but until now
|
|
6
|
+
* its *preprocessing* — the global MAC key α, the authenticated Beaver triples, and the authenticated
|
|
7
|
+
* input sharings — came from a TRUSTED DEALER who knew α and generated everything. This module removes
|
|
8
|
+
* that dealer. All preprocessing is derived from real oblivious transfer (`ot.ts`), so:
|
|
9
|
+
*
|
|
10
|
+
* • **The MAC key α is distributed, never reconstructed.** Each party i samples its own share α_i
|
|
11
|
+
* locally; `α = Σ α_i` is a value no party ever holds and the protocol never forms. (The in-process
|
|
12
|
+
* simulator can sum the shares for test assertions — see `MacContext.alpha` — but no per-party view
|
|
13
|
+
* and no protocol step contains α.)
|
|
14
|
+
*
|
|
15
|
+
* • **Beaver triples are generated by the parties from OT, no dealer.** Each party samples its own
|
|
16
|
+
* shares a_i, b_i of two random values; the product share `c = a·b` is obtained by OT-multiplying
|
|
17
|
+
* the share vectors (Gilboa), and the SPDZ MACs on a, b, c are obtained by OT-multiplying α's shares
|
|
18
|
+
* against each value's shares. No party learns a, b or c; no party learns α.
|
|
19
|
+
*
|
|
20
|
+
* ## The one OT-based primitive: `otShareMultiply`
|
|
21
|
+
*
|
|
22
|
+
* Given additive sharings `⟨x⟩ = (x_0,…,x_{n−1})` and `⟨y⟩`, the parties want an additive sharing
|
|
23
|
+
* `⟨z⟩` with `Σ z = (Σ x)(Σ y)`, learning nothing else. Expand:
|
|
24
|
+
*
|
|
25
|
+
* (Σ_i x_i)(Σ_j y_j) = Σ_i x_i·y_i + Σ_{i≠j} x_i·y_j.
|
|
26
|
+
*
|
|
27
|
+
* The diagonal `x_i·y_i` each party computes locally. Each cross term `x_i·y_j` (i≠j) is turned into an
|
|
28
|
+
* additive sharing between party i and party j by **Gilboa's OT multiplication**: party i (holding x_i)
|
|
29
|
+
* is the OT RECEIVER using the bits of x_i as choices; party j (holding y_j) is the OT SENDER. For bit
|
|
30
|
+
* k of x_i, the sender offers `(ρ_k, ρ_k + 2^k·y_j)` for a fresh random ρ_k; the receiver's choice bit
|
|
31
|
+
* `(x_i)_k` selects `ρ_k + (x_i)_k·2^k·y_j`. Summed over k the receiver gets `x_i·y_j + Σρ_k` and the
|
|
32
|
+
* sender keeps `−Σρ_k`, an additive sharing of `x_i·y_j`. Because the OT hides both the choice and the
|
|
33
|
+
* unchosen message, neither party learns the other's share.
|
|
34
|
+
*
|
|
35
|
+
* ## Malicious security (docs §7.1)
|
|
36
|
+
*
|
|
37
|
+
* The OT is now **malicious-secure**: Chou–Orlandi base OT + IKNP extension **with the KOS correlation
|
|
38
|
+
* check** (`ot.ts`), so a cheating OT-extension receiver is caught and the extension aborts. On top of
|
|
39
|
+
* that, triple generation runs the **MASCOT sacrifice**: every delivered triple is generated as a PAIR
|
|
40
|
+
* `(a,b,c)` and `(â,b,ĉ)` sharing `b`, and one is *sacrificed* to check the other under the MACs — a
|
|
41
|
+
* party that fed wrong OT inputs (producing `c ≠ a·b`, even one that is internally MAC-consistent) is
|
|
42
|
+
* caught when the sacrifice residual `τ = e·c − ĉ − (e·a−â)·b` opens to a non-zero value, or when the
|
|
43
|
+
* commit-then-open MAC-check on the sacrifice openings fails. There is also an **input-consistency
|
|
44
|
+
* check** (`checkInputConsistency`): a random masked combination of authenticated inputs is opened and
|
|
45
|
+
* MAC-checked, catching any input whose MAC does not match its value. Both the sacrifice and the input
|
|
46
|
+
* check ABORT (throw `MacCheckAbort`) rather than emit a bad triple / bad input.
|
|
47
|
+
*
|
|
48
|
+
* So the whole stack is now **malicious-with-abort, dishonest-majority** end to end: malicious-secure
|
|
49
|
+
* no-dealer OFFLINE (KOS OT + MASCOT sacrifice + input check, `α` never reconstructed) feeding the
|
|
50
|
+
* malicious-with-abort SPDZ ONLINE phase (the MAC-check still catches any online deviation). The base
|
|
51
|
+
* OTs are themselves malicious-secure (committed Chou–Orlandi: Schnorr PoK + point validation, `ot.ts`
|
|
52
|
+
* / `ec.ts`), and all randomness here is the CSPRNG by DEFAULT — construct `NoDealerOffline` WITHOUT a
|
|
53
|
+
* seed for production (`SecureFieldRng` + `secureOtRandom`); passing a seed selects the deterministic
|
|
54
|
+
* SplitMix64 stream for reproducible tests only. Residual boundary (docs §7.1): just two honestly
|
|
55
|
+
* unavoidable items — constant-time field arithmetic (a native/WASM workstream) and a real async
|
|
56
|
+
* network/transport (including the interactive secure coin-flip for the public MAC-check challenge).
|
|
57
|
+
*/
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.NoDealerOffline = void 0;
|
|
60
|
+
exports.makeNoDealerOffline = makeNoDealerOffline;
|
|
61
|
+
const field_1 = require("./field");
|
|
62
|
+
const csprng_1 = require("./csprng");
|
|
63
|
+
const sharing_1 = require("./sharing");
|
|
64
|
+
const spdz_1 = require("./spdz");
|
|
65
|
+
const ot_1 = require("./ot");
|
|
66
|
+
/** Number of bits needed to represent any element of F_p (p = 2^61 − 1 ⇒ values use bits 0..60). */
|
|
67
|
+
const FIELD_BITS = 61;
|
|
68
|
+
/**
|
|
69
|
+
* The no-dealer offline phase for a fixed party count `n`. Holds the distributed MAC key (α_i only),
|
|
70
|
+
* and a reusable set of per-ordered-pair OT-extension channels so the κ base OTs are amortized across
|
|
71
|
+
* every triple and input it produces. Deterministic given its seed (production: a CSPRNG per party).
|
|
72
|
+
*
|
|
73
|
+
* MALICIOUS-secure: the OT extension carries the KOS correlation check (`ot.ts`), and every delivered
|
|
74
|
+
* triple survives the MASCOT sacrifice. `checkInputConsistency` provides the input check.
|
|
75
|
+
*/
|
|
76
|
+
class NoDealerOffline {
|
|
77
|
+
n;
|
|
78
|
+
/** α_i: party i's locally-sampled share of the MAC key. Σ α_i = α (never formed by any party). */
|
|
79
|
+
alphaShares;
|
|
80
|
+
rng;
|
|
81
|
+
seed;
|
|
82
|
+
/** Whether randomness is a deterministic (test) seed; when false, all randomness is the CSPRNG. */
|
|
83
|
+
deterministic;
|
|
84
|
+
/** OT channels keyed "i->j": receiver = party i, sender = party j. Base OTs run on first use. */
|
|
85
|
+
channels = new Map();
|
|
86
|
+
/** Whether to run the MASCOT sacrifice per delivered triple (malicious-secure when true). */
|
|
87
|
+
sacrificeOn;
|
|
88
|
+
/** Test-only offline deviation (a malicious party corrupting a product share). */
|
|
89
|
+
deviation;
|
|
90
|
+
/** Count of triple-product OT multiplications performed (for targeting `deviation.productMul`). */
|
|
91
|
+
productMulCount = 0;
|
|
92
|
+
constructor(n, seed, opts = {}) {
|
|
93
|
+
if (!Number.isInteger(n) || n < 1)
|
|
94
|
+
throw new Error('NoDealerOffline: n must be a positive integer');
|
|
95
|
+
this.n = n;
|
|
96
|
+
// CSPRNG by DEFAULT (production); a deterministic SplitMix64 stream ONLY when a test seed is given
|
|
97
|
+
// (docs §7.1 item c). `this.seed` is kept for per-pair OT-stream derivation in the deterministic case.
|
|
98
|
+
this.deterministic = seed !== undefined;
|
|
99
|
+
this.seed = seed ?? 0xabcdef12345n;
|
|
100
|
+
this.rng = this.deterministic ? new field_1.FieldRng(this.seed) : new csprng_1.SecureFieldRng();
|
|
101
|
+
this.sacrificeOn = opts.sacrifice ?? true;
|
|
102
|
+
this.deviation = opts.deviation;
|
|
103
|
+
// DISTRIBUTED MAC-KEY GENERATION: each party samples its own α_i locally. α is never reconstructed.
|
|
104
|
+
this.alphaShares = Array.from({ length: n }, () => this.rng.next());
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The SPDZ MAC context the online runner consumes. It carries ONLY `alphaShares` for the protocol;
|
|
108
|
+
* `alpha` is the sum the in-process simulator computes for TEST ASSERTIONS and is never used by any
|
|
109
|
+
* protocol step or held by any party.
|
|
110
|
+
*/
|
|
111
|
+
get macContext() {
|
|
112
|
+
let alpha = 0n;
|
|
113
|
+
for (const ai of this.alphaShares)
|
|
114
|
+
alpha = (0, field_1.fadd)(alpha, ai);
|
|
115
|
+
return { n: this.n, alphaShares: this.alphaShares.slice(), alpha };
|
|
116
|
+
}
|
|
117
|
+
channel(i, j) {
|
|
118
|
+
const key = `${i}->${j}`;
|
|
119
|
+
let ch = this.channels.get(key);
|
|
120
|
+
if (!ch) {
|
|
121
|
+
// CSPRNG by default; a distinct DETERMINISTIC OT stream per ordered pair only under a test seed.
|
|
122
|
+
const otRng = this.deterministic
|
|
123
|
+
? (0, ot_1.otRandom)((0, ot_1.splitMix64)(this.seed ^ (BigInt(i + 1) * 0x100000001b3n) ^ (BigInt(j + 1) * 0x1000000000n)))
|
|
124
|
+
: (0, csprng_1.secureOtRandom)();
|
|
125
|
+
ch = new ot_1.OtChannel(otRng);
|
|
126
|
+
this.channels.set(key, ch);
|
|
127
|
+
}
|
|
128
|
+
return ch;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Gilboa OT multiplication of two scalars held by different parties. Party `i` holds `xi` (OT
|
|
132
|
+
* receiver, choice bits = bits of xi); party `j` holds `yj` (OT sender). Returns `[shareI, shareJ]`
|
|
133
|
+
* with `shareI + shareJ = xi·yj (mod p)`, neither party learning the other's input or share.
|
|
134
|
+
*/
|
|
135
|
+
gilboa(i, j, xi, yj) {
|
|
136
|
+
const x = (0, field_1.mod)(xi);
|
|
137
|
+
const y = (0, field_1.mod)(yj);
|
|
138
|
+
// Sender draws fresh masks ρ_k and offers (ρ_k, ρ_k + 2^k·y) for each bit k.
|
|
139
|
+
const choiceBits = new Array(FIELD_BITS);
|
|
140
|
+
const msg0 = new Array(FIELD_BITS);
|
|
141
|
+
const msg1 = new Array(FIELD_BITS);
|
|
142
|
+
let senderSum = 0n; // Σ ρ_k
|
|
143
|
+
let pow = 1n; // 2^k mod p (k ≤ 60 ⇒ no wrap)
|
|
144
|
+
for (let k = 0; k < FIELD_BITS; k++) {
|
|
145
|
+
const rho = this.rng.next();
|
|
146
|
+
senderSum = (0, field_1.fadd)(senderSum, rho);
|
|
147
|
+
msg0[k] = rho;
|
|
148
|
+
msg1[k] = (0, field_1.fadd)(rho, (0, field_1.fmul)(pow, y));
|
|
149
|
+
choiceBits[k] = Number((x >> BigInt(k)) & 1n);
|
|
150
|
+
pow = (pow * 2n) % field_1.PRIME;
|
|
151
|
+
}
|
|
152
|
+
const { received } = this.channel(i, j).extend(choiceBits, msg0, msg1);
|
|
153
|
+
let receiverSum = 0n; // Σ (received_k mod p)
|
|
154
|
+
for (let k = 0; k < FIELD_BITS; k++)
|
|
155
|
+
receiverSum = (0, field_1.fadd)(receiverSum, (0, field_1.mod)(received[k]));
|
|
156
|
+
// shareI + shareJ = Σ received − Σ ρ = (xi·yj + Σρ) − Σρ = xi·yj.
|
|
157
|
+
return [receiverSum, (0, field_1.fneg)(senderSum)];
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* OT-based share multiplication: given additive sharings `x`, `y` (length n), returns an additive
|
|
161
|
+
* sharing `z` with `Σ z = (Σ x)(Σ y) mod p`. Diagonal terms are local; each cross term is a Gilboa OT
|
|
162
|
+
* multiplication. No party learns Σx, Σy, or Σz.
|
|
163
|
+
*/
|
|
164
|
+
otShareMultiply(x, y) {
|
|
165
|
+
if (x.length !== this.n || y.length !== this.n)
|
|
166
|
+
throw new Error('otShareMultiply: wrong length');
|
|
167
|
+
const z = x.map((xi, i) => (0, field_1.fmul)(xi, y[i])); // diagonal x_i·y_i (local)
|
|
168
|
+
for (let i = 0; i < this.n; i++) {
|
|
169
|
+
for (let j = 0; j < this.n; j++) {
|
|
170
|
+
if (i === j)
|
|
171
|
+
continue;
|
|
172
|
+
const [si, sj] = this.gilboa(i, j, x[i], y[j]); // sharing of x_i·y_j
|
|
173
|
+
z[i] = (0, field_1.fadd)(z[i], si);
|
|
174
|
+
z[j] = (0, field_1.fadd)(z[j], sj);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return z;
|
|
178
|
+
}
|
|
179
|
+
/** Authenticate a value sharing: produce MAC shares γ with Σ γ = α·(Σ value), via OT (no dealer). */
|
|
180
|
+
authenticate(valueShares) {
|
|
181
|
+
return this.otShareMultiply(this.alphaShares, valueShares);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The product sharing `c` (Σc = a·b) for a triple, via OT. Counts as a triple PRODUCT so a test
|
|
185
|
+
* `deviation` can corrupt one — modelling a malicious party that feeds a wrong OT input and gets a
|
|
186
|
+
* wrong-but-self-MAC-consistent product share (only the sacrifice catches this).
|
|
187
|
+
*/
|
|
188
|
+
tripleProduct(x, y) {
|
|
189
|
+
const z = this.otShareMultiply(x, y);
|
|
190
|
+
const idx = this.productMulCount++;
|
|
191
|
+
const dev = this.deviation;
|
|
192
|
+
if (dev && dev.productMul === idx)
|
|
193
|
+
z[0] = (0, field_1.fadd)(z[0], dev.delta);
|
|
194
|
+
return z;
|
|
195
|
+
}
|
|
196
|
+
/** A RAW authenticated triple (a, b, c=a·b) from OT, before the sacrifice. No dealer. */
|
|
197
|
+
rawTriple() {
|
|
198
|
+
const aShares = Array.from({ length: this.n }, () => this.rng.next());
|
|
199
|
+
const bShares = Array.from({ length: this.n }, () => this.rng.next());
|
|
200
|
+
const cShares = this.tripleProduct(aShares, bShares);
|
|
201
|
+
return {
|
|
202
|
+
a: { value: aShares, mac: this.authenticate(aShares) },
|
|
203
|
+
b: { value: bShares, mac: this.authenticate(bShares) },
|
|
204
|
+
c: { value: cShares, mac: this.authenticate(cShares) },
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/** A RAW authenticated triple (â, b, ĉ=â·b) SHARING the given authenticated `b` — the sacrifice pair. */
|
|
208
|
+
rawTripleWithB(b) {
|
|
209
|
+
const aShares = Array.from({ length: this.n }, () => this.rng.next());
|
|
210
|
+
const cShares = this.tripleProduct(aShares, b.value);
|
|
211
|
+
return {
|
|
212
|
+
a: { value: aShares, mac: this.authenticate(aShares) },
|
|
213
|
+
b,
|
|
214
|
+
c: { value: cShares, mac: this.authenticate(cShares) },
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* The MASCOT **sacrifice** check. Given two triples sharing `b`, `(a,b,c)` (the one to KEEP) and
|
|
219
|
+
* `(â,b,ĉ)` (the one to SACRIFICE), draw a public random challenge `e`, open `ρ = e·a − â`, form the
|
|
220
|
+
* authenticated residual `⟦τ⟧ = e·⟦c⟧ − ⟦ĉ⟧ − ρ·⟦b⟧`, open `τ`, run the commit-then-open MAC-check on
|
|
221
|
+
* both openings, and require `τ = 0`. If both triples are correct, `τ = e·(c−ab) − (ĉ−âb) = 0`; if the
|
|
222
|
+
* kept triple has `c = ab + δ`, then `τ = e·δ`, which is non-zero (e ≠ 0, δ ≠ 0) — ABORT. Lying in the
|
|
223
|
+
* `τ` opening to force a zero value is caught by the MAC-check (the forged MAC won't reconcile). The
|
|
224
|
+
* sacrificed triple is consumed by the check and discarded; the kept triple is certified `c = a·b`.
|
|
225
|
+
*/
|
|
226
|
+
sacrifice(keep, sac) {
|
|
227
|
+
const ctx = this.macContext;
|
|
228
|
+
const engine = new spdz_1.SpdzEngine(ctx, []);
|
|
229
|
+
let e = this.rng.next();
|
|
230
|
+
if (e === 0n)
|
|
231
|
+
e = 1n; // public random challenge, non-zero
|
|
232
|
+
const rho = engine.open((0, spdz_1.subAuth)((0, spdz_1.scaleAuth)(keep.a, e), sac.a), 'sacrifice:rho');
|
|
233
|
+
let tau = (0, spdz_1.subAuth)((0, spdz_1.scaleAuth)(keep.c, e), sac.c);
|
|
234
|
+
tau = (0, spdz_1.subAuth)(tau, (0, spdz_1.scaleAuth)(keep.b, rho));
|
|
235
|
+
const tauValue = engine.open(tau, 'sacrifice:tau');
|
|
236
|
+
engine.macCheck(this.rng); // commit-then-open MAC-check on ρ and τ; throws MacCheckAbort on a forged MAC
|
|
237
|
+
if (tauValue !== 0n) {
|
|
238
|
+
throw new spdz_1.MacCheckAbort(`MASCOT sacrifice FAILED: residual τ=${tauValue} != 0 — a malformed Beaver triple (c != a·b) was detected in the offline phase; aborting with no triple emitted`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Generate ONE authenticated Beaver triple with NO dealer, MALICIOUS-secure. Each party samples its
|
|
243
|
+
* own a_i, b_i; the product sharing c (Σc = a·b) comes from OT; every component is MAC'd via OT
|
|
244
|
+
* against the α shares. When the sacrifice is on (default), a SECOND triple sharing `b` is generated
|
|
245
|
+
* and sacrificed to certify `c = a·b` under the MACs, so a malformed triple ABORTS rather than being
|
|
246
|
+
* emitted. No party learns a, b, c, or α.
|
|
247
|
+
*/
|
|
248
|
+
genAuthTriple() {
|
|
249
|
+
if (!this.sacrificeOn)
|
|
250
|
+
return this.rawTriple();
|
|
251
|
+
const keep = this.rawTriple();
|
|
252
|
+
const sac = this.rawTripleWithB(keep.b);
|
|
253
|
+
this.sacrifice(keep, sac);
|
|
254
|
+
return keep;
|
|
255
|
+
}
|
|
256
|
+
/** Generate `count` authenticated triples (channels/base-OTs amortized across all of them). */
|
|
257
|
+
genAuthTriples(count) {
|
|
258
|
+
const out = [];
|
|
259
|
+
for (let k = 0; k < count; k++)
|
|
260
|
+
out.push(this.genAuthTriple());
|
|
261
|
+
return out;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Authenticated input sharing of `value`, owned by party `owner`, with NO dealer. The owner splits
|
|
265
|
+
* its own value into additive shares (local); the MAC `α·value` is computed via OT against the α
|
|
266
|
+
* shares. A malicious owner can of course choose any value (inputs are unconstrained in SPDZ), but it
|
|
267
|
+
* cannot make the sharing inconsistent with its MAC — the online MAC-check binds it.
|
|
268
|
+
*/
|
|
269
|
+
authInput(value, owner) {
|
|
270
|
+
if (owner < 0 || owner >= this.n)
|
|
271
|
+
throw new Error('authInput: owner out of range');
|
|
272
|
+
const valueShares = (0, sharing_1.share)((0, field_1.mod)(value), this.n, this.rng);
|
|
273
|
+
return { value: valueShares, mac: this.authenticate(valueShares) };
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* The MASCOT **input-consistency check**: verify that a batch of authenticated inputs each satisfy
|
|
277
|
+
* `Σγ = α·(Σvalue)` — i.e. their MACs match their values — WITHOUT revealing any value, and ABORT if
|
|
278
|
+
* not. A malicious party that produced an input whose MAC does not match its value (e.g. by feeding a
|
|
279
|
+
* bad OT input to the authentication) is caught here rather than only downstream.
|
|
280
|
+
*
|
|
281
|
+
* Method: draw public random coefficients `e_k`, generate ONE fresh OT-authenticated random mask
|
|
282
|
+
* `⟦r⟧`, form `⟦w⟧ = Σ_k e_k·⟦x_k⟧ + ⟦r⟧`, partial-open `w` (masked by the uniform `r`, so no input
|
|
283
|
+
* leaks), and run the commit-then-open MAC-check on that opening. If some input's MAC is off by `δ`,
|
|
284
|
+
* the opened `w` carries MAC residual `Σ e_k·δ_k ≠ 0` w.h.p. over the random `e_k`, and the MAC-check
|
|
285
|
+
* aborts. No-op for an empty batch.
|
|
286
|
+
*/
|
|
287
|
+
checkInputConsistency(inputs) {
|
|
288
|
+
if (inputs.length === 0)
|
|
289
|
+
return;
|
|
290
|
+
for (const inp of inputs) {
|
|
291
|
+
if (inp.value.length !== this.n || inp.mac.length !== this.n) {
|
|
292
|
+
throw new Error('checkInputConsistency: input party count mismatch');
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
const ctx = this.macContext;
|
|
296
|
+
const engine = new spdz_1.SpdzEngine(ctx, []);
|
|
297
|
+
// Fresh OT-authenticated random mask ⟦r⟧ (hides w so no input value is revealed).
|
|
298
|
+
const rShares = Array.from({ length: this.n }, () => this.rng.next());
|
|
299
|
+
let w = { value: rShares, mac: this.authenticate(rShares) };
|
|
300
|
+
for (const inp of inputs) {
|
|
301
|
+
let e = this.rng.next(); // public random coefficient
|
|
302
|
+
if (e === 0n)
|
|
303
|
+
e = 1n; // weight every input (0 would skip one); bias is negligible (prob 1/p)
|
|
304
|
+
w = addAuthLocal(w, (0, spdz_1.scaleAuth)(inp, e));
|
|
305
|
+
}
|
|
306
|
+
engine.open(w, 'input-check:w');
|
|
307
|
+
engine.macCheck(this.rng); // throws MacCheckAbort if any input's MAC is inconsistent with its value
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
exports.NoDealerOffline = NoDealerOffline;
|
|
311
|
+
/** Local authenticated addition (kept here to avoid widening mascot's spdz import surface). */
|
|
312
|
+
function addAuthLocal(x, y) {
|
|
313
|
+
return {
|
|
314
|
+
value: x.value.map((xi, i) => (0, field_1.fadd)(xi, y.value[i])),
|
|
315
|
+
mac: x.mac.map((mi, i) => (0, field_1.fadd)(mi, y.mac[i])),
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
/** Convenience: a fresh no-dealer offline phase for `n` parties (malicious-secure by default). */
|
|
319
|
+
function makeNoDealerOffline(n, seed, opts) {
|
|
320
|
+
return new NoDealerOffline(n, seed, opts);
|
|
321
|
+
}
|
|
322
|
+
//# sourceMappingURL=mascot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mascot.js","sourceRoot":"","sources":["../src/mascot.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;;;AAsTH,kDAMC;AA1TD,mCAAiE;AACjE,qCAA0D;AAC1D,uCAAoD;AACpD,iCAQgB;AAChB,6BAAsE;AAEtE,oGAAoG;AACpG,MAAM,UAAU,GAAG,EAAE,CAAC;AAyBtB;;;;;;;GAOG;AACH,MAAa,eAAe;IACjB,CAAC,CAAS;IACnB,kGAAkG;IACzF,WAAW,CAAW;IACd,GAAG,CAAW;IACd,IAAI,CAAS;IAC9B,mGAAmG;IAClF,aAAa,CAAU;IACxC,iGAAiG;IAChF,QAAQ,GAAG,IAAI,GAAG,EAAqB,CAAC;IACzD,6FAA6F;IAC5E,WAAW,CAAU;IACtC,kFAAkF;IACjE,SAAS,CAAoB;IAC9C,mGAAmG;IAC3F,eAAe,GAAG,CAAC,CAAC;IAE5B,YAAY,CAAS,EAAE,IAAa,EAAE,OAAwB,EAAE;QAC9D,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,MAAM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