Skip to content

Oblivious Transfer, Oblivious Transfer Extension and Variations

License

Notifications You must be signed in to change notification settings

boltlabs-inc/emp-ot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

emp-ot Build Status

Protocols

This repo contains state-of-the-art OT implementations. Include two base OTs, IKNP OT extension and Ferret OT extension. All hash functions used for OTs are implemented with MiTCCR for optimal concrete efficiency.

Installation

  1. wget https://raw.githubusercontent.com/emp-toolkit/emp-readme/master/scripts/install.py
  2. python install.py -install -tool -ot
    1. By default it will build for Release. -DCMAKE_BUILD_TYPE=[Release|Debug] option is also available.
    2. No sudo? Change CMAKE_INSTALL_PREFIX.

Test

Testing on localhost

./run ./bin/[binary]

with [binary]=ot for common OT functionalities, [binary]=ferret for ferret specific functionalities. The script run will locally open two programs.

Testing on two

  1. Change the IP address in the test code (e.g. here)

  2. run ./bin/[binary] 1 [port] on one machine and

    run ./bin/[binary] 2 [port] on the other machine.

Performance

Hardware: AWS m5.4xlarge Results below are for performing 2^26 OTs. IKNP-style protocols use 1 thread; FERRET uses 5 threads.

50 Mbps

128 NPOTs:	Tests passed.	12577 us
Passive IKNP OT	Tests passed.	129262 OTps
Passive IKNP COT	Tests passed.	388316 OTps
Passive IKNP ROT	Tests passed.	386190 OTps
128 COOTs:	Tests passed.	11073 us
Active IKNP OT	Tests passed.	129152 OTps
Active IKNP COT	Tests passed.	387380 OTps
Active IKNP ROT	Tests passed.	385235 OTps
Passive FERRET OT	Tests passed.	191511 OTps
Passive FERRET COT	Tests passed.	1.87663e+07 OTps
Passive FERRET ROT	Tests passed.	1.77188e+07 OTps
Active FERRET OT	Tests passed.	191519 OTps
Active FERRET COT	Tests passed.	1.88838e+07 OTps
Active FERRET ROT	Tests passed.	1.76447e+07 OTps

Active FERRET RCOT	Tests passed.	4.97468e+07 OTps
Active FERRET RCOT inplace	Tests passed.	5.84142e+07 OTps

10 Gbps

128 NPOTs:	Tests passed.	11739 us
Passive IKNP OT	Tests passed.	1.55476e+07 OTps
Passive IKNP COT	Tests passed.	2.96661e+07 OTps
Passive IKNP ROT	Tests passed.	1.65765e+07 OTps
128 COOTs:	Tests passed.	20064 us
Active IKNP OT	Tests passed.	1.39589e+07 OTps
Active IKNP COT	Tests passed.	2.42705e+07 OTps
Active IKNP ROT	Tests passed.	1.47379e+07 OTps
Passive FERRET OT	Tests passed.	1.60211e+07 OTps
Passive FERRET COT	Tests passed.	3.86102e+07 OTps
Passive FERRET ROT	Tests passed.	1.82382e+07 OTps
Active FERRET OT	Tests passed.	1.32552e+07 OTps
Active FERRET COT	Tests passed.	3.58546e+07 OTps
Active FERRET ROT	Tests passed.	1.79005e+07 OTps

Active FERRET RCOT	Tests passed.	6.1264e+07 OTps
Active FERRET RCOT inplace	Tests passed.	7.42027e+07 OTps

Usage

Our test files already provides useful sample code. Here we provide an overview.

Standard OT

#include<emp-tool/emp-tool.h> // for NetIO, etc
#include<emp-ot/emp-ot.h>   // for OTs

block b0[length], b1[length];
bool c[length];
NetIO io(party==ALICE ? nullptr:"127.0.0.1", port); // Create a network with Bob connecting to 127.0.0.1
OTNP<NetIO> np(&io); // create a Naor Pinkas OT using the network above
if (party == ALICE)
// ALICE is sender, with b0[i] and b1[i] as messages to send
    np.send(b0, b1, length); 
else
// Bob is receiver, with c[i] as the choice bit 
// and obtains b0[i] if c[i]==0 and b1[i] if c[i]==1
    np.recv(b0, c, length);  

Note that NPOT can be replaced to OTCO, IKNP, or FerretCOT without changing any other part of the code. They all share the same API

Correlated OT and Random OT

Correlated OT and Random OT are supported for IKNP and FerretCOT. See following as an example. They all share extra APIs

block delta;

IKNP<NetIO> ote(&io, false); // create a semi honest OT extension

//Correlated OT
if (party == ALICE)
    ote.send_cot(b0, delta, length);
else
    ote.recv_cot(b0, c, length);
    
//Random OT
if (party == ALICE)
    ote.send_rot(b0, b1, length);
else
    ote.recv_rot(b0, c, length);

Ferret OT

Ferret OT produces correlated OT with random choice bits (rcot). Extra APIs are here. Our implementation provides two interface ferretot.rcot() and ferretot.rcot_inplace(). While the first one support filling an external array of any length, an extra memcpy is needed. The second option work on the provided array directly and thus avoid the memcpy. However, it produces a fixed number of OTs (ferretcot->n) for every invocation. The sample code is mostly self-explainable on how to use it.

Note that the choice bit is embedded as the least bit of the block on the receiver's side. To make sure the correlation works for all bits, the least bit of Delta is 1. This can be viewed as an extension of the point-and-permute technique. See this code on how ferret is used to fullfill standard cot interface.

Citation

@misc{emp-toolkit,
   author = {Xiao Wang and Alex J. Malozemoff and Jonathan Katz},
   title = {{EMP-toolkit: Efficient MultiParty computation toolkit}},
   howpublished = {\url{https://github.com/emp-toolkit}},
   year={2016}
}

Question

Please send email to [email protected]

Acknowledgement

This work was supported in part by the National Science Foundation under Awards #1111599 and #1563722.

About

Oblivious Transfer, Oblivious Transfer Extension and Variations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 97.4%
  • CMake 1.6%
  • Shell 1.0%