未验证 提交 9c75c147 编写于 作者: PhoenixTree2013's avatar PhoenixTree2013 提交者: GitHub

PSI kkrt16 enabled on macos (#576)

* upgrage relic to 0.6.0
* enable kkrt16  on macos
上级 dd735d73
......@@ -11,6 +11,15 @@ filegroup(
)
"""
http_archive(
name = "platforms",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz",
],
sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca",
)
http_archive(
name = "rules_foreign_cc",
sha256 = "484fc0e14856b9f7434072bc2662488b3fe84d7798a5b7c92a1feb1a0fa8d088",
......@@ -466,12 +475,13 @@ new_git_repository(
# shallow_since = "1591047380 -0700",
)
new_git_repository(
name = "toolkit_relic",
build_file = "//bazel:BUILD.relic",
remote = "https://gitee.com/orzmzp/relic.git",
commit = "3f616ad64c3e63039277b8c90915607b6a2c504c",
shallow_since = "1581106153 -0800",
remote = "https://gitee.com/primihub/relic.git",
# tag 0.6.0
commit = "d7dcb22846e32172bb94111823bd3358ec9a49aa",
)
http_archive(
......
......@@ -12,6 +12,14 @@ filegroup(
)
"""
http_archive(
name = "platforms",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz",
],
sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca",
)
http_archive(
name = "rules_foreign_cc",
......@@ -485,9 +493,9 @@ new_git_repository(
new_git_repository(
name = "toolkit_relic",
build_file = "//bazel:BUILD.relic",
remote = "https://github.com/relic-toolkit/relic.git",
commit = "3f616ad64c3e63039277b8c90915607b6a2c504c",
shallow_since = "1581106153 -0800",
remote = "https://github.com/primihub/relic.git",
# tag 0.6.0
commit = "d7dcb22846e32172bb94111823bd3358ec9a49aa",
)
http_archive(
......
......@@ -6,11 +6,31 @@ filegroup(
visibility = ["//visibility:public"]
)
cmake(
name = "relic",
cache_entries = {
cache_entries = select({
"@platforms//cpu:aarch64": {
"CMAKE_INSTALL_LIBDIR": "lib",
"WSIZE": "64",
},
"@platforms//cpu:x86_64": {
"CMAKE_INSTALL_LIBDIR": "lib",
"WSIZE": "64",
},
"@platforms//cpu:i386": {
"CMAKE_INSTALL_LIBDIR": "lib",
"WSIZE": "32",
},
"@platforms//cpu:arm": {
"CMAKE_INSTALL_LIBDIR": "lib",
"WSIZE": "32",
},
"//conditions:default": {
"CMAKE_INSTALL_LIBDIR": "lib",
"WSIZE": "32",
},
}),
build_args = [
"-j4",
],
......@@ -21,7 +41,7 @@ cmake(
lib_source = ":src",
#out_include_dir = "include/relic",
out_static_libs = ["librelic_s.a"],
postfix_script = "[ \"$OSTYPE\" == \"linux-gnu\" ] && objcopy --localize-symbol=bn_init $INSTALLDIR/lib/librelic_s.a",
#postfix_script = "[ \"$OSTYPE\" == \"linux-gnu\" ] && objcopy --localize-symbol=bn_init $INSTALLDIR/lib/librelic_s.a",
#postfix_script = "objcopy --localize-symbol=bn_init $INSTALLDIR/lib/librelic_s.a",
visibility = ["//visibility:public"],
)
......@@ -1157,19 +1157,13 @@ void MPCExpressExecutor<Dbit>::runMPCDivFP64(TokenValue &val1, TokenValue &val2,
}
sf64Matrix<Dbit> *sh_res = new sf64Matrix<Dbit>(val_count, 1);
if (val1.type != 2 && val2.type != 2) {
LOG(ERROR) << "begin mpc_op_->MPC_Div";
*sh_res = mpc_op_->MPC_Div(*p_sh_val1, *p_sh_val2);
LOG(ERROR) << "end mpc_op_->MPC_Div";
} else {
if (val1.type == 2) {
LOG(ERROR) << "type == 2 begin mpc_op_->MPC_Div";
*sh_res = mpc_op_->MPC_Div(*p_sh_val1, *p_sh_val2);
LOG(ERROR) << "end type == 2 begin mpc_op_->MPC_Div";
} else {
LOG(ERROR) << "type != 2 begin mpc_op_->MPC_Div";
constfixed = 1.0 / static_cast<double>(constfixed);
*sh_res = mpc_op_->MPC_Mul_Const(constfixed, *p_sh_val1);
LOG(ERROR) << "end type != 2 begin mpc_op_->MPC_Div";
}
}
createTokenValue(sh_res, res);
......
......@@ -134,18 +134,9 @@ cc_library(
":psi_task_util",
"//src/primihub/util:endian_util",
"//src/primihub/protos:worker_proto",
] + select({
":aarch64": [
"@osu_libpsi//:libpsi",
"//src/primihub/util/network:message_exchange_interface",
],
":x86_64": [
"@osu_libpsi//:libpsi",
"//src/primihub/util/network:message_exchange_interface",
],
":darwin_x86_64": [],
"//conditions:default": [],
})
]
)
cc_library(
......
......@@ -19,7 +19,6 @@
#include <utility>
#include <map>
#if defined(__linux__)
#include "cryptoTools/Network/IOService.h"
#include "cryptoTools/Network/Endpoint.h"
#include "cryptoTools/Network/SocketAdapter.h"
......@@ -35,7 +34,6 @@
#include "libOTe/NChooseOne/Kkrt/KkrtNcoOtReceiver.h"
#include "libOTe/NChooseOne/Kkrt/KkrtNcoOtSender.h"
#include "libOTe/NChooseOne/NcoOtExt.h"
#endif
#include "src/primihub/task/semantic/psi_kkrt_task.h"
#include "src/primihub/data_store/factory.h"
......@@ -44,9 +42,7 @@
#include "src/primihub/util/endian_util.h"
#include "src/primihub/common/value_check_util.h"
#if defined(__linux__)
using primihub::network::TaskMessagePassInterface;
#endif
using arrow::Table;
using arrow::StringArray;
......@@ -171,7 +167,6 @@ retcode PSIKkrtTask::_LoadDataset(void) {
return retcode::SUCCESS;
}
#if defined(__linux__)
void PSIKkrtTask::_kkrtRecv(osuCrypto::Channel& chl) {
u8 dummy[1];
// osuCrypto::PRNG prng(_mm_set_epi32(4253465, 3434565, 234435, 23987045));
......@@ -290,11 +285,9 @@ retcode PSIKkrtTask::_GetIntsection(osuCrypto::KkrtPsiReceiver &receiver) {
}
return retcode::SUCCESS;
}
#endif
retcode PSIKkrtTask::broadcastResultToServer() {
retcode ret{retcode::SUCCESS};
#if defined(__linux__)
VLOG(5) << "broadcast_result_to_server";
std::string result_str;
size_t total_size{0};
......@@ -311,7 +304,6 @@ retcode PSIKkrtTask::broadcastResultToServer() {
}
ret = this->send(this->key, peer_node, result_str);
VLOG(5) << "send result to server success";
#endif
return ret;
}
......@@ -352,7 +344,6 @@ int PSIKkrtTask::execute() {
auto load_dataset_ts = timer.timeElapse();
auto load_dataset_time_cost = load_dataset_ts - load_params_ts;
VLOG(5) << "LoadDataset time cost(ms): " << load_dataset_time_cost;
#if defined(__linux__)
osuCrypto::IOService ios;
auto mode = role_tag_ ? osuCrypto::EpMode::Server : osuCrypto::EpMode::Client;
auto& link_ctx = this->getTaskContext().getLinkContext();
......@@ -417,7 +408,6 @@ int PSIKkrtTask::execute() {
recvIntersectionData();
}
}
#endif
return 0;
}
......
......@@ -17,11 +17,9 @@
#ifndef SRC_PRIMIHUB_TASK_SEMANTIC_PSI_KKRT_TASK_H_
#define SRC_PRIMIHUB_TASK_SEMANTIC_PSI_KKRT_TASK_H_
#if defined(__linux__)
#include "cryptoTools/Network/Channel.h"
#include "cryptoTools/Common/Defines.h"
#include "libPSI/PSI/Kkrt/KkrtPsiReceiver.h"
#endif
#include <vector>
#include <map>
......@@ -53,11 +51,9 @@ class PSIKkrtTask : public TaskBase, public PsiCommonOperator {
private:
retcode _LoadParams(rpc::Task &task);
retcode _LoadDataset();
#if defined(__linux__)
void _kkrtRecv(osuCrypto::Channel& chl);
void _kkrtSend(osuCrypto::Channel& chl);
retcode _GetIntsection(osuCrypto::KkrtPsiReceiver &receiver);
#endif
private:
std::vector<int> data_index_;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册