Skip to content

Commit

Permalink
Merge pull request #1 from contact-discovery/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dkales committed Mar 18, 2021
2 parents 540523e + 0ccca0e commit d507397
Show file tree
Hide file tree
Showing 79 changed files with 1,776 additions and 32,664 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
cmake-build-*/
build/
.idea/
.vscode/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "droidCrypto/GSL"]
path = droidCrypto/GSL
url = https://github.com/Microsoft/GSL
[submodule "droidCrypto/relic"]
path = droidCrypto/relic
url = https://github.com/relic-toolkit/relic
15 changes: 4 additions & 11 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
Mobile Contact Discovery Framework
Copyright (C) 2019 Daniel Kales
Copyright (C) 2019-2021 Daniel Kales

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
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:

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
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.
3 changes: 1 addition & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ C++ library implementing several OPRF protocols and using them for Private Set I
* JAVA JNI libaries
* C++ compiler supporting C++14


## Build instructions

```bash
git submodule update --init # pull GSL
git submodule update --init # pull GSL and RELIC
mkdir build && cd build
cmake ..
make -j
Expand Down
31 changes: 27 additions & 4 deletions droidCrypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,26 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_subdirectory(miracl)
add_subdirectory(GSL)

# RELIC configuration
# set RELIC to build Prime EC
set(DOCUM OFF CACHE BOOL "Build RELIC documentation")
set(WITH "BN;DV;FP;EP;MD" CACHE STRING "RELIC features")
set(FP_PRIME "256" CACHE STRING "The prime modulus size in bits.")
set(MULTI "PTHREAD" CACHE STRING "Multithreading API.")
if ("${ANDROID}")
set(OPSYS "DROID" CACHE STRING "Operating system.")
else()
set(OPSYS "LINUX" CACHE STRING "Operating system.")
endif()
set(TESTS "0" CACHE STRING "Build and run tests INTEGER times.")
set(BENCH "0" CACHE STRING "Build and run benchmarks n*n times.")
SET(SHLIB OFF CACHE BOOL "Build Shared Library")
SET(STLIB ON CACHE BOOL "Build Static Library")
add_subdirectory(relic)
# RELIC configuration end

add_subdirectory(keccak)
add_subdirectory(lowmc)
add_subdirectory(psi/cuckoofilter)
Expand All @@ -17,7 +34,7 @@ set(SRCS
AES.cpp
PRNG.cpp
Defines.cpp
Curve.cpp
RCurve.cpp
SHA1.cpp
utils/Utils.cpp
utils/Log.cpp
Expand All @@ -36,7 +53,6 @@ set(SRCS
ot/TwoChooseOne/KosDotExtSender.cpp
ChannelWrapper.cpp
SecureRandom.cpp
utils/graycode.cpp
gc/WireLabel.cpp
gc/HalfGate.cpp
gc/circuits/Circuit.cpp
Expand Down Expand Up @@ -107,18 +123,25 @@ else ()
endif ()

target_include_directories(droidcrypto PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../")
get_target_property(RELIC_INCLUDES relic_s INCLUDE_DIRECTORIES)
target_include_directories(droidcrypto PUBLIC "${RELIC_INCLUDES}")

target_link_libraries(droidcrypto
miracl
SimplestOT
GSL
relic_s
)

if ("${ANDROID}")
target_link_libraries(droidcrypto
android
log
)
# relic brings a -lpthread to the linker which we do not want on android,
# so we create a dummy pthread library to link against
# this is a pretty ugly fix, but it works
add_library(pthread Defines.h)
set_property(TARGET pthread PROPERTY LINKER_LANGUAGE CXX)
else ()
target_include_directories(droidcrypto PUBLIC ${JNI_INCLUDE_DIRS})
target_include_directories(droidcrypto PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/lowmc")
Expand Down
Loading

0 comments on commit d507397

Please sign in to comment.