Skip to main content

OT Extension

To meet the large-scale demand of OTs, OT extensions can be used. An OT extension protocol works by running a small number of base OTs that are used as a base for obtaining many OTs via the use of cheap symmetric cryptographic operations only. This is conceptually similar to hybrid encryption.

In this subsection, we focus on the maliciously secure OT extension presented in KOS15.

To be compatible with the garbled circuit optimizations, Correlated OT (COT) is considered here. COT is a variant of OT, where the sender chooses a secret string Δ\Delta and the receiver has a choice bit bb. After the protocol, then sender obtains two strings X0=X\sX_0 = \sX and X1=XΔ\sX_1 = \sX\oplus \Delta and the receiver obtains Xb\sX_b, where X\sX is a random string.

                    Sender                               Receiver

+----------+
Delta ------->| |<------ b
| COT Prot.|
x_0 = x, x_1 = x + Delta <-------| |-------> x_b
+----------+

Notation. Let λ\lambda be the security parameter, we use λ=128\lambda = 128 in zkOracles. Identify F2λ\bF^\lambda_2 with the finite field F2λ\bF_{2^\lambda}. Use "\cdot" for multiplication in F2λ\bF_{2^{ \lambda}} and "\star" for the component-wise product in F2λ\bF_{2}^\lambda. Given a matrix AA, denote its rows by subindices ai\mathbf{a}_i and its columns by superindices ak\mathbf{a}^k. Use v[i]\mathbf{v}[i] to denote the ii-th entry of v\mathbf{v}.

The KOS15 OT protocol to generate (λ)\ell(\gg \lambda) OTs is described as follows.

  • Initialize

    1. The receiver samples λ\lambda pairs of λ\lambda-bit seeds {(k0i,k1i)}i=1λ\{(\mathbf{k}_0^i,\mathbf{k}_1^i)\}_{i=1}^\lambda.

    2. The sender choose a uniformly random λ\lambda-bit string Δ\Delta.

    3. The two parties calls the base OT with inputs Δ\Delta and {(k0i,k1i)}i=1λ\{(\mathbf{k}_0^i,\mathbf{k}_1^i)\}_{i=1}^\lambda.

      • Note that the sender acts as the receiver in the base OT, and the receiver acts as the sender in the base OT.
    4. The sender obtains kΔii\mathbf{k}^i_{\Delta_i} for i[λ]i\in[\lambda].

  • Extend

    1. The receiver takes as input the choice bits x1,...,xx_1,...,x_\ell, defines =+λ+s\ell' = \ell + \lambda + s, where ss is the statistic parameter, and we set s=40s = 40 in zkOracles. Let x=x1x2...xxF2\mathbf{x} = x_1\|x_2\|...\|x_\ell\|\mathbf{x}'\in \bF_2^{\ell'}, with xF2\mathbf{x}'\in\bF_2^{\ell'-\ell} uniformly chosen.

    2. The receiver defines vectors x1,...,x\mathbf{x}_1,...,\mathbf{x}_{\ell'} as xi=x[i](1,...,1)F2λ\mathbf{x}_i = \mathbf{x}[i]\cdot (1,...,1)\in \bF_2^{\lambda} for i[]i\in[\ell'].

    3. The receiver expands k0i\mathbf{k}_0^i and k1i\mathbf{k}_1^i with a pseudo random generator (PRG\prg), letting t0i=PRG(k0i)F2  and  t1i=PRG(k1i)F2  for  i[λ]\mathbf{t}_0^i = \prg(\mathbf{k}_0^i)\in\bF_2^{\ell'}~~\text{and}~~\mathbf{t}_1^i = \prg(\mathbf{k}_1^i)\in\bF_2^{\ell'}~~\text{for}~~ i\in[\lambda]

    4. The sender expands kΔii\mathbf{k}^i_{\Delta_i} with the same PRG\prg and gets tΔii=PRG(kΔii)  for  i[λ]\mathbf{t}_{\Delta_i}^i = \prg(\mathbf{k}_{\Delta_i}^i)~~\text{for}~~ i\in[\lambda]

    5. The receiver computes ui=t0it1ixF2  for  i[λ]\mathbf{u}^i = \mathbf{t}_0^i\oplus\mathbf{t}_1^i\oplus\mathbf{x}\in\bF_2^{\ell'}~~\text{for}~~i\in[\lambda] and sends them to the sender.

    6. The sender computes qi=ΔiuitΔii=t0iΔixF2  for  i[λ]\mathbf{q}^i = \Delta_i\cdot \mathbf{u}^i \oplus \mathbf{t}^i_{\Delta_i} = \mathbf{t}_0^i \oplus \Delta_i\cdot\mathbf{x}\in\bF_2^{\ell'}~~\text{for}~~i\in[\lambda]

    7. Let qj\mathbf{q}_j be the jj-th row of the ×λ\ell'\times \lambda matrix Q=[q1q2qλ]Q = [\mathbf{q}^1|\mathbf{q}^2|\cdots|\mathbf{q}^\lambda], and similarly let tj\mathbf{t}_j be the jj-th row of T=[t01t02t0λ]T = [\mathbf{t}_0^1|\mathbf{t}_0^2|\cdots|\mathbf{t}_0^\lambda]. Note that qj=tj(xjΔ)=tj(x[j]Δ)  for  j[]\mathbf{q}_j = \mathbf{t}_j \oplus (\mathbf{x}_j\star\Delta) = \mathbf{t}_j\oplus (\mathbf{x}[j]\cdot \Delta)~~\text{for}~~j\in[\ell']

  • Correlation Check

    1. The sender and receiver run a πRAND(F2λ)\pi_{\mathsf{RAND}}(\bF_{2^\lambda}^{\ell'}) protocol to obtain random elements χ1,...,χ\chi_1,...,\chi_{\ell'}. πRAND(F2λ)\pi_{\mathsf{RAND}}(\bF_{2^\lambda}^{\ell'}) will be described later.

    2. The receiver computes x=j=1x[j]χj  and  t=j=1tjχjx = \sum_{j = 1}^{\ell'}\mathbf{x}[j]\cdot \chi_j~~\text{and}~~ t = \sum_{j=1}^{\ell'}\mathbf{t}_j\cdot \chi_j and sends them to the sender.

    3. The sender computes q=j=1qjχjq = \sum_{j=1}^{\ell'}\mathbf{q}_j\cdot \chi_j and checks t=qxΔt = q\oplus x\cdot \Delta. If the check fails, abort.

  • Output

    1. The sender computes vj=H(j,qj)H(j,qjΔ)Δ  for  j[]\mathbf{v}_j = \sH(j,\mathbf{q}_j)\oplus\sH(j,\mathbf{q}_j\oplus\Delta)\oplus\Delta~~\text{for}~~ j\in [\ell] and sends them to the receiver. H\sH is a tweakable hash function as used in garbled circuit.

    2. The sender outputs (H(j,qj), H(j,qj)Δ)(\sH(j,\mathbf{q}_j),~\sH(j,\mathbf{q}_j)\oplus \Delta)

    3. For j[]j\in[\ell], the receiver outputs the following:  If  xj=0,  outputs  H(j,tj);  If  xj=1,  outputs  H(j,tj)vj~\text{If}~~x_j = 0,~~\text{outputs}~~ \sH(j,\mathbf{t}_j);~~\text{If}~~x_j = 1,~~\text{outputs}~~\sH(j,\mathbf{t}_j)\oplus \mathbf{v}_j

This ends the description of the KOS15 protocol. We note that a very recent work pointed out that there is a flaw in the security proof of the main lemma of KOS15 and provided a fix, which is less efficient. They also pointed out that this the original KOS15 protocol is still secure in practice. Therefore, we choose the original KOS15 protocol in zkOracles in this version.

We begin to describe the πRAND(F2λ)\pi_{\mathsf{RAND}}(\bF_{2^\lambda}^\ell) protocol as follows.

  • The sender and receiver locally choose uniformly 128128-bit random seeds s0s_0 and s1s_1, respectively.

  • The sender and receiver compute commitments of the seeds by choosing 128128-bit random strings r0,r1r_0,r_1 and generate c0=SHA256(s0r0)c_0 = \sha(s_0\|r_0) and c1=SHA256(s1r1)c_1 = \sha(s_1\|r_1), respectively.

  • The sender sends c0c_0 to the receiver, and the receiver sends c1c_1 to the sender.

  • On receiving the commitments, the sender and receiver open the commitments by sending (s0,r0)(s_0,r_0) and (s1,r1)(s_1,r_1) to each other, respectively.

  • The sender checks c1c_1 by re-computing it with s1,r1s_1,r_1, and the receiver checks c0c_0 by re-computing it with s0,r0s_0,r_0. If checks fail, abort.

  • The sender and receiver locally compute s=s0s1s = s_0\oplus s_1 and generate random elements with a PRG\prg as χ1,...,χPRG(s)\chi_1,...,\chi_\ell\leftarrow \prg(s)