Main motivation that blew my mind when started learning about OT was that it could be used by multiple parties to compute arbitrary functions. It’s one of the most basic primitive in mpc that allows building gc, pir,

Oblivious transfer: Alice and Bob are two parties allowed to participate. Alice has access to message: $m_{0},m_{1}∈{0,1}_{k}$, and Bob wants to know $m_{b}$, where $b∈{0,1}$ of its choice. Alice wants to ensure that $m_{1−b}$ remains hidden in the process.

## $21 −OT$

```
flowchart LR
subgraph S
b
end
S-->ROT["Rabin OT"]
ROT--1/2-->R1["b"]
ROT--1/2-->R2["#"]
subgraph R
R1
R2
end
```

Originally introduced by Rab81, where sender can send the message with probability 1/2, and thus, it’s name as $21 −OT$.^{1}

- run $GenModulus→(N,p,q)$ such that $N=pq$ and $p,q$ are prime.
- receiver choose x\xleftarrow{\}{ 1,\dots,N-1 }$,where$\gcd(x,N)=1$,compute$t=x^2 \mod{N}$.
- Sender knowing, $p,q$ computes $s=t $, and send to R.
- Note: there are four values possible for $t$, i.e. $±x,±y$. Sender chooses 1 out of 4 randomly.

- Receiver factors $N$, if $t=±y$ as $g(N,x+s)$ OR $g(N,x−s)$.
- $Pr[t=±y]=21 $.

$21 −OT$ implies $(\array21)−OT$: Proven in Cre87.

## OT variations

Simple 1-2 OT: sender has two messages, and receiver receives 1 out of 2 messages. Mainly used for secure evaluation of GC.

Oblivious Key Generation:

^{1}Apart from the 3 PKE method: $Gen,Enc,Dec$, introduce a new $OGen(r)→pk$. For $OGen$ to be secure, it needs to have 3 properties:

- No efficient adversary $D$ such that $D(pk_{b})→b$, where $pk_{0}←Gen(⋅);pk_{1}←OGen(⋅)$.
- A preimage sampling algorithm $OGen_{−1}$ such that $pk←OGen(r),r_{′}←OGen_{−1}(pk)$, then $OGen(r’)=pk$, and $r_{′}$ is uniformly distributed.
- CPA security of $pk←OGen(⋅)$.
These can be used to prove 2 properties:

- no efficient $A$ exists such that $sk←A(r)$, where $Gen(sk)=OGen(r)$.
- No efficient $D$ such that $Pr[D(r,Enc(pk,m_{0}))=b]$ is noticeable, i.e. no PPT distinguisher that can distinguish between $c_{0},c_{1}$.

Let’s consider a simple 1-2 OT using elgamal-pke (Ideally, any CPA secure PKE, with Oblivious Key Generation (OKE) can be used):

- Two parties involved are Alice, Bob. Alice has two messages $m_{0},m_{1}$, and Bob wants to know one of both.
- Bob generates two keys: Run ElGamal
*KeyGen*to generate a public, private key pair: $(pk_{b},sk)←Gen(1_{n})$, and choose another public key uniformly: pk_{1-b}\xleftarrow{\}\textsf{OGen}(r)$.Send$pk_{0},pk_{1}$ to Alice. - Alice encrypts both messages: $c_{0}:=Enc_{pk_{0}}(m_{0}),c_{1}:=Enc_{pk_{1}}(m_{1})$. Send $c_{0},c_{1}$ to Bob.
- Bob decrypts $m_{b}:=Dec_{sk_{b}}(c_{b})$.

Prove receiver's security for unbounded sender.

Here, $Samp$ is a oblivious samplable public key, and both $Gen,Samp$ is identically distributed, it means Sender’s view is identical with respect to a simulator that samples a public private key pair for $pk_{1−b}$.

Prove sender's security for

computationally bounded semi-honest receiver.Since CPA secure PKE is used to encrypt both messages, a receiver on getting $c_{0},c_{1}$ is able to know both $m_{0},m_{1}$ with probability $21 +negl(n)$, where $n$ is the security parameter. To prove this, run a reduction proof with adversary $A_{′}$ that is able to break CPA security of ElGamal PKE, by running adversary $A$ as a subroutine and simulating honest OT sender. Note that if receiver is malicious than it could generate $pk_{1−b}$ such that it knows the secret key, and then, can decrypt $c_{1−b}$.

Above construction is secure in the Ideal-world model, if no malicious adversary exists. So, let’s consider a protocol secure in real-world model.

- RSA
- Bellare-Micali OT
- Naor-Pinkas OT

**1-N OT:** sender has N messages, $m_{1},…,m_{n}$, and receiver receives 1 out of N message of its choice. Mainly used in PIR.

**k-N OT**: sender has N messages $m_{1},…,m_{N}$, and receiver wants to receive k out of N message of its choice. Mainly used in PSI.

## OT Extensions

Generally, OT is performed in batches with multiple $m$ OTs for $l−$bit strings represented as $OT_{m}$. Extension protocols were developed analogous to Hybrid protocols in PK cryptography. So, less OTs have to be performed and keys shared are extended using symmetric cryptographic primitives.

- random OT (ROT): functionality samples two strings for sender: $r_{0},r_{1}∈{0,1}_{l}$, with receiver bit as $b$. after the protocol, sender receives $r_{0},r_{1}$ while receiver gets $r_{b}$.
- With ROT, $ROT_{l}→OT_{l}$ by $S$ sending $x_{0}⊕r_{0},x_{1}⊕r_{1}$ to receiver
- Same can be done, if receiver chooses another bit for message.

- correlated OT (COT): Let’s say the difference between both messages is $x_{0}⊕x_{1}=Δ$.
- $S→COT:Δ$ while $R→COT:r_{b}$
- $COT→S:(r,r⊕Δ);COT→R:(r⊕bΔ)$.
- Using this, $ROT_{l}→COT_{k}$, i.e. output of COT can be extended to $l−$bit strings using random oracle.

## Practical Protocols

Let’s review CO15 protocol that uses 1-N $OT_{l}$ using $ROT_{l}$ extension:

- Work in set $S$, and group $G:(G,B,p,+)$
- Use a hash function: $H:(G×G)×G→{0,1}_{k}$ to derive a k bit key from group element.
- want to implement m $(\arrayn1)−OT$ for $l−$bit messages.
- Receiver $R$ has indices $(c_{1},…,c_{m})∈[n]_{m}$, i.e. vector of length $m$ with each value in $[0,n−1]$
- Sender $S$ has n-length vector of l-bit messages ${(M_{0},M_{1},…,M_{n−1})}_{i∈[m]}$.
- At the end, $R$ receives m-length vector of l-bit strings $(z_{1},…,z_{m})$ such that $z_{i}=M_{c_{i}}$.
- first they use Random OT to share keys between sender and receiver.
**Setup**: $y←Z_{p}$, calculate $S=y⋅g,T=y⋅S$, send $S$ to $R$.**Choose**: Receiver samples $∀i∈[m]:x_{i}←Z_{p}$, compute $R_{i}=c_{i}S+x_{i}B$, and send $R_{i}$ to $S$.**Key Derivation**:- $S$ computes $∀i∈[m],∀j∈[n]k_{i}=H_{(S,R_{i})}(yR_{i}−jT)$
- $R$ computes $∀i∈[m],∀j∈[n]:H_{(S,R_{i})}(x_{i}S)$

- at the end of the protocol, $k_{R}=k_{c_{i}}$, i.e. both $S,R$ has same keys for required indices, and it’s impossible for any $S_{∗}$ to guess $c_{i}$.

`ROT -> SOT`

: add a transfer phase to the protocol. $S$ sends encryption of messages to receiver**Transfer**: $S$ compute encryption for all messages: $∀i∈[m],∀j∈[n]:e_{j}=E(k_{j},M_{j})$ and sends to $R$**Retrieve**: $R$ decrypts chosen messages: $∀i∈[m]:z_{i}=D(k_{i},e_{c_{i}})$

Questions:

- how to realise H?
- how to realise symmetric encryption E?

Let’s review Naor-Pinkas OT:

- introduced 1-out-of-N protocol using Pseudorandom functions and 1-2 OT. Provides security against semi-honest receiver.

## IKNP03:

## SFE

Let’s look at how to evaluate functions securely using OT. Since, OT is a complete protocol, it can be used to do secure 2PC for any function.

### XOR

our aim is to evaluate $a⊕b$.

- any participating party will know about the contents of the other party, thus, it’s possible to just share the bits between the two to compute xor.

```
flowchart LR
Alice-..->Sim["Simulator"]-..->Alice-.(x0).->Sim-.F(x0,x1).->Alice
Sim-.x0.->F--F(x0,x1)-->Sim
B-.x1.->F--F(x0,x1)-->B
```

- To prove that protocol is secure, then there should exists simulator for both parties that
**simulates real world**for semi-honest adversary in ideal-world model $Alice,Bob$.

$P$ is used to denote semi-honest adversary, and $P$ is an honest adversary.

- So, the simulator will do bogus communication with adversary to satisfy the transcript, then it’ll extract bit $x_{0}$ from the transcript, and send to $F$ functionality, which computes $F(x_{0},x_{1})$ and sends to simulator.
- Simulator forwards this to adversary.
- The protocol is secure, if view of adversary is indistinguishable from real world protocol.

- To prove that computation of XOR is secure, consider real world protocol, where A sends $a$ to B, and B sends $b$ to A.
- Now, in real world, let’s consider a simulator for $A$, that extracts $a$ from transcript, sends to $F_{XOR}$, gets back $a⊕b$, computes $a⊕a⊕b$, sends $b$ to $A$.
- Observe that view of $A_{ideal}$ with $S$ is indistinguishable from $A_{real}$, and $output_{B_{ideal}}∼output_{B_{real}}$.

### AND: $a∧b$

- For AND, it’s not possible to just share the bits, as the other party can’t compute $b$ from $a,a∧b$.
- Let’s first create the ideal world $F_{AND}$ functionality:
- gets $a$ from $A$, and $b$ from B.
- compute $a∧b$, sends to $A,B$.

- Real world functionality:
- Alice calculates $a∧0,a∧1$, sends to i
**deal-world**$F_{\array12OT}$. - gets $b$ from $B$, sends $a∧b$ to $B$.
- B sends $a∧b$ to A.

- Alice calculates $a∧0,a∧1$, sends to i
- Let’s consider a simulator $S_{1}$ for A in ideal world.
- $S_{1}$ can extract $a$ from $a∧0,a∧1$ in the transcript.
- sends to $F_{AND}$, gets $a∧b$.
- sends back to $A$. $B$’s simulator acts similarly.

- from $A$‘s perspective, $A_{real}∼A_{ideal}$ and $output_{B_{real}}∼output_{B_{ideal}}$.

Composability: Use of 1-2 ideal world OT in previous protocol for real-world protocol is called Composability, where an already 2PC secure protocol can be substituted.

### Arbitrary Computation

For doing any arbitrary computation on boolean circuits, 2-2 secret sharing is used to split the shares of boolean bit, so that no intermediate value of a gate can be used to infer input values.^{2}

- To split a bit $b$, choose a random $r$, send $r⊕b$ to $A$, $r$ to B.

Suppose $A$ has $a_{1},a_{2}$, and $B$ has $b_{1},b_{2}$

- XOR: compute $(a_{1}⊕b_{1})⊕(a_{2}⊕b_{2})$
- take individual shares and compute xor, i..e $a_{1}⊕a_{2}$, $b_{1}⊕b_{2}$
- share the results with other party.

- AND: compute $(a_{1}⊕b_{1})∧(a_{2}⊕b_{2})$,
- distribute
- perform $F_{AND}$ on $a_{1}∧b_{2},a_{2}∧b_{1}$

## References

- CS598DK: Special Topics in Cryptography
- Don’t overextend your Oblivious Transfer
- Secure Computation Lecture Series
- Actively Secure 1-out-of-N OT Extension with Application to Private Set Intersection
- A simple generic construction to build oblivious transfer protocols from homomorphic encryption schemes
- Efficient Batched Oblivious PRF with Applications to Private Set Intersection
- EMP-OT
- Ferret: Fast Extension for coRRElated oT with small communication
- Actively Secure OT Extension with Optimal Overhead
- Supersonic OT: Fast Unconditionally Secure Oblivious Transfer
- A Survey of Oblivious Transfer Protocol
- Post Quantum OT:
- sdiehl: OT
- OSU-Crypto: libOTe