OT Extension
To meet the largescale 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 $Δ$ and the receiver has a choice bit $b$. After the protocol, then sender obtains two strings $X_{0}=X$ and $X_{1}=X⊕Δ$ and the receiver obtains $X_{b}$, where $X$ is a random string.
Sender Receiver
++
Delta > < b
 COT Prot.
x_0 = x, x_1 = x + Delta < > x_b
++
Notation. Let $λ$ be the security parameter, we use $λ=128$ in zkOracles. Identify $F_{2}$ with the finite field $F_{2_{λ}}$. Use “$⋅$” for multiplication in $F_{2_{λ}}$ and “$⋆$” for the componentwise product in $F_{2}$. Given a matrix $A$, denote its rows by subindices $a_{i}$ and its columns by superindices $a_{k}$. Use $v[i]$ to denote the $i$th entry of $v$.
The KOS15 OT protocol to generate $ℓ(≫λ)$ OTs is described as follows.

Initialize

The receiver samples $λ$ pairs of $λ$bit seeds ${(k_{0},k_{1})}_{i=1}$.

The sender choose a uniformly random $λ$bit string $Δ$.

The two parties calls the base OT with inputs $Δ$ and ${(k_{0},k_{1})}_{i=1}$.
 Note that the sender acts as the receiver in the base OT, and the receiver acts as the sender in the base OT.

The sender obtains $k_{Δ_{i}}$ for $i∈[λ]$.


Extend

The receiver takes as input the choice bits $x_{1},…,x_{ℓ}$, defines $ℓ_{′}=ℓ+λ+s$, where $s$ is the statistic parameter, and we set $s=40$ in zkOracles. Let $x=x_{1}∥x_{2}∥…∥x_{ℓ}∥x_{′}∈F_{2}$, with $x_{′}∈F_{2}$ uniformly chosen.

The receiver defines vectors $x_{1},…,x_{ℓ_{′}}$ as $x_{i}=x[i]⋅(1,…,1)∈F_{2}$ for $i∈[ℓ_{′}]$.

The receiver expands $k_{0}$ and $k_{1}$ with a pseudo random generator ($PRG$), letting $t_{0}=PRG(k_{0})∈F_{2}andt_{1}=PRG(k_{1})∈F_{2}fori∈[λ]$

The sender expands $k_{Δ_{i}}$ with the same $PRG$ and gets $t_{Δ_{i}}=PRG(k_{Δ_{i}})fori∈[λ]$

The receiver computes $u_{i}=t_{0}⊕t_{1}⊕x∈F_{2}fori∈[λ]$ and sends them to the sender.

The sender computes $q_{i}=Δ_{i}⋅u_{i}⊕t_{Δ_{i}}=t_{0}⊕Δ_{i}⋅x∈F_{2}fori∈[λ]$

Let $q_{j}$ be the $j$th row of the $ℓ_{′}×λ$ matrix $Q=[q_{1}∣q_{2}∣⋯∣q_{λ}]$, and similarly let $t_{j}$ be the $j$th row of $T=[t_{0}∣t_{0}∣⋯∣t_{0}]$. Note that $q_{j}=t_{j}⊕(x_{j}⋆Δ)=t_{j}⊕(x[j]⋅Δ)forj∈[ℓ_{′}]$


Correlation Check

The sender and receiver run a $π_{RAND}(F_{2_{λ}})$ protocol to obtain random elements $χ_{1},…,χ_{ℓ_{′}}$. $π_{RAND}(F_{2_{λ}})$ will be described later.

The receiver computes $x=j=1∑ℓ_{′} x[j]⋅χ_{j}andt=j=1∑ℓ_{′} t_{j}⋅χ_{j}$ and sends them to the sender.

The sender computes $q=j=1∑ℓ_{′} q_{j}⋅χ_{j}$ and checks $t=q⊕x⋅Δ$. If the check fails, abort.


Output

The sender computes $v_{j}=H(j,q_{j})⊕H(j,q_{j}⊕Δ)⊕Δforj∈[ℓ]$ and sends them to the receiver. $H$ is a tweakable hash function as used in garbled circuit.

The sender outputs $(H(j,q_{j}),H(j,q_{j})⊕Δ)$

For $j∈[ℓ]$, the receiver outputs the following: $Ifx_{j}=0,outputsH(j,t_{j});Ifx_{j}=1,outputsH(j,t_{j})⊕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}(F_{2_{λ}})$ protocol as follows.

The sender and receiver locally choose uniformly $128$bit random seeds $s_{0}$ and $s_{1}$, respectively.

The sender and receiver compute commitments of the seeds by choosing $128$bit random strings $r_{0},r_{1}$ and generate $c_{0}=SHA256(s_{0}∥r_{0})$ and $c_{1}=SHA256(s_{1}∥r_{1})$, respectively.

The sender sends $c_{0}$ to the receiver, and the receiver sends $c_{1}$ to the sender.

On receiving the commitments, the sender and receiver open the commitments by sending $(s_{0},r_{0})$ and $(s_{1},r_{1})$ to each other, respectively.

The sender checks $c_{1}$ by recomputing it with $s_{1},r_{1}$, and the receiver checks $c_{0}$ by recomputing it with $s_{0},r_{0}$. If checks fail, abort.

The sender and receiver locally compute $s=s_{0}⊕s_{1}$ and generate random elements with a $PRG$ as $χ_{1},…,χ_{ℓ}←PRG(s)$