Skip to content

Commit

Permalink
feat: version 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PETAce committed Oct 24, 2023
1 parent 471d700 commit ead22f6
Show file tree
Hide file tree
Showing 25 changed files with 2,752 additions and 13 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@
- Added psuedo-random number generators based on: SHAKE_128, BLAKE2Xb, and AES_ECB_CTR.
- Added sampling of bytes, 32-bit unsigned integers, and 64-bit unsigned integers from the uniform distribution.
- Added prime field elliptic curve group arithmetics including hash-to-curve.

## Version 0.2.0

### Features

- Added hashing tables: Cuckoo hashing and simple hashing.
- Added partially homomorphic encryption: the Paillier cryptosystem.
26 changes: 25 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
message(STATUS "Build type (CMAKE_BUILD_TYPE): ${CMAKE_BUILD_TYPE}")

project(SOLO VERSION 0.1.0 LANGUAGES CXX C)
project(SOLO VERSION 0.2.0 LANGUAGES CXX C)

########################
# Global configuration #
Expand Down Expand Up @@ -171,6 +171,11 @@ set(SOLO_BUILD_DEPS_OPTION_STR "Automatically download and build unmet dependenc
option(SOLO_BUILD_DEPS ${SOLO_BUILD_DEPS_OPTION_STR} ON)
message(STATUS "SOLO_BUILD_DEPS: ${SOLO_BUILD_DEPS}")

# [OPTION] SOLO_USE_IPCL (default: OFF)
set(SOLO_USE_IPCL_OPTION_STR "Use IPCL")
option(SOLO_USE_IPCL ${SOLO_USE_IPCL_OPTION_STR} OFF)
message(STATUS "SOLO_USE_IPCL: ${SOLO_USE_IPCL}")

if(SOLO_BUILD_DEPS)
include(FetchContent)
mark_as_advanced(FETCHCONTENT_BASE_DIR)
Expand All @@ -195,6 +200,19 @@ else()
endif()
endif()

# Intel Paillier Cryptosystem Library
if(SOLO_USE_IPCL)
find_package(IPCL QUIET REQUIRED)
if(IPCL_FOUND)
message(STATUS "IPCL: found")
if (TARGET ipcl AND NOT TARGET IPCL::ipcl)
add_library(IPCL::ipcl ALIAS ipcl)
endif()
else()
message(FATAL_ERROR "IPCL: not found, please download and install manually")
endif()
endif()

# Require Threads::Threads
if(NOT TARGET Threads::Threads)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
Expand Down Expand Up @@ -254,6 +272,9 @@ if(NOT SOLO_BUILD_SHARED_LIBS)
set(SOLO_CARRY_OPENSSL FALSE)
endif()

if(SOLO_USE_IPCL)
target_link_libraries(solo PUBLIC IPCL::ipcl)
endif()
target_link_libraries(solo PUBLIC Threads::Threads)

# Build only a shared library
Expand Down Expand Up @@ -287,6 +308,9 @@ else()
endif()
set(SOLO_CARRY_OPENSSL FALSE)

if(SOLO_USE_IPCL)
target_link_libraries(solo_shared PUBLIC IPCL::ipcl)
endif()
target_link_libraries(solo_shared PUBLIC Threads::Threads)
endif()

Expand Down
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ PETAce-Solo implements or wraps the following primitives that involves only one
- Psuedo-random number generators based on: SHAKE_128, BLAKE2Xb, and AES_ECB_CTR.
- Sampling of bytes, 32-bit unsigned integers, and 64-bit unsigned integers from the uniform distribution.
- Prime field elliptic curve group arithmetics including hash-to-curve.
- Hashing tables: Cuckoo hashing and simple hashing.
- Partially homomorphic encryption: the Paillier cryptosystem.

## Requirements

Expand All @@ -23,6 +25,7 @@ PETAce-Solo implements or wraps the following primitives that involves only one
|--------------------------------------------------------|----------------|------------------------|
| [GoogleTest](https://github.com/google/googletest) | 1.12.1 | For running tests |
| [GoogleBenchmark](https://github.com/google/benchmark) | 1.6.1 | For running benchmarks |
| [Intel Paillier Cryptosystem Library](https://github.com/intel/pailliercryptolib) | 495beaad1f6e70741f2b5cf1279cb919fd66d894 | For partially homomorphic encryption |

## Building PETAce-Solo

Expand All @@ -45,6 +48,16 @@ Output binaries can be found in `build/lib/` and `build/bin/` directories.
| `SOLO_BUILD_EXAMPLE` | ON/OFF | ON | Build C++ example if set to ON. |
| `SOLO_BUILD_TEST` | ON/OFF | ON | Build C++ test if set to ON. |
| `SOLO_BUILD_DEPS` | ON/OFF | ON | Download and build unmet dependencies if set to ON. |
| `SOLO_USE_IPCL` | ON/OFF | OFF | Add PHE and depends on IPCL if set to ON. |

### Adding Partially Homomorphic Encryption

Follow instructions of [Intel Paillier Cryptosystem Library](https://github.com/intel/pailliercryptolib) and install it to `${IPCL_INSTALL_DIR}`.
We recommend the commit `495beaad1f6e70741f2b5cf1279cb919fd66d894` instead of v2.0.0.
Build PETAce-Solo library with extra configuration:
```bash
cmake -S . -B build -DSOLO_USE_IPCL=ON -DIPCL_DIR=${IPCL_INSTALL_DIR}/lib/cmake/ipcl-2.0.0
```

## Contribution

Expand All @@ -62,13 +75,13 @@ This project is licensed under the [Apache-2.0 License](LICENSE).

To cite PETAce in academic papers, please use the following BibTeX entries.

### Version 0.1.0
### Version 0.2.0

```tex
@misc{petace,
title = {PETAce (release 0.1.0)},
title = {PETAce (release 0.2.0)},
howpublished = {\url{https://github.com/tiktok-privacy-innovation/PETAce}},
month = July,
month = Oct,
year = 2023,
note = {TikTok Pte. Ltd.},
key = {PETAce}
Expand Down
8 changes: 4 additions & 4 deletions bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

cmake_minimum_required(VERSION 3.14)

project(SOLOBench VERSION 0.1.0 LANGUAGES CXX)
project(SOLOBench VERSION 0.2.0 LANGUAGES CXX)

# If not called from root CMakeLists.txt
if(NOT DEFINED SOLO_BUILD_BENCH)
set(SOLO_BUILD_BENCH ON)

find_package(PETAce-Solo 0.1.0 EXACT REQUIRED)
find_package(PETAce-Solo 0.2.0 EXACT REQUIRED)

# Must define these variables and include macros
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
Expand Down Expand Up @@ -74,9 +74,9 @@ if(SOLO_BUILD_BENCH)
add_executable(solo_bench ${SOLO_BENCH_FILES})

if(TARGET PETAce-Solo::solo)
target_link_libraries(solo_bench PRIVATE PETAce-Solo::solo benchmark::benchmark)
target_link_libraries(solo_bench PRIVATE PETAce-Solo::solo benchmark::benchmark m)
elseif(TARGET PETAce-Solo::solo_shared)
target_link_libraries(solo_bench PRIVATE PETAce-Solo::solo_shared benchmark::benchmark)
target_link_libraries(solo_bench PRIVATE PETAce-Solo::solo_shared benchmark::benchmark m)
else()
message(FATAL_ERROR "Cannot find target PETAce-Solo::solo or PETAce-Solo::solo_shared")
endif()
Expand Down
3 changes: 3 additions & 0 deletions cmake/PETAce-SoloConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ solo_find_dependency(Threads)
if (NOT SOLO_CARRY_OPENSSL)
solo_find_dependency(OpenSSL)
endif()
if (SOLO_USE_IPCL)
solo_find_dependency(IPCL)
endif()

include(${CMAKE_CURRENT_LIST_DIR}/PETAce-SoloTargets.cmake)

Expand Down
4 changes: 2 additions & 2 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

cmake_minimum_required(VERSION 3.14)

project(SOLOExample VERSION 0.1.0 LANGUAGES CXX)
project(SOLOExample VERSION 0.2.0 LANGUAGES CXX)

# If not called from root CMakeLists.txt
if(NOT DEFINED SOLO_BUILD_EXAMPLE)
set(SOLO_BUILD_EXAMPLE ON)

# Import PETAce-Solo
find_package(PETAce-Solo 0.1.0 EXACT REQUIRED)
find_package(PETAce-Solo 0.2.0 EXACT REQUIRED)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
endif()
Expand Down
21 changes: 21 additions & 0 deletions licenses/LICENSE-HashingTables.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Oleksandr Tkachenko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 6 additions & 0 deletions src/solo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,25 @@

# Source files in this directory
set(SOLO_SOURCE_FILES ${SOLO_SOURCE_FILES}
${CMAKE_CURRENT_LIST_DIR}/ahe_paillier.cpp
${CMAKE_CURRENT_LIST_DIR}/cuckoo_hashing.cpp
${CMAKE_CURRENT_LIST_DIR}/ec_openssl.cpp
${CMAKE_CURRENT_LIST_DIR}/hash.cpp
${CMAKE_CURRENT_LIST_DIR}/prng.cpp
${CMAKE_CURRENT_LIST_DIR}/sampling.cpp
${CMAKE_CURRENT_LIST_DIR}/simple_hashing.cpp
)

# Add header files for installation
install(
FILES
${CMAKE_CURRENT_LIST_DIR}/ahe_paillier.h
${CMAKE_CURRENT_LIST_DIR}/cuckoo_hashing.h
${CMAKE_CURRENT_LIST_DIR}/ec_openssl.h
${CMAKE_CURRENT_LIST_DIR}/hash.h
${CMAKE_CURRENT_LIST_DIR}/prng.h
${CMAKE_CURRENT_LIST_DIR}/sampling.h
${CMAKE_CURRENT_LIST_DIR}/simple_hashing.h
${CMAKE_CURRENT_LIST_DIR}/solo.h
DESTINATION
${SOLO_INCLUDES_INSTALL_DIR}/solo
Expand Down
Loading

0 comments on commit ead22f6

Please sign in to comment.