# Linear-Complexity Private Function Evaluation is Practical

## Performance measurement data

This data set contains performance measurement data for the paper 'Linear-Complexity Private Function Evaluation is Practical' published at ESORICS'20.

### Hardware configuration

All measurements were performed between two servers with the following hardware configuration:

CPU: Intel Core i9-7960X CPU, 32 Cores, 2.8 Ghz
RAM: 128 GB RAM

The measurements were performed in two different simulated network settings:

LAN setting:  10 Gbit/s,   1 ms RTT
WAN setting: 100 Mbit/s, 100 ms RTT


The software implementation of the protocol used to create these measurements as well as build instructions can be found on GitHub:
https://github.com/encryptogroup/linearPFE


### Running PFE performance measurements

This code is provided as a experimental implementation for testing purposes and should not be used in a productive environment. We cannot guarantee security and correctness.

Prior to running the performance measurements, choose the HE scheme in `src/abycore/sharing/yaosharing.h`:
```
// choose between DJN/Paillier, RLWE-based (BFV) or ECC-based (EC ElGamal) encryption
#define KM11_CRYPTOSYSTEM_DJN 1
#define KM11_CRYPTOSYSTEM_BFV 2
#define KM11_CRYPTOSYSTEM_ECC 3
#define KM11_CRYPTOSYSTEM KM11_CRYPTOSYSTEM_ECC // <-- set the HE scheme of you choice here
```

If you want to disable parallelized multi-core execution, you may disable OpenMP in the `CMakeLists.txt` file in the root directory of the project:
```
# Remove/comment the following lines to disable OpenMP parallel execution
find_package(OpenMP)
if(OPENMP_FOUND)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
```

After changing these lines, make sure to re-run `cmake` and `make` (see build instruction) to apply the changes.

Inside the build directory, you can find two helper scripts to run and evaluate the experiments:
- `./build/run_PFE_perf.sh` can be used to execute the performance measurements. Please run `./run_PFE_perf.sh 0` to start the server (holding the private input x) and run `./run_PFE_perf.sh 1` to start the client (holding the private function f). See the comments inside the script on how to run the performance tests between two independent machines. The script will automatically run 10 iterations with circuits of size 1000, 10000, 100000 and 1000000 gates each.


The scripts `eval_perf_UC.py`, `eval_perf_MPC.py` and `eval_perf_KM11.py` included in this data set can be used to evaluate the measurements created by the previous script. List the measurement files usung `ls` and run `python eval_PFE_perf.py perf_2020_01_01-1337`, where `perf_2020_01_01-1337` is the prefix of the measurement files, to create csv files with containing the averaged performance measurements. The script will automatically detect the HE scheme and will name the csv files (created in the current directory) accordingly.
