forked from JHUISI/charm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL
329 lines (272 loc) · 12 KB
/
INSTALL
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
Charm-Crypto: Installation Documentation
-------------------------------------------------------------------------------------------
Charm has automated the installation process such that the end-user
does not have to directly handle dependencies, linking, compiler flag setting, and the
like. However, there is always the corner case in which an end-user is using a currently
unsupported platform, and thus may need to build and install using a very manual process.
We would like to support you in this case, and have written this documentation to get
you started on your path using Charm. This installation file will contain some
installation blocks highlighting each respective implementation.
Before we begin, please note the current dependencies:
- Python2.7 or Python3
- Pyparsing http://pyparsing.wikispaces.com/
- GMP 5.x http://gmplib.org/
- PBC 0.5.14 http://crypto.stanford.edu/pbc/news.html
- OPENSSL http://www.openssl.org/
See ./configure.sh --help for other options.
BUILDING IN LINUX
------------------------
Note that the entire compilation process is supported by the Charm configure/make scripts.
The steps for building in linux this way are:
1. In a terminal, run configure.sh
2. sudo make
3. sudo make install
[Ubuntu 10.04 LTS]
1. Before installing Charm, there are a few prerequisites that need to be installed on your system. These are:
1. Git
sudo apt-get git
2. Python 3 (By default, Ubuntu 10.04 LTS comes with 2.6, this build of charm requires 3.x) and header files/static library
sudo apt-get install python3 python3-dev
3. m4
sudo apt-get install m4
4. libssl-dev
sudo apt-get install libssl-dev
2. Now we need to obtain a copy of Charm:
git clone git://github.com/JHUISI/charm.git
3. Next, we will install Charm. Navigate to the Charm directory.
1. We must first run the configuration script:
sudo ./configure.sh
2. Now we will build and install Charm:
sudo make
sudo make install
3. And finally we must rebuild the searchpath for libraries
sudo ldconfig
[Ubuntu 11.04]
1. Before installing Charm, there are a few prerequisites that need to be installed on your system. These are:
1. Git
sudo apt-get git
2. m4
sudo apt-get install m4
3. Python 3 and headers/ static library
sudo apt-get install python3
4. Header files/static library
sudo apt-get install python3-dev (if you did install Python 3)
2. Now we need to obtain a copy of Charm:
git clone git://github.com/JHUISI/charm.git
3. Next, we will install Charm. Navigate to the Charm directory.
1. We must first run the configuration script:
sudo ./configure.sh
2. Now we will build and install Charm:
sudo make
sudo make install
3. And finally we must rebuild the searchpath for libraries
sudo ldconfig
[Fedora]
1. Before installing Charm, there are a few prerequisites that need to be installed on your system. These are:
1. m4
su -c "yum install m4"
2. Python 3
su -c "yum install python3"
3. Header files/static library
su -c "yum install python3-devel"
4. openssl-devel
su -c "yum install openssl-devel"
2. Red Hat/Fedora has decided not to support ECC in OpenSSL due to patent concerns, so we now need to remove their restriction, manually import the required files, and build new shared libraries.
1. Remove the ECC restriction
1. Navigate to /usr/include/openssl
cd /usr/include/openssl
2. Open the OpenSSL configuration file for editing using your editor of choice
su -c "vi opensslconf-i386.h"
3. Remove the flags that restrict the use of ECC
Delete (at the beginning of file)
#ifndef OPENSSL_NO_EC
# define OPENSSL_NO_EC
#endif
#ifndef OPENSSL_NO_ECDH
# define OPENSSL_NO_ECDH
#endif
#ifndef OPENSSL_NO_ECDSA
# define OPENSSL_NO_ECDSA
#endif
Delete (later on the file)
# if defined(OPENSSL_NO_EC) && !defined(NO_EC)
# define NO_EC
# endif
# if defined(OPENSSL_NO_ECDH) && !defined(NO_ECDH)
# define NO_ECDH
# endif
# if defined(OPENSSL_NO_ECDSA) && !defined(NO_ECDSA)
# define NO_ECDSA
# endif
4. Save the file and close it
2. Add the ECC files
1. Navigate to http://www.openssl.org/source/ and download the latest version of openssl source
2. Untar it
3. Navigate to /path/to/openssl-[version]/include/openssl (ie inside the untarred file)
cd /path/to/openssl-[version]/include/openssl
4. Add the new files to the current OpenSSL installation
su -c "yes n | cp * /usr/include/openssl"
3. Build the new shared libraries
1. Navigate to your downloaded version of OpenSSL
cd /path/to/openssl-[version]/
2. Configure OpenSSL to make the shared libraries
./config shared
3. Make the new OpenSSL library
make
4. Move the new shared libraries with their links
su -c "cp --no-dereference libcrypto.so /usr/local/lib/libcrypto.so.10"
su -c "cp libcrypto.so.1.0.0 /usr/local/lib"
su -c "cp --no-dereference libssl.so /usr/local/lib/libssl.so.10"
su -c "cp libssl.so.1.0.0 /usr/local/lib"
su -c "cp libcrypto.a /usr/local/lib"
su -c "cp libssl.a /usr/local/lib"
5. And now we need to set the library search path to look for the libraries we just added first.
cd /etc/ld.so.conf.d/
su -c "vi charm.conf"
put "/usr/local/lib" (without quotes) into the file, save, and close
su -c ldconfig
6. Set the library search path to look for the new libraries first (either type this into your terminal or put it in your .bashrc file and source it)
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
3. Now we need to obtain a copy of Charm:
git clone -b master https://github.com/JHUISI/charm.git
4. Next, we will install Charm. Navigate to the Charm directory.
1. We must first run the configuration script:
su -c ./configure.sh
If the output of the configure script says that libgmp is already installed (and this is your first time installing Charm), chances are you have an outdated version of GMP. We need to check which version of libgmp you have installed.
su -c updatedb
locate libgmp
If you don't see libgmp.so.10 OR libgmp.so.10.0.2 in the resulting list, then you will need to build the GMP libraries from source.
1. Download the latest version of the GMP source from ftp://ftp.gnu.org/gnu/gmp/gmp-5.0.2.tar.gz
2. Untar it
3. Navigate to /path/to/gmpsource (ie inside the untarred file)
cd /path/to/gmpsource
4. Build and install the libraries
./configure
make
su -c "cp gmp.h /usr/local/include"
su -c "make install"
5. You now have two options (remove or keep the old libraries):
1. Remove the old libraries
cd /usr/lib
su -c "rm libgmp.*"
2. Keep the old libraries, rename the new one
1. Determine the version of the old library
su -c updatedb
locate libgmp
2. Look for /usr/lib/libgmp.so.X in the resulting list where X is a number (NOT /usr/lib/libgmp.X.Y.Z)
3. Rename the new link
cd /usr/local/lib
su -c "mv libgmp.so.10 libgmp.so.X"
6. Rebuild the searchpath for libraries
su -c ldconfig
2. Now we will build and install Charm:
su -c "make"
su -c "make install"
3. And finally we must rebuild the searchpath for libraries
su -c ldconfig
[Fedora x86_64]
[Mint x86_64]
1. Before installing Charm, there are a few prerequisites that need to be installed on your system. These are:
1. Git
sudo apt-get install git
2. m4
sudo apt-get install m4
3. Python 3
sudo apt-get install python3
4. Header files/static library
sudo apt-get install python3-dev
5. libssl-dev (only necessary if you did not install Python 3)
sudo apt-get install libssl-dev
6. This distro doesn't seem to come with binutils or gcc, install those.
2. Now we need to obtain a copy of Charm:
git clone git://github.com/JHUISI/charm.git
3. Next, we will install Charm. Navigate to the Charm directory.
1. We must first run the configuration script:
sudo bash ./configure.sh * Bash to avoid unexpected operator error.
2. Now we will build and install Charm:
sudo make
sudo make install
3. And finally we must rebuild the searchpath for libraries
sudo ldconfig
BUILDING IN WINDOWS
------------------------
Note that the entire compilation process is now supported by the Charm configure/make scripts.
The steps for building in mingw32 this way are:
1. Download the latest source version of openssl.
2. Run MinGW Shell.
3. Extract openssl, configure and install as shown below.
4. Extract Charm, and navigate to the top directory.
5. Run configure.sh as shown below.
6. The process will fail out at wget, and open Internet Explorer to the wget download
page.
7. Install wget, and set it's bin directory on your PATH. To do this, right-click My
Computer, Select Properties, Select Advanced System Settings, Select Advanced, Select
Environment Variables, and than PATH. Scroll to the end, and enter a ; followed by
the absolute path to the bin directory (e.g., C:\Program Files\etc).
8. With wget installed, run the configure.sh script again, and it should set up your
Make dependencies for you.
9. Make build.
10. Make install.
*. Another way to install dependencies is to follow the Windows blocks below.
[MinGW32 and Cygwin]
Let's first build our dependencies with the following scripts:
#GMP
./configure --prefix=/mingw --disable-static --enable-shared
make
make install
#OPENSSL
./config --openssldir=/mingw --shared # This gets us around installing perl.
make
make install
# ** NOTE ** openssl-1.0.0e ./test compilation problems.
# You will run into a compilation error that looks similar to:
# mdtest.c:1:10 error: expected ...
#
# To mitigate, do the following:
# grep "./test/dummytest.c" *
# edit each file from "dummytest.c" to "#include "dummytest.c"
#PBC
./configure --prefix=/mingw --disable-static --enable-shared
make
make install
#Building Charm
./configure --prefix=/mingw --python=/c/Python32/python.exe
# ** NOTE ** The latest mingw installer comes coupled with gcc-4.6.x
# which no longer supports the flag -mno-cygwin. This, unfortunately,
# is called during python setup.py build as it is a part of a class
# in distutils for python. A fix is coming for python to evaluate
# the gcc compiler version, and remove the flag -mno-cygwin if it
# 4.6+, but that has yet to be implemented.
[Building Executable]
If you are building to make an executable with NSIS, than be sure to
compile the dependencies first and pass the appropriate header and
library files to --python-build-ext (calls build_ext option for setup).
./configure.sh --python=/c/Python32/python.exe --python-build-ext="-L/path/to/lib -I/path/to/header"
Need help building the dependencies? Follow the below:
#GMP
./configure --prefix=/c/charm-crypto --disable-static --enable-shared
make
make install
#PBC
./configure --prefix=/c/charm-crypto --disable-static --enable-shared LDFLAGS="-L/c/charm-crypto/lib" CPPFLAGS="-I/c/charm-crypto/include"
make
make install
#OPENSSL
./config --openssldir=/c/charm-crypto --shared # This gets us around installing perl.
make
make install
BUILDING IN OS X
------------------------
Note that the entire compilation process is supported by the Charm configure/make scripts.
The steps for building in os x this way are:
1. In a terminal, run configure.sh
2. The process will fail out at wget, and will ask you to install.
3. Using your package manager of choice (e.g., sudo port install wget), install wget.
4. With wget installed, run the configure.sh script again, and it should set up your
Make dependencies for you.
5. make
6. make install
*. Another way to install dependencies is to use macports, homebrew or fink.
[Snow Leopard]
[Lion/Mountain Lion]
For Lion, run ./configure.sh --enable-darwin in step 1 and follow the steps above for OS X.