venillalemon

September 29, 2026 · Markdown notes

Feeding Inputs into a WRK Circuit

Feeding Inputs into a WRK Circuit


Motivation

假设 WRK 的 garbled table 已经建好,每条 wire 的 mask 已 share 并认证,每个 garbler 已选好 label,所有 AND gate 的 table 已发出。现在要往 input wire \(\omega\) 上送入一个值,让 evaluator 拿到该 wire 上的 masked bit 和 label。

Garbled Circuits 中的 WRK 只处理了值由某个 party 明文持有的情形。这篇处理另外两种来源:

  • 值是所有 party 都知道的 public bit \(x\);
  • 值是一个 BDOZ / TinyOT 式的 authenticated sharing \([x]\),没有任何 party 知道 \(x\)。

Setup

\(P_1\) 为 evaluator,\(P_2,\dots,P_n\) 为 garbler。每个 \(P_i\) 持有私有全局 key \(\Delta^{(i)}\in\mathbb F_2^\kappa\);对 \(i\ge2\) 它同时是 \(P_i\) 的 label offset。

Authenticated sharing. 对 bit \(x\),记 \([x]\) 为

\[ x=\bigoplus_{i=1}^n x^{(i)},\qquad M^{(i)}_{i\to j,\,x}=K^{(j)}_{i\to j,\,x}\oplus x^{(i)}\Delta^{(j)} \quad(i\ne j), \]

其中 \(P_i\) 持有 \(x^{(i)}\)、MAC \(\{M^{(i)}_{i\to j,\,x}\}_{j\ne i}\) 和 key \(\{K^{(i)}_{j\to i,\,x}\}_{j\ne i}\)。\([x]\oplus[y]\) 为份额、MAC、key 逐项 XOR,本地完成。

Garbling 之后 wire \(\omega\) 上已有的东西.

  • 所有 party 持有 mask \([\lambda_\omega]\),\(\lambda_\omega\) 对任何真子集保密。
  • 每个 garbler \(P_j\) 持有 \(L^{(j)}_{\omega,0}\) 和 \(L^{(j)}_{\omega,1}=L^{(j)}_{\omega,0}\oplus\Delta^{(j)}\)。

目标. 对 wire 的真实值 \(v_\omega\),所有 party 得到公开的 \(\widehat v_\omega=v_\omega\oplus\lambda_\omega\),且 \(P_1\) 持有

\[ \left(\widehat v_\omega,\ L^{(2)}_{\omega,\widehat v_\omega},\ \dots,\ L^{(n)}_{\omega,\widehat v_\omega}\right). \]

我们全文将会借用 Garbled Circuits 的记号。

Input from a public bit

wire \(\omega\) 的值为所有 party 已知的 \(x\)。

  1. Offline :各 party 打开 \([\lambda_\omega]\)(公开份额、发送 MAC、检查 MAC),失败则 abort,所有 party 得到 \(\lambda_\omega\)。
  2. 每个 party 本地计算 \[ \widehat v_\omega=x\oplus\lambda_\omega . \]
  3. 每个 garbler 发送与 \(\widehat v_\omega\) 对应的 label: \[ P_j\longrightarrow P_1:\quad L^{(j)}_{\omega,\widehat v_\omega}\qquad(j\ge2). \]

Claim. \(P_1\) 持有 \(\left(\widehat v_\omega,L^{(2)}_{\omega,\widehat v_\omega},\dots,L^{(n)}_{\omega,\widehat v_\omega}\right)\),\(\widehat v_\omega=x\oplus\lambda_\omega\)。

Security. 值 \(x\) 是公开的,没有东西需要隐藏;公开 \(\lambda_\omega\) 不影响其他 wire,因为 WRK 的 selective failure 论证只用到秘密 wire 的诚实 mask share。腐化 \(P_i\) 若篡改 \(\lambda_\omega^{(i)}\),需在不知 \(\Delta^{(j)}\) 的情况下伪造 MAC,成功概率 \(2^{-\kappa}\)。腐化 garbler 若发错 label,下一个用到 \(\omega\) 的 gate 会因 MAC 检查失败而 abort,与任何秘密无关。

步骤 1 与 \(x\) 无关,online 只有步骤 2–3。若建电路时就知道 \(\omega\) 是 public wire,可直接取 \([\lambda_\omega]=[0]\)(份额、MAC、key 全为零),此时 \(\widehat v_\omega=x\),只剩步骤 3。

Online communication. 一轮,全部发往 \(P_1\),每个 garbler 发一个 label:

\[ (n-1)\kappa\ \text{bit}. \]

Input from a BDOZ share

wire \(\omega\) 的值为 \(x\),各 party 持有 \([x]\),其 MAC key 与 WRK 的 \(\Delta^{(1)},\dots,\Delta^{(n)}\) 相同。没有 party 知道 \(x\)。\(P_1\) 是 evaluator,\(P_2,\dots,P_n\) 是 garbler,\(L^{(j)}_{\omega,1}=L^{(j)}_{\omega,0}\oplus\Delta^{(j)}\)。

  1. 每个 \(P_i\) 本地计算 \([\widehat v_\omega]=[x]\oplus[\lambda_\omega]\),即 \[ \widehat v_\omega^{(i)}=x^{(i)}\oplus\lambda_\omega^{(i)},\qquad M^{(i)}_{i\to j,\,\widehat v_\omega}=M^{(i)}_{i\to j,\,x}\oplus M^{(i)}_{i\to j,\,\lambda_\omega},\qquad K^{(j)}_{i\to j,\,\widehat v_\omega}=K^{(j)}_{i\to j,\,x}\oplus K^{(j)}_{i\to j,\,\lambda_\omega} \quad(j\ne i). \]
  2. 以下消息之间互不依赖,对于所有 \(i\ge 2\): \[ \begin{aligned} P_i\longrightarrow P_1:&\quad \widehat v_\omega^{(i)},\ M^{(i)}_{i\to 1,\,\widehat v_\omega},\\ P_i\longrightarrow P_1:&\quad S^{(i)}_\omega =L^{(i)}_{\omega,0}\oplus\widehat v_\omega^{(i)}\Delta^{(i)} \oplus\bigoplus_{j\ne i}K^{(i)}_{j\to i,\,\widehat v_\omega},\\ P_i\longrightarrow P_1:&\quad M^{(i)}_{i\to j,\,\widehat v_\omega}\quad\text{for all }j\notin\{1,i\}. \end{aligned} \]
  3. \(P_1\) 对所有 \(i\ge2\) 检查 \[ M^{(i)}_{i\to 1,\,\widehat v_\omega}\stackrel{?}{=}K^{(1)}_{i\to 1,\,\widehat v_\omega}\oplus\widehat v_\omega^{(i)}\Delta^{(1)}, \] 失败则 abort。然后计算 \(\widehat v_\omega=\bigoplus_{i=1}^n\widehat v_\omega^{(i)}\)。
  4. \(P_1\) 对每个 garbler \(j\ge2\) 本地计算 \[ S^{(j)}_\omega\oplus\bigoplus_{i\ne j}M^{(i)}_{i\to j,\,\widehat v_\omega}, \] 其中 \(i=1\) 的那一项 \(M^{(1)}_{1\to j,\,\widehat v_\omega}\) 是 \(P_1\) 自己持有的。

Claim. \(P_1\) 持有 \(\left(\widehat v_\omega,L^{(2)}_{\omega,\widehat v_\omega},\dots,L^{(n)}_{\omega,\widehat v_\omega}\right)\),\(\widehat v_\omega=x\oplus\lambda_\omega\)。其他 party 不知道 \(\widehat v_\omega\)。

Correctness. 由 \(M^{(i)}_{i\to j}=K^{(j)}_{i\to j}\oplus\widehat v^{(i)}_\omega\Delta^{(j)}\),

\[ S^{(j)}_\omega\oplus\bigoplus_{i\ne j}M^{(i)}_{i\to j,\,\widehat v_\omega} =L^{(j)}_{\omega,0}\oplus\widehat v_\omega^{(j)}\Delta^{(j)}\oplus\bigoplus_{i\ne j}\widehat v_\omega^{(i)}\Delta^{(j)} =L^{(j)}_{\omega,0}\oplus\widehat v_\omega\Delta^{(j)} =L^{(j)}_{\omega,\widehat v_\omega}. \]

Security.

  • 隐私。 \(P_1\) 看到的 \(\widehat v_\omega^{(i)}\) 被诚实方均匀随机、从未公开的 \(\lambda_\omega^{(i)}\) 遮住,\(x\) 不泄露;\([x]\) 没有被打开,之后仍可使用。\(S^{(j)}_\omega\) 被新鲜的 \(L^{(j)}_{\omega,0}\) 遮住,不泄露 \(K^{(j)}_{i\to j}\);\(M^{(i)}_{i\to j}\) 的 key 是一次性的,不泄露 \(\Delta^{(j)}\)。\(P_1\) 从诚实 garbler \(j\) 处只能得到 \(L^{(j)}_{\omega,\widehat v_\omega}\),得到另一个 label 需要 \(\Delta^{(j)}\)。
  • \(\widehat v_\omega\) 的完整性。 腐化 \(P_i\) 篡改 \(\widehat v_\omega^{(i)}\) 需在不知 \(\Delta^{(1)}\) 的情况下伪造 MAC,成功概率 \(2^{-\kappa}\)。
  • label 的完整性。 \(P_1\) 不知道 \(\Delta^{(j)}\)(\(j\ge2\)),所以第 2 步中 \(S^{(j)}_\omega\) 和 \(M^{(i)}_{i\to j}\) 不检查。若腐化方把其中任一项加上 \(e\),\(P_1\) 得到 \(L^{(j)}_{\omega,\widehat v_\omega}\oplus e\);下一个用到 \(\omega\) 的 gate 会因 row 的 MAC 检查失败而 abort,除非 \(e\in\{0,\Delta^{(j)}\}\)。对诚实 garbler \(j\),\(e=\Delta^{(j)}\) 的概率为 \(2^{-\kappa}\);若 garbler \(j\) 本身腐化,它能把自己那份 label 翻成 \(L^{(j)}_{\omega,\widehat v_\omega\oplus1}\),但这与诚实 garbler 的 label 不一致,同样在下一个 gate 失败。发送方做决定时连 \(\widehat v_\omega\) 都不知道(它不再公开),所以 abort 与 \(x\) 无关,没有 selective failure。

Online communication. 一轮,全部发往 \(P_1\)。每个 garbler 发 \(\widehat v_\omega^{(i)}\)(1 bit)、\(M^{(i)}_{i\to1,\widehat v_\omega}\) 与 \(S^{(i)}_\omega\)(各 \(\kappa\) bit)、\(n-2\) 个 \(M^{(i)}_{i\to j,\widehat v_\omega}\)(各 \(\kappa\) bit),共

\[ (n-1)(n\kappa+1)\ \text{bit}. \]

Motivation

Suppose the WRK garbled tables have already been built: the mask of every wire has been shared and authenticated, every garbler has chosen its labels, and the tables of all AND gates have been sent. We now want to feed a value into an input wire \(\omega\), so that the evaluator obtains the masked bit and the labels on that wire.

WRK as presented in Garbled Circuits only handles the case where the value is held in the clear by some party. This note handles two other sources:

  • the value is a public bit \(x\) known to all parties;
  • the value is a BDOZ / TinyOT-style authenticated sharing \([x]\), and no party knows \(x\).

Setup

\(P_1\) is the evaluator and \(P_2,\dots,P_n\) are the garblers. Each \(P_i\) holds a private global key \(\Delta^{(i)}\in\mathbb F_2^\kappa\); for \(i\ge2\) it is also \(P_i\)'s label offset.

Authenticated sharing. For a bit \(x\), write \([x]\) for

\[ x=\bigoplus_{i=1}^n x^{(i)},\qquad M^{(i)}_{i\to j,\,x}=K^{(j)}_{i\to j,\,x}\oplus x^{(i)}\Delta^{(j)} \quad(i\ne j), \]

where \(P_i\) holds \(x^{(i)}\), the MACs \(\{M^{(i)}_{i\to j,\,x}\}_{j\ne i}\) and the keys \(\{K^{(i)}_{j\to i,\,x}\}_{j\ne i}\). \([x]\oplus[y]\) is the entrywise XOR of shares, MACs and keys, done locally.

What wire \(\omega\) already has after garbling.

  • All parties hold the mask \([\lambda_\omega]\); \(\lambda_\omega\) is hidden from every proper subset of the parties.
  • Each garbler \(P_j\) holds \(L^{(j)}_{\omega,0}\) and \(L^{(j)}_{\omega,1}=L^{(j)}_{\omega,0}\oplus\Delta^{(j)}\).

Goal. For the true value \(v_\omega\) of the wire, all parties obtain the public \(\widehat v_\omega=v_\omega\oplus\lambda_\omega\), and \(P_1\) holds

\[ \left(\widehat v_\omega,\ L^{(2)}_{\omega,\widehat v_\omega},\ \dots,\ L^{(n)}_{\omega,\widehat v_\omega}\right). \]

Throughout, we borrow the notation of Garbled Circuits.

Input from a public bit

The value of wire \(\omega\) is \(x\), known to all parties.

  1. Offline: the parties open \([\lambda_\omega]\) (publish shares, send MACs, check MACs), abort on failure; all parties obtain \(\lambda_\omega\).
  2. Each party locally computes \[ \widehat v_\omega=x\oplus\lambda_\omega . \]
  3. Each garbler sends the label corresponding to \(\widehat v_\omega\): \[ P_j\longrightarrow P_1:\quad L^{(j)}_{\omega,\widehat v_\omega}\qquad(j\ge2). \]

Claim. \(P_1\) holds \(\left(\widehat v_\omega,L^{(2)}_{\omega,\widehat v_\omega},\dots,L^{(n)}_{\omega,\widehat v_\omega}\right)\), with \(\widehat v_\omega=x\oplus\lambda_\omega\).

Security. The value \(x\) is public, so there is nothing to hide; opening \(\lambda_\omega\) does not affect other wires, because the WRK selective failure argument only uses the honest mask shares of secret wires. If a corrupted \(P_i\) tampers with \(\lambda_\omega^{(i)}\), it must forge a MAC without knowing \(\Delta^{(j)}\), which succeeds with probability \(2^{-\kappa}\). If a corrupted garbler sends a wrong label, the next gate that uses \(\omega\) aborts because the MAC check fails, independently of any secret.

Step 1 is independent of \(x\); only steps 2–3 are online. If it is known when building the circuit that \(\omega\) is a public wire, one can directly take \([\lambda_\omega]=[0]\) (shares, MACs and keys all zero); then \(\widehat v_\omega=x\) and only step 3 remains.

Online communication. One round, all sent to \(P_1\), one label per garbler:

\[ (n-1)\kappa\ \text{bit}. \]

Input from a BDOZ share

The value of wire \(\omega\) is \(x\); the parties hold \([x]\), whose MAC keys are the same as WRK's \(\Delta^{(1)},\dots,\Delta^{(n)}\). No party knows \(x\). \(P_1\) is the evaluator, \(P_2,\dots,P_n\) are the garblers, and \(L^{(j)}_{\omega,1}=L^{(j)}_{\omega,0}\oplus\Delta^{(j)}\).

  1. Each \(P_i\) locally computes \([\widehat v_\omega]=[x]\oplus[\lambda_\omega]\), i.e. \[ \widehat v_\omega^{(i)}=x^{(i)}\oplus\lambda_\omega^{(i)},\qquad M^{(i)}_{i\to j,\,\widehat v_\omega}=M^{(i)}_{i\to j,\,x}\oplus M^{(i)}_{i\to j,\,\lambda_\omega},\qquad K^{(j)}_{i\to j,\,\widehat v_\omega}=K^{(j)}_{i\to j,\,x}\oplus K^{(j)}_{i\to j,\,\lambda_\omega} \quad(j\ne i). \]
  2. For all \(i\ge 2\), the following messages do not depend on one another: \[ \begin{aligned} P_i\longrightarrow P_1:&\quad \widehat v_\omega^{(i)},\ M^{(i)}_{i\to 1,\,\widehat v_\omega},\\ P_i\longrightarrow P_1:&\quad S^{(i)}_\omega =L^{(i)}_{\omega,0}\oplus\widehat v_\omega^{(i)}\Delta^{(i)} \oplus\bigoplus_{j\ne i}K^{(i)}_{j\to i,\,\widehat v_\omega},\\ P_i\longrightarrow P_1:&\quad M^{(i)}_{i\to j,\,\widehat v_\omega}\quad\text{for all }j\notin\{1,i\}. \end{aligned} \]
  3. \(P_1\) checks, for all \(i\ge2\), \[ M^{(i)}_{i\to 1,\,\widehat v_\omega}\stackrel{?}{=}K^{(1)}_{i\to 1,\,\widehat v_\omega}\oplus\widehat v_\omega^{(i)}\Delta^{(1)}, \] and aborts on failure. It then computes \(\widehat v_\omega=\bigoplus_{i=1}^n\widehat v_\omega^{(i)}\).
  4. For each garbler \(j\ge2\), \(P_1\) locally computes \[ S^{(j)}_\omega\oplus\bigoplus_{i\ne j}M^{(i)}_{i\to j,\,\widehat v_\omega}, \] where the \(i=1\) term \(M^{(1)}_{1\to j,\,\widehat v_\omega}\) is held by \(P_1\) itself.

Claim. \(P_1\) holds \(\left(\widehat v_\omega,L^{(2)}_{\omega,\widehat v_\omega},\dots,L^{(n)}_{\omega,\widehat v_\omega}\right)\), with \(\widehat v_\omega=x\oplus\lambda_\omega\). The other parties do not know \(\widehat v_\omega\).

Correctness. Since \(M^{(i)}_{i\to j}=K^{(j)}_{i\to j}\oplus\widehat v^{(i)}_\omega\Delta^{(j)}\),

\[ S^{(j)}_\omega\oplus\bigoplus_{i\ne j}M^{(i)}_{i\to j,\,\widehat v_\omega} =L^{(j)}_{\omega,0}\oplus\widehat v_\omega^{(j)}\Delta^{(j)}\oplus\bigoplus_{i\ne j}\widehat v_\omega^{(i)}\Delta^{(j)} =L^{(j)}_{\omega,0}\oplus\widehat v_\omega\Delta^{(j)} =L^{(j)}_{\omega,\widehat v_\omega}. \]

Security.

  • Privacy. The \(\widehat v_\omega^{(i)}\) seen by \(P_1\) are masked by the honest parties' uniformly random, never-opened \(\lambda_\omega^{(i)}\), so \(x\) is not leaked; \([x]\) is not opened and can still be used afterwards. \(S^{(j)}_\omega\) is masked by the fresh \(L^{(j)}_{\omega,0}\) and does not leak \(K^{(j)}_{i\to j}\); the key of \(M^{(i)}_{i\to j}\) is one-time and does not leak \(\Delta^{(j)}\). From an honest garbler \(j\), \(P_1\) can only obtain \(L^{(j)}_{\omega,\widehat v_\omega}\); obtaining the other label requires \(\Delta^{(j)}\).
  • Integrity of \(\widehat v_\omega\). For a corrupted \(P_i\) to tamper with \(\widehat v_\omega^{(i)}\), it must forge a MAC without knowing \(\Delta^{(1)}\), which succeeds with probability \(2^{-\kappa}\).
  • Integrity of the labels. \(P_1\) does not know \(\Delta^{(j)}\) (\(j\ge2\)), so in step 2 \(S^{(j)}_\omega\) and \(M^{(i)}_{i\to j}\) are not checked. If a corrupted party adds \(e\) to any of them, \(P_1\) obtains \(L^{(j)}_{\omega,\widehat v_\omega}\oplus e\); the next gate that uses \(\omega\) aborts because the row's MAC check fails, unless \(e\in\{0,\Delta^{(j)}\}\). For an honest garbler \(j\), the probability that \(e=\Delta^{(j)}\) is \(2^{-\kappa}\); if garbler \(j\) is itself corrupted, it can flip its own label to \(L^{(j)}_{\omega,\widehat v_\omega\oplus1}\), but this is inconsistent with the honest garblers' labels and likewise fails at the next gate. When the sender makes its decision it does not even know \(\widehat v_\omega\) (it is no longer public), so the abort is independent of \(x\) and there is no selective failure.

Online communication. One round, all sent to \(P_1\). Each garbler sends \(\widehat v_\omega^{(i)}\) (1 bit), \(M^{(i)}_{i\to1,\widehat v_\omega}\) and \(S^{(i)}_\omega\) (\(\kappa\) bits each), and \(n-2\) values \(M^{(i)}_{i\to j,\widehat v_\omega}\) (\(\kappa\) bits each), in total

\[ (n-1)(n\kappa+1)\ \text{bit}. \]