-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCONFIG
More file actions
157 lines (131 loc) · 3.86 KB
/
CONFIG
File metadata and controls
157 lines (131 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
ROOT = .
# compile for web usage
WEB = 1
USE_WASM32 = 0
DEBUGGING = 0# set to 1 to enable less optimizations and more debugging information
SINGLE_THREADED_WEBSOCKET = 0# set to 1 to use Websockets only on main thread for communication
OPTIM= -O3
#PROF = -pg
#DEBUG = -DDEBUG
#GDEBUG = -g
# set this to your preferred local storage directory
PREP_DIR = '-DPREP_DIR="Player-Data/"'
# directory to store SSL keys
SSL_DIR = '-DSSL_DIR="Player-Data/"'
# set for SHE preprocessing (SPDZ and Overdrive)
USE_NTL = 0
# set for using GF(2^128)
# unset for GF(2^40)
USE_GF2N_LONG = 1
# set to -march=<architecture> for optimization
# SSE4.2 is required homomorphic encryption in GF(2^n) when compiling with clang
# AES-NI and PCLMUL are not required
# AVX is required for oblivious transfer (OT)
# AVX2 support (Haswell or later) is used to optimize OT
# AVX/AVX2 is required for replicated binary secret sharing
# BMI2 is used to optimize multiplication modulo a prime
# ADX is used to optimize big integer additions
# delete the second line to compile for a platform that supports everything
ifeq ($(WEB), 1)
ARCH = -msse -msse2 -msse4.1 -msse4.2 -mavx -msimd128
else
ARCH = -mtune=native -msse4.1 -msse4.2 -maes -mpclmul -mavx -mavx2 -mbmi2 -madx
endif
MACHINE := $(shell uname -m)
ARM := $(shell uname -m | grep x86; echo $$?)
OS := $(shell uname -s)
ifeq ($(MACHINE), x86_64)
ifeq ($(OS), Linux)
ifeq ($(shell cat /proc/cpuinfo | grep -q avx2; echo $$?), 0)
AVX_OT = 1
else
AVX_OT = 0
endif
else
AVX_OT = 0
endif
else
ARCH =
AVX_OT = 0
endif
ifeq ($(OS), Darwin)
BREW_CFLAGS += -I/usr/local/opt/openssl/include -I`brew --prefix`/opt/openssl/include -I`brew --prefix`/include
BREW_LDLIBS += -L/usr/local/opt/openssl/lib -L`brew --prefix`/lib -L`brew --prefix`/opt/openssl/lib
endif
ifeq ($(OS), Linux)
ifeq ($(ARM), 1)
ifeq ($(shell cat /proc/cpuinfo | grep -q aes; echo $$?), 0)
ARCH = -march=armv8.2-a+crypto
endif
endif
endif
# settings for web compatability
USE_KOS = 1
AVX_OT = 0
# allow to set compiler in CONFIG.mine
ifeq ($(WEB), 1)
CXX = emcc
else
CXX = clang++
endif
# use CONFIG.mine to overwrite DIR settings
-include CONFIG.mine
ifeq ($(USE_GF2N_LONG),1)
GF2N_LONG = -DUSE_GF2N_LONG
endif
ifeq ($(AVX_OT), 0)
CFLAGS += -DNO_AVX_OT
endif
# MAX_MOD_SZ (for FHE) must be least and GFP_MOD_SZ (for computation)
# must be exactly ceil(len(p)/len(word)) for the relevant prime p
# GFP_MOD_SZ only needs to be set for primes of bit length more that 256.
# Default for MAX_MOD_SZ is 10, which suffices for all Overdrive protocols
# MOD = -DMAX_MOD_SZ=10 -DGFP_MOD_SZ=5
LDLIBS = -lgmpxx -lgmp -lsodium $(MY_LDLIBS) -lssl -lcrypto
ifeq ($(WEB), 1)
LDLIBS += -lwebsocket.js -ldatachannel-wasm
ifeq ($(USE_WASM32), 1)
LDLIBS += -I $(CURDIR)/local/wasm32/lib -L $(CURDIR)/local/wasm32/lib
CFLAGS += -I./local/wasm32/include
else
LDLIBS += -I $(CURDIR)/local/wasm64/lib -L $(CURDIR)/local/wasm64/lib
CFLAGS += -I./local/wasm64/include -sMEMORY64
LDFLAGS += -sMEMORY64
endif
else
LDLIBS += $(BREW_LDLIBS)
LDLIBS += -Wl,-rpath -Wl,$(CURDIR)/local/lib -L$(CURDIR)/local/lib
LDLIBS += -lboost_system -lboost_filesystem -lboost_iostreams
CFLAGS += -I./local/include
endif
ifeq ($(USE_NTL),1)
CFLAGS += -DUSE_NTL
LDLIBS := -lntl $(LDLIBS)
endif
ifeq ($(OS), Linux)
LDLIBS += -lrt
endif
ifeq ($(OS), Darwin)
BOOST = -lboost_thread-mt $(MY_BOOST)
else
BOOST = -lboost_thread $(MY_BOOST)
endif
ifeq ($(WEB), 1)
CFLAGS += -sUSE_BOOST_HEADERS
endif
CFLAGS += $(ARCH) $(MY_CFLAGS) $(GDEBUG) -Wextra -Wall $(OPTIM) -I$(ROOT) -I$(ROOT)/deps -pthread $(PROF) $(DEBUG) $(MOD) $(GF2N_LONG) $(PREP_DIR) $(SSL_DIR) $(SECURE)
CFLAGS += $(BREW_CFLAGS)
CPPFLAGS = $(CFLAGS)
LD = $(CXX)
ifeq ($(OS), Darwin)
# for boost with OpenSSL 3
CFLAGS += -Wno-error=deprecated-declarations
ifeq ($(USE_NTL),1)
CFLAGS += -Wno-error=unused-parameter -Wno-error=deprecated-copy
endif
endif
ifeq ($(USE_KOS),1)
CFLAGS += -DUSE_KOS
else
CFLAGS += -std=c++17
endif