Skip to content

aSlunk/ConvTriple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Uses OpenCheetah, SecONNds, Troy-Nova and EMP-OT to implement two protocols for 2PC and a few linear operations.

Overview

  1. Building
    1. Dependencies
    2. This project
  2. Running
  3. Protocols
    1. AB
    2. AB2

Building

Build the dependencies

  • Install OpenSSL and Eigen3
# for debian based distributions
apt install libssl-dev libeigen3-dev
  • To install EMP-Tool/EMP-OT/SEAL use:
./deps.sh

$\Rightarrow$ this will create ./deps/ and place the projects inside it.

  • For GPU support instead use the following to install Troy-Nova (this requires CUDA)
GPU_ARCHITECTURE="<architecture>" ./deps.sh -gpu

# or try

GPU_ARCHITECTURE="$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | sed 's/\.//g')" ./deps.sh -gpu

Build the project

./build.sh

# OR

mkdir ./data # to store ferret output
cmake . -B build -DCMAKE_BUILD_TYPE=Release -DUSE_APPROX_RESHARE=OFF \
    -DTRIPLE_VERIFY=OFF -DTRIPLE_COLOR=OFF -DTRIPLE_ZERO=ON \
    -DTRIPLE_GPU=OFF
cmake --build build -j

CMake Options:

  • TRIPLE_VERIFY (BOOL): If enabled - Verify correctness of the triples. (For testing only)
  • TRIPLE_COLOR (BOOL): If enabled - Use ANSI color codes for colored logs.
  • TRIPLE_ZERO (BOOL): If enabled - Allow tensors to be zero (can be insecure).
  • TRIPLE_GPU (BOOL): If enabled - Use Troy-Nova for Convolutions.
  • TRIPLE_GPU_REVERSE (BOOL): If enabled - Encrypt filters instead of images (requires TRIPLE_GPU=ON).
  • TRIPLE_SEED (NUM): Set the seed (-1: no seed).
  • TRIPLE_LOG_LEVEL (NUM):
    • 0: Log time and data required.
    • 1: Log debug info and errors.
    • 2: Log errors.

Formatting:

cmake --build build -t format

Run the Project

Server:

./build/bin/cheetah <PORT> <SAMPLES> <BATCHSIZE> <threads>

Client:

./build/bin/cheetah_client <PORT> <HOST> <SAMPLES> <BATCHSIZE> <threads>

Note

<SAMPLES> has currently no effect

Protocols

Currently supported:

  • Boolean triples via OT
  • Matrix $\times$ Vector triples via HE
  • 2D-Convolution triples via HE
  • 2D-BatchNorm triples via HE

Protocol 1

Note

Both parties have shares of the image (A1/A2) and the filters (B1/B2)

  • Party1:
    • IN: $A1, B1$
    • OUT: $C1 = M2 + R1$
  • Party2:
    • IN: $A2, B2$
    • OUT: $C2 = M1 + R2$

Verify: $C1 + C2 = (A1 + A2) \odot (B1 + B2)$

Step 1:

  • Party 1: A1' = Enc(A1), send A1' to Party 2
  • Party 2: A2' = Enc(A2), send A2' to Party 1

Step 2:

  • Party 1: M1 = (A1 + A2') B1 - R1, send M1 to Party 2
  • Party 2: M2 = (A1' + A2) B2 - R2, send M2 to Party 1

Step 2:

  • Party 1: C1 = Dec(M2) + R1
  • Party 2: C2 = DEC(M1) + R2

Protocol 2

Note

Both parties have shares of the image (A1/A2) but only Party 2 has the filters (B2)

  • Party1:
    • IN: $A1$
    • OUT: $C1 = M2$
  • Party2:
    • IN: $A2, B2$
    • OUT: $C2 = R2$

Verify $C1 + C2 = (A1 + A2) \odot B2$

Step 1:

  • Party 1: A1' = Enc(A1), send A1' to Party 2

Step 2:

  • Party 2: M2 = (A1' + A2) B2 - R2, send M2 to Party 1

Step 3:

  • Party 1: C1 = Dec(M2)
  • Party 2: C2 = R2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published