diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..2720dd52 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,58 @@ +cmake_minimum_required(VERSION 3.10) +project(ABY LANGUAGES CXX) + +option(ABY_BUILD_EXE "Build executables" OFF) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") + +# Set build type to `Release` if non was specified: +# (cf. https://gitlab.kitware.com/cmake/community/wikis/FAQ#how-can-i-change-the-default-build-mode-and-see-it-reflected-in-the-gui) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) +endif(NOT CMAKE_BUILD_TYPE) + +# Write built executables and libraries to bin/ and lib/, respectively. +if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") +endif() +if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") +endif() +if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") +endif() + +find_package(ENCRYPTO_utils QUIET) +if(ENCRYPTO_utils_FOUND) + message(STATUS "Found ENCRYPTO_utils") +elseif(NOT ENCRYPTO_utils_FOUND AND NOT TARGET ENCRYPTO_utils::encrypto_utils) + message("ENCRYPTO_utils was not found: add ENCRYPTO_utils subdirectory") + find_package(Git REQUIRED) + execute_process(COMMAND git submodule update --init extern/ENCRYPTO_utils + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + add_subdirectory(extern/ENCRYPTO_utils) +endif() + +find_package(OTExtension QUIET) +if(OTExtension_FOUND) + message(STATUS "Found OTExtension") +elseif (NOT OTExtension_FOUND AND NOT TARGET OTExtension::otextension) + message("OTExtension was not found: add OTExtension subdirectory") + find_package(Git REQUIRED) + execute_process(COMMAND git submodule update --init extern/OTExtension + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + add_subdirectory(extern/OTExtension) +endif() + +find_package(GMP REQUIRED) +find_package(Threads REQUIRED) + +add_subdirectory(src/abycore) + + +if(ABY_BUILD_EXE) + add_subdirectory(src/test) + add_subdirectory(src/examples) +endif(ABY_BUILD_EXE) diff --git a/Example_Makefile b/Example_Makefile deleted file mode 100644 index 9ade0b6e..00000000 --- a/Example_Makefile +++ /dev/null @@ -1,46 +0,0 @@ -#Makefile for ABY examples -#This file should be included as symlink in subdirectories of src/examples/ - -#DO NOT MODIFY THIS FILE, unless you know what you're doing - -#You should not need to call this makefile separately. It will be called from the Makefile in the root directory - -#relative project folders -BIN = ../../../bin -SRC = ../.. -CORE=${SRC}/abycore - -SOURCES := $(shell find . -type f -name '*.cpp') -OBJECTS := $(patsubst %.cpp, %.o, ${SOURCES}) - -# all source files and corresponding object files in abycore -SOURCES_CORE := $(shell find ${CORE} -type f -name '*.cpp' -not -path '*/ENCRYPTO_utils/Miracl/*' -not -path '*/ot/external/*') -OBJECTS_CORE := $(SOURCES_CORE:.cpp=.o) - -# directory for the Miracl library -MIRACL_LIB_DIR=${CORE}/ENCRYPTO_utils/miracl_lib -OBJECTS_MIRACL=${MIRACL_LIB_DIR}/*.o - -# compiler settings -CC=g++ - -LIBRARIES=-lgmp -lgmpxx -lpthread ${CORE}/ENCRYPTO_utils/miracl_lib/miracl.a -L /usr/lib -lssl -lcrypto -lrt - -#take the current directory's name as name for the executable in ${BIN} -EXAMPLE = $(lastword $(subst /, ,${CURDIR})) - -all: ${BIN}/${EXAMPLE}.exe - -${BIN}/${EXAMPLE}.exe: ${OBJECTS_MIRACL} ${OBJECTS_CORE} ${OBJECTS} - ${CC} ${ABY_COMPILER_OPTIONS} ${CFLAGS} $^ ${LIBRARIES} -o $@ - -%.o: %.cpp %.h - ${CC} $< ${ABY_COMPILER_OPTIONS} -c -o $@ - -%.o: %.cpp - ${CC} $< ${ABY_COMPILER_OPTIONS} -c -o $@ - -.PHONY: clean - -clean: - rm ${OBJECTS} diff --git a/Makefile b/Makefile deleted file mode 100644 index eb111576..00000000 --- a/Makefile +++ /dev/null @@ -1,111 +0,0 @@ -ABY=aby -TEST=test -BIN=bin -SRC=src -CORE=${SRC}/abycore - -# compiler settings -CC=g++ - -#Most aggressive optimizations, asserts are ignored -#ABY_COMPILER_OPTIONS=-O3 -DNDEBUG -#Optimizations -ABY_COMPILER_OPTIONS=-O2 -std=c++14 -march=native -#DEBUG -#ABY_COMPILER_OPTIONS=-g3 -ggdb -O0 -std=c++14 #-fno-omit-frame-pointer -fsanitize=address #-Wall -Wextra -pedantic - -export ABY_COMPILER_OPTIONS - -ARCHITECTURE = $(shell uname -m) -ifeq (${ARCHITECTURE},x86_64) -MIRACL_MAKE:=linux64_cpp -GNU_LIB_PATH:=x86_64 -ARCH_LIB_PATH:=64 -else -MIRACL_MAKE:=linux -GNU_LIB_PATH:=i386 -ARCH_LIB_PATH:=32 -endif - -LIBRARIES=-lgmp -lgmpxx -lpthread ${CORE}/ENCRYPTO_utils/miracl_lib/miracl.a -L /usr/lib -lssl -lcrypto -lrt - -# directory for the Miracl submodule and library -MIRACL_LIB_DIR=${CORE}/ENCRYPTO_utils/miracl_lib -SOURCES_MIRACL=${CORE}/ENCRYPTO_utils/Miracl/* -OBJECTS_MIRACL=${MIRACL_LIB_DIR}/*.o - -OTEXT_DIR=${CORE}/ot -OTEXT_SUB_DIR=${OTEXT_DIR}/external/ot -OT_SUBDIR_FILES=${OTEXT_SUB_DIR}/OTconstants.h ${OTEXT_SUB_DIR}/baseOT.h ${OTEXT_SUB_DIR}/iknp-ot-ext-rec.cpp ${OTEXT_SUB_DIR}/iknp-ot-ext-rec.h ${OTEXT_SUB_DIR}/iknp-ot-ext-snd.cpp ${OTEXT_SUB_DIR}/iknp-ot-ext-snd.h ${OTEXT_SUB_DIR}/naor-pinkas.cpp ${OTEXT_SUB_DIR}/naor-pinkas.h ${OTEXT_SUB_DIR}/ot-ext.cpp ${OTEXT_SUB_DIR}/ot-ext.h ${OTEXT_SUB_DIR}/ot-ext-snd.cpp ${OTEXT_SUB_DIR}/ot-ext-snd.h ${OTEXT_SUB_DIR}/ot-ext-rec.cpp ${OTEXT_SUB_DIR}/ot-ext-rec.h ${OTEXT_SUB_DIR}/xormasking.h ${OTEXT_SUB_DIR}/maskingfunction.h ${OTEXT_SUB_DIR}/kk-ot-ext-snd.h ${OTEXT_SUB_DIR}/kk-ot-ext-snd.cpp ${OTEXT_SUB_DIR}/kk-ot-ext-rec.h ${OTEXT_SUB_DIR}/kk-ot-ext-rec.cpp ${OTEXT_SUB_DIR}/kk-ot-ext.h -OT_FILES=${OTEXT_DIR}/OTconstants.h ${OTEXT_DIR}/baseOT.h ${OTEXT_DIR}/iknp-ot-ext-rec.cpp ${OTEXT_DIR}/iknp-ot-ext-rec.h ${OTEXT_DIR}/iknp-ot-ext-snd.cpp ${OTEXT_DIR}/iknp-ot-ext-snd.h ${OTEXT_DIR}/naor-pinkas.cpp ${OTEXT_DIR}/naor-pinkas.h ${OTEXT_DIR}/ot-ext.cpp ${OTEXT_DIR}/ot-ext.h ${OTEXT_DIR}/ot-ext-snd.cpp ${OTEXT_DIR}/ot-ext-snd.h ${OTEXT_DIR}/ot-ext-rec.cpp ${OTEXT_DIR}/ot-ext-rec.h ${OTEXT_DIR}/xormasking.h ${OTEXT_DIR}/maskingfunction.h ${OTEXT_DIR}/kk-ot-ext-snd.h ${OTEXT_DIR}/kk-ot-ext-snd.cpp ${OTEXT_DIR}/kk-ot-ext-rec.h ${OTEXT_DIR}/kk-ot-ext-rec.cpp ${OTEXT_DIR}/kk-ot-ext.h - -# all source files and corresponding object files in abycore -SOURCES_CORE := $(shell find ${CORE} -type f -name '*.cpp' -not -path '*/ENCRYPTO_utils/miracl_lib/*' -not -path '*/ot/external/*') -#OBJECTS_CORE := $(SOURCES_CORE:.cpp=.o) -OBJECTS_CORE := $(shell find ${CORE} -type f -name '*.o' -not -path '*/ENCRYPTO_utils/miracl_lib/*' -not -path '*/ot/external/*') - - -# objects in example (sub-)folders -OBJECTS_EXAMPLE = $(shell find ${SRC}/examples -type f -name '*.o') - -#objects in test (sub-) folders -OBJECTS_TEST = $(shell find ${SRC}/${TEST} -type f -name '*.o') - -# all sub-directories of ${SRC}/examples with their full path -EXAMPLE_SUBDIRS := $(realpath $(wildcard ${SRC}/examples/*/.)) - -all: miracl otext core examples ${TEST} - @echo "make all done." - -# this will create a copy of the files in src/ENCRYPTO_utils/Miracl and its sub-directories and put them into src/ENCRYPTO_utils/miracl_lib without sub-directories, then compile it -miracl: ${MIRACL_LIB_DIR}/miracl.a - -# copy Miracl files to a new directory (${CORE}/ENCRYPTO_utils/miracl_lib/), call the build script and delete everything except the archive, header and object files. -${MIRACL_LIB_DIR}/miracl.a: ${SOURCES_MIRACL} - @find ${CORE}/ENCRYPTO_utils/Miracl/ -type f -exec cp '{}' ${CORE}/ENCRYPTO_utils/miracl_lib \; - @cd ${CORE}/ENCRYPTO_utils/miracl_lib/; bash ${MIRACL_MAKE}; find . -type f -not -name '*.a' -not -name '*.h' -not -name '*.o' -not -name '.git*'| xargs rm - -# this will create a copy of the files in src/abycore/ot/external/ot/ and put them into src/abycore/ot where they are then used for compiling. -# it does not override files in the ot dir! -otext: miracl - @cp -n ${OT_SUBDIR_FILES} ${OTEXT_DIR} - - -core: miracl otext ${OBJECTS_CORE} - -%.o:%.cpp %.h - ${CC} $< ${ABY_COMPILER_OPTIONS} -c -o $@ - -%.o:%.cpp - ${CC} $< ${ABY_COMPILER_OPTIONS} -c -o $@ - -# check that core is built, then call test makefile -${TEST}: miracl otext core examples - @(cd ${SRC}/${TEST}; if [ -e Makefile ]; then $(MAKE); fi) - -# this will run the previously compiled test-aby executables #TODO: take care of the output and errors -runtest: ${TEST} - sh runtest_scr.sh - -examples: miracl otext core ${EXAMPLE_SUBDIRS} - -# if there is a Makefile for an example, then make it -${EXAMPLE_SUBDIRS}: - @(cd $@; if [ -e Makefile ]; then $(MAKE) -C $@; fi) - -.PHONY: clean cleanall examples ${EXAMPLE_SUBDIRS} all ${TEST} miracl runtest core otext - -# only clean example objects, test object and binaries -clean: - rm -f ${OBJECTS_EXAMPLE} ${OBJECTS_TEST} ${BIN}/*.exe -# clean example objects, test object, aby core objects and binaries -cleanmore: clean - rm -f ${OBJECTS_CORE} - -# clean example objects, test object, aby core objects, binaries and OTExtension -cleanmost: cleanmore - rm -f ${OT_FILES} - -# this will clean everything(!): example objects, test object and binaries and the Miracl library, the copied OT files -cleanall: cleanmore - rm -f ${OBJECTS_MIRACL} ${MIRACL_LIB_DIR}/*.a ${OT_FILES} diff --git a/cmake/ABYConfig.cmake.in b/cmake/ABYConfig.cmake.in new file mode 100644 index 00000000..d0008aa1 --- /dev/null +++ b/cmake/ABYConfig.cmake.in @@ -0,0 +1,15 @@ +get_filename_component(ABY_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + +list(APPEND CMAKE_MODULE_PATH "${ABY_CMAKE_DIR}") + +include(CMakeFindDependencyMacro) + +find_dependency(OTExtension) +find_dependency(ENCRYPTO_utils) +find_dependency(MIRACL) +find_dependency(GMP) +find_dependency(Threads) + +if(NOT TARGET ABY::aby) + include("${ABY_CMAKE_DIR}/ABYTargets.cmake") +endif() diff --git a/cmake/FindGMP.cmake b/cmake/FindGMP.cmake new file mode 100644 index 00000000..b4d9e3ac --- /dev/null +++ b/cmake/FindGMP.cmake @@ -0,0 +1,27 @@ + +find_path(GMP_INCLUDE_DIR gmp.h) + +# TODO: get version + +find_library(GMP_LIBRARY NAMES gmp) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GMP + FOUND_VAR GMP_FOUND + REQUIRED_VARS + GMP_LIBRARY + GMP_INCLUDE_DIR +) + +if(GMP_FOUND AND NOT TARGET GMP::GMP) + add_library(GMP::GMP UNKNOWN IMPORTED) + set_target_properties(GMP::GMP PROPERTIES + IMPORTED_LOCATION "${GMP_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GMP_INCLUDE_DIR}" + ) +endif() + +mark_as_advanced( + GMP_INCLUDE_DIR + GMP_LIBRARY +) diff --git a/cmake/FindGMPXX.cmake b/cmake/FindGMPXX.cmake new file mode 100644 index 00000000..81608ccf --- /dev/null +++ b/cmake/FindGMPXX.cmake @@ -0,0 +1,27 @@ + +find_path(GMPXX_INCLUDE_DIR gmpxx.h) + +# TODO: get version + +find_library(GMPXX_LIBRARY NAMES gmpxx) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GMPXX + FOUND_VAR GMPXX_FOUND + REQUIRED_VARS + GMPXX_LIBRARY + GMPXX_INCLUDE_DIR +) + +if(GMPXX_FOUND AND NOT TARGET GMP::GMPXX) + add_library(GMP::GMPXX UNKNOWN IMPORTED) + set_target_properties(GMP::GMPXX PROPERTIES + IMPORTED_LOCATION "${GMPXX_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GMPXX_INCLUDE_DIR}" + ) +endif() + +mark_as_advanced( + GMPXX_INCLUDE_DIR + GMPXX_LIBRARY +) diff --git a/runtest_scr.sh b/runtest_scr.sh index 01a74faa..6a4ef46e 100644 --- a/runtest_scr.sh +++ b/runtest_scr.sh @@ -8,7 +8,7 @@ exitfn () { trap "exitfn" INT # Set up SIGINT trap to call function. -./bin/test-aby.exe -r 0 -R & +./bin/abytest -r 0 -R & CLIENT_PID=$! -./bin/test-aby.exe -r 1 -R +./bin/abytest -r 1 -R diff --git a/src/abycore/CMakeLists.txt b/src/abycore/CMakeLists.txt new file mode 100644 index 00000000..4ae52dca --- /dev/null +++ b/src/abycore/CMakeLists.txt @@ -0,0 +1,66 @@ +add_library(aby + aby/abyparty.cpp + aby/abysetup.cpp + circuit/abycircuit.cpp + circuit/arithmeticcircuits.cpp + circuit/booleancircuits.cpp + circuit/circuit.cpp + circuit/share.cpp + DGK/dgkparty.cpp + DJN/djnparty.cpp + sharing/arithsharing.cpp + sharing/boolsharing.cpp + sharing/sharing.cpp + sharing/splut.cpp + sharing/yaoclientsharing.cpp + sharing/yaoserversharing.cpp + sharing/yaosharing.cpp +) +add_library(ABY::aby ALIAS aby) + +target_compile_features(aby PUBLIC cxx_std_17) +target_compile_options(aby PRIVATE "-Wall" "-Wextra" "-Weffc++") + +target_include_directories(aby + PUBLIC + $ + $ +) + + +target_link_libraries(aby + PUBLIC OTExtension::otextension + PUBLIC ENCRYPTO_utils::encrypto_utils + PUBLIC GMP::GMP + PUBLIC Threads::Threads +) + + +install(TARGETS aby + EXPORT "${PROJECT_NAME}Targets" + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + INCLUDES DESTINATION lib +) +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + DESTINATION include + FILES_MATCHING PATTERN "*.h" +) + +export(TARGETS aby NAMESPACE "${PROJECT_NAME}::" FILE "${PROJECT_NAME}Targets.cmake") +install(EXPORT "${PROJECT_NAME}Targets" + NAMESPACE "${PROJECT_NAME}::" + DESTINATION "lib/cmake/${PROJECT_NAME}" +) + +include(CMakePackageConfigHelpers) + +configure_package_config_file("${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake + INSTALL_DESTINATION "lib/cmake/${PROJECT_NAME}" +) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + DESTINATION "lib/cmake/${PROJECT_NAME}" +) diff --git a/src/abycore/aby/abysetup.h b/src/abycore/aby/abysetup.h index a6825afa..8c5285a5 100644 --- a/src/abycore/aby/abysetup.h +++ b/src/abycore/aby/abysetup.h @@ -22,14 +22,14 @@ #include #include #include "../ABY_utils/ABYconstants.h" -#include "../ot/naor-pinkas.h" -#include "../ot/ot-ext.h" -#include "../ot/xormasking.h" +#include +#include +#include #include "../ot/arithmtmasking.h" -#include "../ot/iknp-ot-ext-snd.h" -#include "../ot/iknp-ot-ext-rec.h" -#include "../ot/kk-ot-ext-snd.h" -#include "../ot/kk-ot-ext-rec.h" +#include +#include +#include +#include #include "../DJN/djnparty.h" #include "../DGK/dgkparty.h" #include diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt new file mode 100644 index 00000000..fb9fc83e --- /dev/null +++ b/src/examples/CMakeLists.txt @@ -0,0 +1,12 @@ +add_subdirectory(aes) +add_subdirectory(bench_operations) +add_subdirectory(euclidean_distance) +add_subdirectory(float) +add_subdirectory(innerproduct) +add_subdirectory(lowmc) +add_subdirectory(millionaire_prob) +add_subdirectory(min-euclidean-dist) +add_subdirectory(psi_phasing) +add_subdirectory(psi_scs) +add_subdirectory(sha1) +add_subdirectory(threshold_euclidean_dist_2d_simd) diff --git a/src/examples/aes/CMakeLists.txt b/src/examples/aes/CMakeLists.txt new file mode 100644 index 00000000..108a776b --- /dev/null +++ b/src/examples/aes/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_executable(aes_test aes_test.cpp common/aescircuit.cpp) +target_link_libraries(aes_test ABY::aby ENCRYPTO_utils::encrypto_utils) diff --git a/src/examples/aes/Makefile b/src/examples/aes/Makefile deleted file mode 120000 index 4fec8645..00000000 --- a/src/examples/aes/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../../Example_Makefile \ No newline at end of file diff --git a/src/examples/bench_operations/CMakeLists.txt b/src/examples/bench_operations/CMakeLists.txt new file mode 100644 index 00000000..2ffe86a2 --- /dev/null +++ b/src/examples/bench_operations/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_executable(bench_operations bench_operations.cpp ../aes/common/aescircuit.cpp) +target_link_libraries(bench_operations ABY::aby ENCRYPTO_utils::encrypto_utils) diff --git a/src/examples/bench_operations/Makefile b/src/examples/bench_operations/Makefile deleted file mode 100644 index 0e3f091b..00000000 --- a/src/examples/bench_operations/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -#Special Makefile for bench_operations. *Not* a symlink to ../../Example_Makefile ! - -#DO NOT MODIFY THIS FILE, unless you know what you're doing - -#You should not need to call this makefile separately. It will be called from the Makefile in the root directory - -#relative project folders -BIN = ../../../bin -SRC = ../.. -CORE=${SRC}/abycore -AES = ../aes/common - -SOURCES := $(shell find . -type f -name '*.cpp') -OBJECTS := $(patsubst %.cpp, %.o, ${SOURCES}) - -# all source files and corresponding object files in abycore -SOURCES_CORE := $(shell find ${CORE} -type f -name '*.cpp' -not -path '*/ENCRYPTO_utils/Miracl/*' -not -path '*/ot/external/*') -OBJECTS_CORE := $(SOURCES_CORE:.cpp=.o) - -SOURCES_AES := $(shell find ${AES} -type f -name '*.cpp') -OBJECTS_AES := $(SOURCES_AES:.cpp=.o) - -# directory for the Miracl library -MIRACL_LIB_DIR=${CORE}/ENCRYPTO_utils/miracl_lib -OBJECTS_MIRACL=${MIRACL_LIB_DIR}/*.o - -# compiler settings -CC=g++ - -BATCH= -ARCHITECTURE = $(shell uname -m) -ifeq (${ARCHITECTURE},x86_64) -GNU_LIB_PATH:=x86_64 -ARCH_LIB_PATH:=64 -else -GNU_LIB_PATH:=i386 -ARCH_LIB_PATH:=32 -endif - -#Include for Arch, Manjaro and the like -#INCLUDE=-I.. -I/usr/include/glib-2.0/ -I/usr/lib${ARCH_LIB_PATH}/glib-2.0/include - -#Include for Debian, Ubuntu, Mint and the like -#INCLUDE=-I.. -I/usr/include/glib-2.0/ -I/usr/lib/${GNU_LIB_PATH}-linux-gnu/glib-2.0/include - -CFLAGS= -LIBRARIES=-lgmp -lgmpxx -lpthread ${CORE}/ENCRYPTO_utils/miracl_lib/miracl.a -L /usr/lib -lssl -lcrypto -lrt - -#take the current directory's name as name for the executable in ${BIN} -EXAMPLE = $(lastword $(subst /, ,${CURDIR})) - -all: ${BIN}/${EXAMPLE}.exe - -${BIN}/${EXAMPLE}.exe: ${OBJECTS} ${OBJECTS_CORE} ${OBJECTS_MIRACL} ${OBJECTS_AES} - ${CC} ${ABY_COMPILER_OPTIONS} ${CFLAGS} $^ ${LIBRARIES} -o $@ - -%.o: %.cpp - ${CC} $< ${ABY_COMPILER_OPTIONS} -c ${INCLUDE} ${CFLAGS} ${BATCH} -o $@ - -.PHONY: clean - -clean: - rm ${OBJECTS} diff --git a/src/examples/euclidean_distance/CMakeLists.txt b/src/examples/euclidean_distance/CMakeLists.txt new file mode 100644 index 00000000..4017bf13 --- /dev/null +++ b/src/examples/euclidean_distance/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_executable(euclidean_distance_test euclidean_distance_test.cpp common/euclidean_dist.cpp) +target_link_libraries(euclidean_distance_test ABY::aby ENCRYPTO_utils::encrypto_utils) diff --git a/src/examples/euclidean_distance/Makefile b/src/examples/euclidean_distance/Makefile deleted file mode 120000 index 4fec8645..00000000 --- a/src/examples/euclidean_distance/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../../Example_Makefile \ No newline at end of file diff --git a/src/examples/float/CMakeLists.txt b/src/examples/float/CMakeLists.txt new file mode 100644 index 00000000..3e77e109 --- /dev/null +++ b/src/examples/float/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_executable(abyfloat_test abyfloat.cpp) +target_link_libraries(abyfloat_test ABY::aby ENCRYPTO_utils::encrypto_utils) diff --git a/src/examples/float/Makefile b/src/examples/float/Makefile deleted file mode 120000 index 4fec8645..00000000 --- a/src/examples/float/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../../Example_Makefile \ No newline at end of file diff --git a/src/examples/innerproduct/CMakeLists.txt b/src/examples/innerproduct/CMakeLists.txt new file mode 100644 index 00000000..be90b660 --- /dev/null +++ b/src/examples/innerproduct/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_executable(innerproduct_test innerproduct_test.cpp common/innerproduct.cpp) +target_link_libraries(innerproduct_test ABY::aby ENCRYPTO_utils::encrypto_utils) diff --git a/src/examples/innerproduct/Makefile b/src/examples/innerproduct/Makefile deleted file mode 120000 index 4fec8645..00000000 --- a/src/examples/innerproduct/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../../Example_Makefile \ No newline at end of file diff --git a/src/examples/lowmc/CMakeLists.txt b/src/examples/lowmc/CMakeLists.txt new file mode 100644 index 00000000..99480359 --- /dev/null +++ b/src/examples/lowmc/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_executable(lowmc_test lowmc.cpp common/lowmccircuit.cpp) +target_link_libraries(lowmc_test ABY::aby ENCRYPTO_utils::encrypto_utils) diff --git a/src/examples/lowmc/Makefile b/src/examples/lowmc/Makefile deleted file mode 120000 index 4fec8645..00000000 --- a/src/examples/lowmc/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../../Example_Makefile \ No newline at end of file diff --git a/src/examples/millionaire_prob/CMakeLists.txt b/src/examples/millionaire_prob/CMakeLists.txt new file mode 100644 index 00000000..a9aca991 --- /dev/null +++ b/src/examples/millionaire_prob/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_executable(millionaire_prob_test millionaire_prob_test.cpp common/millionaire_prob.cpp) +target_link_libraries(millionaire_prob_test ABY::aby ENCRYPTO_utils::encrypto_utils) diff --git a/src/examples/millionaire_prob/Makefile b/src/examples/millionaire_prob/Makefile deleted file mode 120000 index 4fec8645..00000000 --- a/src/examples/millionaire_prob/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../../Example_Makefile \ No newline at end of file diff --git a/src/examples/min-euclidean-dist/CMakeLists.txt b/src/examples/min-euclidean-dist/CMakeLists.txt new file mode 100644 index 00000000..0b51bf32 --- /dev/null +++ b/src/examples/min-euclidean-dist/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_executable(min-euclidean-dist_test min-euclidean-dist.cpp common/min-euclidean-dist-circuit.cpp) +target_link_libraries(min-euclidean-dist_test ABY::aby ENCRYPTO_utils::encrypto_utils) diff --git a/src/examples/min-euclidean-dist/Makefile b/src/examples/min-euclidean-dist/Makefile deleted file mode 120000 index 4fec8645..00000000 --- a/src/examples/min-euclidean-dist/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../../Example_Makefile \ No newline at end of file diff --git a/src/examples/psi_phasing/CMakeLists.txt b/src/examples/psi_phasing/CMakeLists.txt new file mode 100644 index 00000000..142743b6 --- /dev/null +++ b/src/examples/psi_phasing/CMakeLists.txt @@ -0,0 +1,4 @@ + +add_executable(psi_phasing_test psi_phasing.cpp common/phasing_circuit.cpp + common/hashing/cuckoo.cpp common/hashing/simple_hashing.cpp) +target_link_libraries(psi_phasing_test ABY::aby ENCRYPTO_utils::encrypto_utils) diff --git a/src/examples/psi_phasing/Makefile b/src/examples/psi_phasing/Makefile deleted file mode 120000 index 4fec8645..00000000 --- a/src/examples/psi_phasing/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../../Example_Makefile \ No newline at end of file diff --git a/src/examples/psi_scs/CMakeLists.txt b/src/examples/psi_scs/CMakeLists.txt new file mode 100644 index 00000000..4e68c58d --- /dev/null +++ b/src/examples/psi_scs/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_executable(psi_scs_test psi_scs.cpp common/sort_compare_shuffle.cpp common/WaksmanPermutation.cpp) +target_link_libraries(psi_scs_test ABY::aby ENCRYPTO_utils::encrypto_utils) diff --git a/src/examples/psi_scs/Makefile b/src/examples/psi_scs/Makefile deleted file mode 120000 index 4fec8645..00000000 --- a/src/examples/psi_scs/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../../Example_Makefile \ No newline at end of file diff --git a/src/examples/sha1/CMakeLists.txt b/src/examples/sha1/CMakeLists.txt new file mode 100644 index 00000000..dda66353 --- /dev/null +++ b/src/examples/sha1/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_executable(sha1_test sha1_test.cpp common/sha1_circuit.cpp) +target_link_libraries(sha1_test ABY::aby ENCRYPTO_utils::encrypto_utils) diff --git a/src/examples/sha1/Makefile b/src/examples/sha1/Makefile deleted file mode 120000 index 4fec8645..00000000 --- a/src/examples/sha1/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../../Example_Makefile \ No newline at end of file diff --git a/src/examples/threshold_euclidean_dist_2d_simd/CMakeLists.txt b/src/examples/threshold_euclidean_dist_2d_simd/CMakeLists.txt new file mode 100644 index 00000000..2dfef1df --- /dev/null +++ b/src/examples/threshold_euclidean_dist_2d_simd/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_executable(threshold-euclidean-dist_test threshold-euclidean-dist.cpp common/threshold-euclidean-dist.cpp) +target_link_libraries(threshold-euclidean-dist_test ABY::aby ENCRYPTO_utils::encrypto_utils) diff --git a/src/examples/threshold_euclidean_dist_2d_simd/Makefile b/src/examples/threshold_euclidean_dist_2d_simd/Makefile deleted file mode 120000 index 4fec8645..00000000 --- a/src/examples/threshold_euclidean_dist_2d_simd/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../../Example_Makefile \ No newline at end of file diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt new file mode 100644 index 00000000..f1ebdfda --- /dev/null +++ b/src/test/CMakeLists.txt @@ -0,0 +1,12 @@ + +add_executable(abytest + abytest.cpp + ../examples/aes/common/aescircuit.cpp + ../examples/sha1/common/sha1_circuit.cpp + ../examples/psi_scs/common/sort_compare_shuffle.cpp + ../examples/psi_scs/common/WaksmanPermutation.cpp + ../examples/psi_phasing/common/phasing_circuit.cpp + ../examples/psi_phasing/common/hashing/simple_hashing.cpp + ../examples/psi_phasing/common/hashing/cuckoo.cpp +) +target_link_libraries(abytest ABY::aby ENCRYPTO_utils::encrypto_utils) diff --git a/src/test/Makefile b/src/test/Makefile deleted file mode 100644 index fadb0e6b..00000000 --- a/src/test/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -#Makefile for ABY tests - -#DO NOT MODIFY THIS FILE, unless you know what you're doing - -#You should not need to call this makefile separately. It will me called from the Makefile in the root directory - -#relative project folders -BIN = ../../bin -SRC = .. -CORE=${SRC}/abycore - -SOURCES := $(shell find . -type f -name '*.cpp') -OBJECTS := $(patsubst %.cpp, %.o, ${SOURCES}) - -# object files for the test cases -OBJECTS_MILLIONAIRE_CIRC=${SRC}/examples/millionaire_prob/common/millionaire_prob.o -OBJECTS_AES_CIRC=${SRC}/examples/aes/common/aescircuit.o -OBJECTS_SHA1_CIRC=${SRC}/examples/sha1/common/sha1_circuit.o -OBJECTS_PSI_CIRC=${SRC}/examples/psi_scs/common/*.o -OBJECTS_PHASING_CIRC=${SRC}/examples/psi_phasing/common/*.o -OBJECTS_HASHING_CIRC=${SRC}/examples/psi_phasing/common/hashing/*.o -OBJECTS_LOWMC_CIRC=${SRC}/examples/lowmc/common/lowmccircuit.o - -# directory for the Miracl library -MIRACL_LIB_DIR=${CORE}/ENCRYPTO_utils/miracl_lib -OBJECTS_MIRACL=${MIRACL_LIB_DIR}/*.o - -# all source files and corresponding object files in abycore -SOURCES_CORE := $(shell find ${CORE} -type f -name '*.cpp' -not -path '*/ENCRYPTO_utils/Miracl/*' -not -path '*/ot/external/*') -OBJECTS_CORE := $(SOURCES_CORE:.cpp=.o) - -# compiler settings -CC=g++ - -BATCH= - -CFLAGS= -LIBRARIES=-lgmp -lgmpxx -lpthread ${CORE}/ENCRYPTO_utils/miracl_lib/miracl.a -L /usr/lib -lssl -lcrypto -lrt - -#name fixed to test-aby -EXAMPLE = test-aby - - -all: ${BIN}/${EXAMPLE}.exe - -${BIN}/${EXAMPLE}.exe: ${OBJECTS_CORE} ${OBJECTS} ${OBJECTS_MILLIONAIRE_CIRC} ${OBJECTS_AES_CIRC} ${OBJECTS_SHA1_CIRC} ${OBJECTS_LOWMC_CIRC} ${OBJECTS_PSI_CIRC} ${OBJECTS_PHASING_CIRC} ${OBJECTS_HASHING_CIRC} ${OBJECTS_MIRACL} - ${CC} ${ABY_COMPILER_OPTIONS} -o $@ ${CFLAGS} $^ ${LIBRARIES} - - -%.o: %.cpp - ${CC} $^ ${ABY_COMPILER_OPTIONS} -c ${INCLUDE} ${CFLAGS} ${BATCH} -o $@ - -.PHONY: clean - -clean: - rm ${OBJECTS}