Skip to content

Commit

Permalink
reorg and cryptoTools update
Browse files Browse the repository at this point in the history
  • Loading branch information
ladnir committed Apr 17, 2020
1 parent 73256d9 commit c7390b5
Show file tree
Hide file tree
Showing 37 changed files with 4,029 additions and 156 deletions.
12 changes: 7 additions & 5 deletions CMakeLists.txt
Expand Up @@ -99,10 +99,11 @@ option(ENABLE_RR17B_PSI "Build the RR17B PSI protocol" OFF)
option(ENABLE_KKRT_PSI "Build the KKRT PSI protocol" OFF)
option(ENABLE_ECDH_PSI "Build the EC DH PSI protocol" OFF)
option(ENABLE_DRRN_PSI "Build the DRRN PSI protocol" OFF)
option(ENABLE_PRTY_PSI "Build the PRTY PSI protocol" OFF)

option(ENABLE_MIRACL "use the miracl library" OFF)
option(ENABLE_RELIC "use the relic library" OFF)
option(ENABLE_SIMPLESTOT "use the simplest OT library" OFF)
option(ENABLE_SIMPLESTOT_ASM "use the simplest OT library" OFF)
option(ENABLE_MR_KYBER "use the kyber OT library" OFF)

message(STATUS "General Options\n=======================================================")
Expand All @@ -119,13 +120,14 @@ message(STATUS "Option: ENABLE_RR17B_PSI = ${ENABLE_RR17B_PSI}")
message(STATUS "Option: ENABLE_KKRT_PSI = ${ENABLE_KKRT_PSI}")
message(STATUS "Option: ENABLE_ECDH_PSI = ${ENABLE_ECDH_PSI}")
message(STATUS "Option: ENABLE_DRRN_PSI = ${ENABLE_DRRN_PSI}\n")
#message(STATUS "Option: ENABLE_PRTY_PSI = ${ENABLE_PRTY_PSI}\n")


message(STATUS "libOTe & cryptoTools options\n=======================================================")
message(STATUS "Option: ENABLE_MIRACL = ${ENABLE_MIRACL}")
message(STATUS "Option: ENABLE_RELIC = ${ENABLE_RELIC}")
message(STATUS "Option: ENABLE_SIMPLESTOT = ${ENABLE_SIMPLESTOT}")
message(STATUS "Option: ENABLE_MR_KYBER = ${ENABLE_MR_KYBER}\n\n")
message(STATUS "Option: ENABLE_MIRACL = ${ENABLE_MIRACL}")
message(STATUS "Option: ENABLE_RELIC = ${ENABLE_RELIC}")
message(STATUS "Option: ENABLE_SIMPLESTOT_ASM = ${ENABLE_SIMPLESTOT_ASM}")
message(STATUS "Option: ENABLE_MR_KYBER = ${ENABLE_MR_KYBER}\n\n")

configure_file(libPSI/config.h.in libPSI/config.h)

Expand Down
Binary file added file.txt
Binary file not shown.
4 changes: 2 additions & 2 deletions frontend/DrrnPSIMain.cpp
@@ -1,8 +1,8 @@
#include "bloomFilterMain.h"
#include "cryptoTools/Network/Endpoint.h"

#include "libPSI/PSI/DrrnPsiClient.h"
#include "libPSI/PSI/DrrnPsiServer.h"
#include "libPSI/PSI/Drrn/DrrnPsiClient.h"
#include "libPSI/PSI/Drrn/DrrnPsiServer.h"

#include <fstream>
using namespace osuCrypto;
Expand Down
4 changes: 2 additions & 2 deletions frontend/OtBinMain.cpp
Expand Up @@ -10,8 +10,8 @@
#include "libPSI/MPSI/Grr18/Grr18MPsiReceiver.h"
#include "libPSI/MPSI/Grr18/Grr18MPsiSender.h"

#include "libPSI/PSI/KkrtPsiReceiver.h"
#include "libPSI/PSI/KkrtPsiSender.h"
#include "libPSI/PSI/Kkrt/KkrtPsiReceiver.h"
#include "libPSI/PSI/Kkrt/KkrtPsiSender.h"

#include <fstream>
using namespace osuCrypto;
Expand Down
27 changes: 19 additions & 8 deletions frontend/dcwMain.cpp
Expand Up @@ -11,8 +11,10 @@


#include "cryptoTools/Common/Defines.h"
#include "libOTe/TwoChooseOne/KosOtExtReceiver.h"
#include "libOTe/TwoChooseOne/KosOtExtSender.h"
#include "libOTe/TwoChooseOne/IknpOtExtReceiver.h"
#include "libOTe/TwoChooseOne/IknpOtExtSender.h"
#include "libOTe/TwoChooseOne/SilentOtExtReceiver.h"
#include "libOTe/TwoChooseOne/SilentOtExtSender.h"

#include "cryptoTools/Common/Log.h"
#include "cryptoTools/Common/Timer.h"
Expand Down Expand Up @@ -49,9 +51,13 @@ void DcwRSend(
for (u64 i = 0; i < setSize; ++i)
set[i] = prng.get<block>();


KosOtExtReceiver otRecv;
KosOtExtSender otSend;
SilentOtExtReceiver sRecv;
SilentOtExtSender sSend;
IknpOtExtReceiver iRecv;
IknpOtExtSender iSend;
bool silent = params.mCmd->isSet("silent");
OtExtReceiver& otRecv = silent ? (OtExtReceiver&)sRecv : iRecv;
OtExtSender& otSend = silent ? (OtExtSender&)sSend : iSend;
DcwRBfPsiSender sendPSIs;

gTimer.reset();
Expand Down Expand Up @@ -91,8 +97,13 @@ void DcwRRecv(
for (u64 i = 0; i < setSize; ++i)
set[i] =prng.get<block>();

KosOtExtReceiver otRecv;
KosOtExtSender otSend;
SilentOtExtReceiver sRecv;
SilentOtExtSender sSend;
IknpOtExtReceiver iRecv;
IknpOtExtSender iSend;
bool silent = params.mCmd->isSet("silent");
OtExtReceiver& otRecv = silent ? (OtExtReceiver&)sRecv : iRecv;
OtExtSender& otSend = silent ? (OtExtSender&)sSend : iSend;
DcwRBfPsiReceiver recvPSIs;


Expand All @@ -101,7 +112,7 @@ void DcwRRecv(
Timer timer;
auto start = timer.setTimePoint("start");

recvPSIs.init(setSize, params.mStatSecParam, otRecv, chls, ZeroBlock);
recvPSIs.init(setSize, params.mStatSecParam, otRecv, chls, sysRandomSeed());

chls[0].recv(dummy, 1);
auto mid = timer.setTimePoint("init");
Expand Down
17 changes: 15 additions & 2 deletions frontend/fileBasedPSI.cpp
Expand Up @@ -5,6 +5,7 @@
#include "cryptoTools/Network/Channel.h"
#include "cryptoTools/Network/Channel.h"
#include "cryptoTools/Crypto/RandomOracle.h"
#include "cryptoTools/Crypto/PRNG.h"
#include <string>
#include <vector>
#include <assert.h>
Expand All @@ -14,8 +15,8 @@
#include "libOTe/NChooseOne/Oos/OosNcoOtReceiver.h"
#include "libOTe/NChooseOne/Oos/OosNcoOtSender.h"

#include "libPSI/PSI/KkrtPsiReceiver.h"
#include "libPSI/PSI/KkrtPsiSender.h"
#include "libPSI/PSI/Kkrt/KkrtPsiReceiver.h"
#include "libPSI/PSI/Kkrt/KkrtPsiSender.h"
#include "libOTe/NChooseOne/Kkrt/KkrtNcoOtReceiver.h"
#include "libOTe/NChooseOne/Kkrt/KkrtNcoOtSender.h"

Expand Down Expand Up @@ -230,6 +231,7 @@ void doFilePSI(const CLP& cmd)

if (cmd.isSet("kkrt"))
{
#if defined(ENABLE_KKRT) && defined(ENABLE_KKRT_PSI)
if (r == Role::Sender)
{
KkrtNcoOtSender ot;
Expand All @@ -246,9 +248,13 @@ void doFilePSI(const CLP& cmd)
recver.sendInput(set, chl);
writeOutput(outPath, ft, recver.mIntersection);
}
#else
throw std::runtime_error("ENABLE_KKRT_PSI not defined.");
#endif
}
else if (cmd.isSet("rr17a"))
{
#if defined(ENABLE_OOS) && defined(ENABLE_RR17_PSI)
padSmallSet(set, theirSize, cmd);

if (r == Role::Sender)
Expand All @@ -268,9 +274,13 @@ void doFilePSI(const CLP& cmd)
recver.sendInput(set, chl);
writeOutput(outPath, ft, recver.mIntersection);
}
#else
throw std::runtime_error("ENABLE_RR17_PSI not defined.");
#endif
}
else if (cmd.isSet("ecdh"))
{
#ifdef ENABLE_ECDH_PSI
padSmallSet(set, theirSize, cmd);

if (r == Role::Sender)
Expand All @@ -286,6 +296,9 @@ void doFilePSI(const CLP& cmd)
recver.sendInput(set, span<Channel>{&chl, 1});
writeOutput(outPath, ft, recver.mIntersection);
}
#else
throw std::runtime_error("ENABLE_ECDH_PSI not defined.");
#endif
}
//else if (cmd.isSet("dkt"))
//{
Expand Down
10 changes: 6 additions & 4 deletions libPSI/CMakeLists.txt
Expand Up @@ -37,7 +37,7 @@ target_link_libraries(libPSI ${libOTe_LIB} ${cryptoTools_LIB})



if(${ENABLE_SIMPLESTOT})
if(${ENABLE_SIMPLESTOT_ASM})

find_library(
SimplestOT_LIB
Expand Down Expand Up @@ -133,11 +133,13 @@ if (ENABLE_RELIC)
if (NOT Relic_FOUND)
message(FATAL_ERROR "Failed to find Relic")
endif (NOT Relic_FOUND)

message(STATUS "Relic_LIB: ${RELIC_LIBRARIES} ${RLC_LIBRARY}")
message(STATUS "Relic_inc: ${RELIC_INCLUDE_DIR} ${RLC_INCLUDE_DIR}\n")

message(STATUS "Relic_LIB: ${RELIC_LIBRARIES}")
target_include_directories(libPSI PUBLIC ${RELIC_INCLUDE_DIR} ${RLC_INCLUDE_DIR})
target_link_libraries(libPSI ${RELIC_LIBRARIES} ${RLC_LIBRARY})

target_include_directories(libPSI PUBLIC ${RELIC_INCLUDE_DIR})
target_link_libraries(libPSI ${RELIC_LIBRARIES})

endif (ENABLE_RELIC)

0 comments on commit c7390b5

Please sign in to comment.