Skip to content

Commit

Permalink
Added DPFs and Foleage F4 OLE and triples (#168)
Browse files Browse the repository at this point in the history
* dpf v1

* partia

* sparse dpf

* ported foliage and some optimizations

* FoliageF4Ole

* foleage fft attempted opt and started tri dpf

* partial

* tridpf partially working

* triDpf Working

* optimized triDpf

* dpf refactor and bugfix

* dpf refactor and keygen

* dpf noninteractive eval fix

* triDpf PCG working

* foliage 243 elem leaf

* foleage dpf for leaf working

* shared foleage position done and tensor coeff started

* distributed foliage working

* foleage cleanup

* optimizing

* cleanup

* working version

* foleage cleanup

* fixed sparse dpf

* foleage ci

* foleage mac compile

* removing deprecated calls

* removing deprecated calls

* mac compile fixes

* mac compile fixes

* mac ci debug

* mac ci debug

* mac ci debug

* mac compile fixes

* mac compile fixes

* mac compile fixes

* mac compile fixes

* mac ci debug

* mac ci debug

* mac ci debug

* mac ci debug

* mac ci debug

* mac ci debug

* mac ci debug

* ci working

* dpf fix

* added conditional compile options

* readme
  • Loading branch information
ladnir authored Feb 27, 2025
1 parent e19f77b commit 2f68131
Show file tree
Hide file tree
Showing 37 changed files with 6,739 additions and 1,441 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ name: CI
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master, stage, components, cpp20 ]
branches: [ master, stage, foliage, cpp20 ]
pull_request:
branches: [ master, stage, components ]
branches: [ master, stage, foliage ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
run: python3 build.py -DENABLE_BOOST=OFF -DVERBOSE_FETCH=ON -DENABLE_SSE=OFF -DENABLE_MOCK_OT=true -D ENABLE_ALL_OT=ON

- name: unit tests
run: ./out/build/osx/frontend/frontend_libOTe -u
run: ./out/build/osx/frontend/frontend_libOTe -u


- name: find source tree
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:

# Runs a set of commands using the runners shell
- name: build libOTe
run: python3 build.py --par=1 -D ENABLE_ALL_OT=ON -DENABLE_MOCK_OT=true -G Ninja
run: python3 build.py -D ENABLE_ALL_OT=ON -DENABLE_MOCK_OT=true -G Ninja


- name: unit test
Expand Down
15 changes: 7 additions & 8 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"FETCH_AUTO": true,
"ENABLE_ALL_OT": true,
"ENABLE_SSE": true,
Expand Down Expand Up @@ -36,9 +36,8 @@
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}",
"copySourcesOptions": {
"exclusionList": [ ".vs", "out/build", "out/install", "out/boost*", "out/relic/build", ".git" ]
},
"rsyncCommandArgs": [ "-t", "--delete", "--include=${sourceDir}/out/macoro/*", "--verbose" ]
"exclusionList": [ ".vs", "out", ".git" ]
}
}
}
},
Expand All @@ -64,15 +63,15 @@
"ENABLE_MR": "ON",
"ENABLE_SIMPLESTOT": "ON",
"ENABLE_GMP": false,
"ENABLE_RELIC": true,
"ENABLE_SODIUM": false,
"ENABLE_RELIC": false,
"ENABLE_SODIUM": true,
"ENABLE_BOOST": true,
"ENABLE_BITPOLYMUL": true,
"FETCH_AUTO": "ON",
"ENABLE_CIRCUITS": true,
"VERBOSE_FETCH": true,
"ENABLE_SSE": true,
"ENABLE_AVX": true,
"ENABLE_SSE": false,
"ENABLE_AVX": false,
"ENABLE_ASAN": true,
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"CMAKE_PREFIX_PATH": "${sourceDir}/../out/install/${presetName}"
Expand Down
63 changes: 54 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,35 @@ Malicious OT extension:

Vole:
* Generic subfield noisy VOLE (semi-honest) [[BCGIKRS19]](https://eprint.iacr.org/2019/1159.pdf)
* Generic subfield silent VOLE (malicious/semi-honest) [[BCGIKRS19]](https://eprint.iacr.org/2019/1159.pdf),[[RRT23]](https://eprint.iacr.org/2023/882).
* Generic subfield silent VOLE (malicious/semi-honest) [[BCGIKRS19]](https://eprint.iacr.org/2019/1159.pdf),[[RRT23]](https://eprint.iacr.org/2023/882).

OLE and Beaver Triples:
* Foleage Binary Beaver Triples and F4 OLE (semi-honest) [[BBCCDS2024]](https://eprint.iacr.org/2024/429.pdf).

Distributed Point Functions:
* Distributed Point Function (DPF)[[BGI18]](https://eprint.iacr.org/2018/707.pdf) with [Distributed] Key Generation (DKG) [[Ds17]](https://eprint.iacr.org/2017/827.pdf).
* Ternary Distributed Point Function (DPF)[[BBCCDS2024]](https://eprint.iacr.org/2024/429.pdf) with Distributed Key Generation (DKG).
* Sparse Distributed Point Function (DPF) with Distributed Key Generation (DKG).

## Introduction

This library provides several different classes of OT protocols. First is the
This library provides several different classes of OT, VOLE and Beaver Triple generation protocols. First is the
base OT protocol of [CO15, MR19, MRR21]. These protocol bootstraps all the other
OT extension protocols. Within the OT extension protocols, we have 1-out-of-2,
1-out-of-N, and VOLE both in the semi-honest and malicious settings. See The `frontend` or `libOTe_Tests` folder for examples.
protocols. Within the OT extension protocols, we have 1-out-of-2,
1-out-of-N, and VOLE both in the semi-honest and malicious settings. Binary beaver triples can be
generating using the Foleage protocol. The library also includes a distributed point function (DPF)
protocol with distributed key generation (DKG) for secure computation. See The `frontend` or `libOTe_Tests`
folder for examples.

All implementations are highly optimized using fast SSE instructions and vectorization
to obtain optimal performance both in the single and multi-threaded setting.

Networking can be performed using both the sockets provided by the library and
external socket classes. The simplest integration can be achieved via the [message passing interface](https://github.com/osu-crypto/libOTe/blob/master/frontend/ExampleMessagePassing.h) where the user is given the protocol messages that need to be sent/received. Users can also integrate their own socket type for maximum performance. See the [coproto](https://github.com/Visa-Research/coproto/blob/main/frontend/SocketTutorial.cpp) tutorial for examples.
external socket classes. The simplest integration can be achieved via the
[message passing interface](https://github.com/osu-crypto/libOTe/blob/master/frontend/ExampleMessagePassing.h)
where the user is given the protocol messages that need to be sent/received.
Users can also integrate their own socket type for maximum performance.
See the [coproto](https://github.com/Visa-Research/coproto/blob/main/frontend/SocketTutorial.cpp) tutorial for examples.


## Build
Expand All @@ -47,7 +62,8 @@ There is one mandatory dependency on [coproto](https://github.com/Visa-Research/
and three **optional dependencies** on [libsodium](https://doc.libsodium.org/),
[Relic](https://github.com/relic-toolkit/relic), or
[SimplestOT](https://github.com/osu-crypto/libOTe/tree/master/SimplestOT) (Unix only)
for Base OTs. [Boost Asio](https://www.boost.org/doc/libs/1_84_0/doc/html/boost_asio.html) tcp networking and [OpenSSL](https://www.openssl.org/) support can optionally be enabled.
for Base OTs. [Boost Asio](https://www.boost.org/doc/libs/1_84_0/doc/html/boost_asio.html)
tcp networking and [OpenSSL](https://www.openssl.org/) support can optionally be enabled.
CMake 3.15+ is required and the build script assumes python 3.

The library can be built with libsodium, all OT protocols enabled and boost asio TCP networking as
Expand All @@ -60,10 +76,14 @@ The main executable with examples is
```
./out/build/<platform>/frontend/frontend_libOTe
```
where `<platform>` is the build directory, eg `linux`, `x64-Release`, `osx`, etc. **Unit Tests** and **example code** can be run with this excutable. Run the program with no options for a list of available options.
where `<platform>` is the build directory, eg `linux`, `x64-Release`, `osx`, etc.
**Unit Tests** and **example code** can be run with this excutable.
Run the program with no options for a list of available options.

### Build Options
LibOTe can be built with various only the selected protocols enabled. `-D ENABLE_ALL_OT=ON` will enable all available protocols depending on platform/dependencies. The `ON`/`OFF` options include
LibOTe can be built with various only the selected protocols enabled.
`-D ENABLE_ALL_OT=ON` will enable all available protocols depending
on platform/dependencies. The `ON`/`OFF` options include

**Malicious base OT:**
* `ENABLE_SIMPLESTOT` the SimplestOT [[CO15]](https://eprint.iacr.org/2015/267.pdf) protocol (relic or sodium).
Expand All @@ -81,9 +101,22 @@ LibOTe can be built with various only the selected protocols enabled. `-D ENABLE
* `ENABLE_SOFTSPOKEN_OT` the Roy [Roy22](https://eprint.iacr.org/2022/192) semi-honest/malicious protocol.
* `ENABLE_SILENTOT` the [[BCGIKRS19]](https://eprint.iacr.org/2019/1159.pdf),[[RRT23]](https://eprint.iacr.org/2023/882) semi-honest/malicious protocol.

**1-out-of-N OT Extension:**
* `ENABLE_KKRT` the Kolesnikov et al [[KKRT16]](https://eprint.iacr.org/2016/799) semi-honest protocol.
* `ENABLE_OOS` the Orrù et al [[OOS16]](http://eprint.iacr.org/2016/933) semi-honest/malicious protocol.

**Vole:**
* `ENABLE_SILENT_VOLE` the [[BCGIKRS19]](https://eprint.iacr.org/2019/1159.pdf),[[RRT23]](https://eprint.iacr.org/2023/882) semi-honest/malicious protocol.

** DPF:**
* `ENABLE_REGULAR_DPF` the Boyle et al [[BGI18]](https://eprint.iacr.org/2018/707.pdf) semi-honest protocol.
* `ENABLE_TERNARY_DPF` the Bombar et al [[BBCCDS2024]](https://eprint.iacr.org/2024/429.pdf) semi-honest protocol.
* `ENABLE_SPARSE_DPF` protocol allowing a sparse set of DPF leaf values.

**Beaver Triples:**
* `ENABLE_FOLEAGE` the Bombar et al [[BBCCDS2024]](https://eprint.iacr.org/2024/429.pdf) semi-honest protocol.


Addition options can be set for cryptoTools. See the cmake output.

### Dependencies
Expand Down Expand Up @@ -188,12 +221,18 @@ find_package(libOTe REQUIRED
silent_vole
oos
kkrt
foleage
regular_dpf
ternary_dpf
sparse_dpf
)
```

## Help

Contact Peter Rindal peterrindal@gmail.com for any assistance on building
Create a github issue or contact Peter Rindal peterrindal@gmail.com for any assistance on building
or running the library.

## Citing
Expand Down Expand Up @@ -226,8 +265,14 @@ or running the library.

[ALSZ15] - Gilad Asharov and Yehuda Lindell and Thomas Schneider and Michael Zohner, _More Efficient Oblivious Transfer Extensions with Security for Malicious Adversaries_. [eprint/2015/061](https://eprint.iacr.org/2015/061)

[BGI18] - Elette Boyle, Niv Gilboa, Yuval Ishai, _Function Secret Sharing: Improvements and Extensions_ [eprint/2018/707](https://eprint.iacr.org/2018/707.pdf)

[Ds17] - Jack Doerner, abhi shelat, _Scaling ORAM for Secure Computation_ [eprint/2017/827](https://eprint.iacr.org/2017/827.pdf)

[CRR21] - Geoffroy Couteau ,Srinivasan Raghuraman and Peter Rindal, _Silver: Silent VOLE and Oblivious Transfer from Hardness of Decoding Structured LDPC Codes_.

[Roy22] - Lawrence Roy, SoftSpokenOT: Communication--Computation Tradeoffs in OT Extension. [eprint/2022/192](https://eprint.iacr.org/2022/192)

[RRT23] - Srinivasan Raghuraman, Peter Rindal and Titouan Tanguy, _Expand-Convolute Codes for Pseudorandom Correlation Generators from LPN_. [eeprint/2023/882](https://eprint.iacr.org/2023/882)

[BBCCDS2024] - Maxime Bombar, Dung Bui, Geoffroy Couteau, Alain Couvreur, Clément Ducros, and Sacha Servan-Schreiber, _FOLEAGE: F4 OLE-Based Multi-Party Computation for Boolean Circuits_. [eprint/2024/429](https://eprint.iacr.org/2024/429.pdf)
57 changes: 34 additions & 23 deletions cmake/buildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ if(DEFINED ENABLE_ALL_OT)
set(ENABLE_SIMPLESTOT_ASM ${oc_BB} CACHE BOOL "" FORCE)
set(ENABLE_MR_KYBER ${oc_BB} CACHE BOOL "" FORCE)

# requires sse
if(ENABLE_SSE)
set(oc_BB ${ENABLE_ALL_OT})
else()
set(oc_BB OFF)
endif()
set(ENABLE_SILENTOT ${oc_BB} CACHE BOOL "" FORCE)


# general
set(ENABLE_KOS ${ENABLE_ALL_OT} CACHE BOOL "" FORCE)
set(ENABLE_IKNP ${ENABLE_ALL_OT} CACHE BOOL "" FORCE)
Expand All @@ -77,17 +68,18 @@ if(DEFINED ENABLE_ALL_OT)
set(ENABLE_OOS ${ENABLE_ALL_OT} CACHE BOOL "" FORCE)
set(ENABLE_KKRT ${ENABLE_ALL_OT} CACHE BOOL "" FORCE)
set(ENABLE_SILENTOT ${ENABLE_ALL_OT} CACHE BOOL "" FORCE)
set(ENABLE_SILENT_VOLE ${ENABLE_ALL_OT} CACHE BOOL "" FORCE)
set(ENABLE_SILENT_VOLE ${ENABLE_ALL_OT} CACHE BOOL "" FORCE)
set(ENABLE_FOLEAGE ${ENABLE_ALL_OT} CACHE BOOL "" FORCE)
set(ENABLE_REGULAR_DPF ${ENABLE_ALL_OT} CACHE BOOL "" FORCE)
set(ENABLE_TERNARY_DPF ${ENABLE_ALL_OT} CACHE BOOL "" FORCE)
set(ENABLE_SPARSE_DPF ${ENABLE_ALL_OT} CACHE BOOL "" FORCE)

unset(ENABLE_ALL_OT CACHE)

endif()


if(APPLE)
option(ENABLE_BITPOLYMUL "Build with bit poly mul inegration" FALSE)
else()
option(ENABLE_BITPOLYMUL "Build with bit poly mul inegration" TRUE)
endif()
option(ENABLE_BITPOLYMUL "Build with bit poly mul inegration" FALSE)

option(ENABLE_MOCK_OT "Build the insecure mock base OT" OFF)

Expand All @@ -111,11 +103,13 @@ option(ENABLE_KKRT "Build the KKRT 1-oo-N OT-Ext protocol." OFF)
option(ENABLE_PPRF "Build the PPRF protocol." OFF)
option(ENABLE_SILENT_VOLE "Build the Silent Vole protocol." OFF)

option(ENABLE_INSECURE_SILVER "Build with silver codes." OFF)
option(ENABLE_LDPC "Build with ldpc functions." OFF)
if(ENABLE_INSECURE_SILVER)
set(ENABLE_LDPC ON)
endif()
option(ENABLE_FOLEAGE "Build the Foleage OLE protocol." OFF)


option(ENABLE_REGULAR_DPF "Build the Regular DPF protocol." OFF)
option(ENABLE_TERNARY_DPF "Build the Ternary DPF protocol." OFF)
option(ENABLE_SPARSE_DPF "Build the Sparse DPF protocol." OFF)

option(NO_KOS_WARNING "Build with no kos security warning." OFF)


Expand All @@ -133,6 +127,14 @@ if(ENABLE_IKNP)
set(ENABLE_KOS true)
endif()

if(ENABLE_FOLEAGE)
set(ENABLE_TERNARY_DPF true)
endif()

if(ENABLE_SPARSE_DPF)
set(ENABLE_REGULAR_DPF true)
endif()

message(STATUS "General Options\n=======================================================")

message(STATUS "Option: VERBOSE_FETCH = ${VERBOSE_FETCH}")
Expand Down Expand Up @@ -160,16 +162,25 @@ message(STATUS "1-out-of-2 Delta-OT Extension protocols\n=======================
message(STATUS "Option: ENABLE_DELTA_KOS = ${ENABLE_DELTA_KOS}\n\n")

message(STATUS "Vole protocols\n=======================================================")
message(STATUS "Option: ENABLE_SILENT_VOLE = ${ENABLE_SILENT_VOLE}\n\n")
message(STATUS "Option: ENABLE_SILENT_VOLE = ${ENABLE_SILENT_VOLE}\n\n")


message(STATUS "DPF protocols\n=======================================================")
message(STATUS "Option: ENABLE_REGULAR_DPF = ${ENABLE_REGULAR_DPF}")
message(STATUS "Option: ENABLE_SPARSE_DPF = ${ENABLE_SPARSE_DPF}")
message(STATUS "Option: ENABLE_TERNARY_DPF = ${ENABLE_TERNARY_DPF}")
message(STATUS "Option: ENABLE_PPRF = ${ENABLE_PPRF}\n\n")

message(STATUS "OLE and Triple protocols\n=======================================================")
message(STATUS "Option: ENABLE_FOLEAGE = ${ENABLE_FOLEAGE}\n\n")

message(STATUS "1-out-of-N OT Extension protocols\n=======================================================")
message(STATUS "Option: ENABLE_OOS = ${ENABLE_OOS}")
message(STATUS "Option: ENABLE_KKRT = ${ENABLE_KKRT}\n\n")


message(STATUS "other \n=======================================================")
message(STATUS "Option: NO_KOS_WARNING = ${NO_KOS_WARNING}")
message(STATUS "Option: ENABLE_PPRF = ${ENABLE_PPRF}\n\n")
message(STATUS "Option: NO_KOS_WARNING = ${NO_KOS_WARNING}\n\n")

#############################################
# Config Checks #
Expand Down
11 changes: 10 additions & 1 deletion cmake/buildOptions.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ set(ENABLE_DELTA_KOS @ENABLE_DELTA_KOS@)
set(ENABLE_OOS @ENABLE_OOS@)
set(ENABLE_KKRT @ENABLE_KKRT@)
set(ENABLE_SILENT_VOLE @ENABLE_SILENT_VOLE@)
set(NO_SILVER_WARNING @NO_SILVER_WARNING@)

set(ENABLE_FOLEAGE @ENABLE_FOLEAGE@)

set(ENABLE_REGULAR_DPF @ENABLE_REGULAR_DPF@)
set(ENABLE_SPARSE_DPF @ENABLE_SPARSE_DPF@)
set(ENABLE_TERNARY_DPF @ENABLE_TERNARY_DPF@)

set(ENABLE_PPRF @ENABLE_PPRF@)

Expand Down Expand Up @@ -127,5 +132,9 @@ set(libOTe_delta_kos_FOUND ${ENABLE_DELTA_KOS})
set(libOTe_silent_vole_FOUND ${ENABLE_SILENT_VOLE})
set(libOTe_oos_FOUND ${ENABLE_OOS})
set(libOTe_kkrt_FOUND ${ENABLE_KKRT})
set(libOTe_foleage_FOUND ${ENABLE_FOLEAGE})
set(libOTe_regular_dpf_FOUND ${ENABLE_REGULAR_DPF})
set(libOTe_ternary_dpf_FOUND ${ENABLE_TERNARY_DPF})
set(libOTe_sparse_dpf_FOUND ${ENABLE_SPARSE_DPF})


2 changes: 1 addition & 1 deletion cryptoTools
3 changes: 3 additions & 0 deletions frontend/ExampleBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ namespace osuCrypto

std::cout << tag << (role == Role::Receiver ? " (receiver)" : " (sender)")
<< " n=" << totalOTs << " " << milli << " ms" << std::endl;

#else
std::cout << "This example requires coproto to enable boost support. Please build libOTe with `-DCOPROTO_ENABLE_BOOST=ON`. \n" << LOCATION << std::endl;
#endif
}

Expand Down
Loading

0 comments on commit 2f68131

Please sign in to comment.