The easiest way to install charm-crypto is to use the pre-built (with Mingw64) package for Windows x64.
-
Install Python 3.5 for Windows x86-64: Python3.5_win_x86_64. (or Python 3.5 for Windows x86: Python3.5_win_x86).
-
Extract
charm-crypto-win-x64.7z
(orcharm-crypto-win32.7z
for Python 32-bit) and go tocharm-crypto
folder -
Copy all
.dll
files toC:\Windows\System32
. -
Run the following to install Charm-crypto for Python 64-bit:
easy_install Charm_Crypto-0.43-py3.5-win-amd64.egg
or for Python 32-bit:
easy_install Charm_Crypto-0.43-py3.5-win32.egg
If the pre-built packages (see above) doesn't work or not appropriate for some reasons, then please find detailed steps on how to build charm-crypto on Win32 using Mingw32:
-
Install and prepare mingw32
-
Install MSYS2 MSYS2_32_installer
-
Open MSYS2 shell (C:\msys32\msys2.exe)
-
Update packages (from MSYS2 shell):
pacman -Sy pacman pacman -Syu pacman -Su
-
Install a Mingw32 toolchain (from MSYS2 shell):
pacman -S mingw-w64-i686-gcc pacman -S make
-
-
Install charm-crypto dependencies (from MSYS2 shell):
- Open MSYS2 shell (C:\msys32\msys2.exe)
- Install bison
pacman -S bison
- Install openssl-dev
pacman -S openssl-devel
- Install gmp-dev
pacman -S gmp-devel
-
Build PBC lib (charm-crypto dependency)
-
Get and extract pbc source PBC
-
Open Mingw32 shell (C:\msys32\mingw32.exe)
-
Go to extracted PBC location
-
Build PBC:
./configure --prefix=/mingw32 --disable-static --enable-shared make make install
-
-
Add mingw32/bin (C:\msys32\mingw32\bin) to PATH
-
Install Python 3.5 for Windows 32 bit: Python3.5_win_x86. In what follows we assume that it was installed to C:\Users\user\AppData\Local\Application Data\Programs\Python\Python35-32.
-
Patch Python to be able to work with Mingw32
- Patch the cygwin compiler in distutils:
- Open C:\Users\indy\AppData\Local\Application Data\Programs\Python\Python35-32\Lib\distutils\cygwinccompiler.py
- Comment out all lines with
get_msvcr()
call.
- Patch the cygwin compiler in distutils:
-
Build charm-crypto
-
Get and extract charm-crypto source charm-crypto-0.43
-
Go to extracted charm-crypto folder
-
Add
#include <stdint.h>
at the top of the following files:Charm-Crypto-0.43\charm\core\math\integer\integermodule.h Charm-Crypto-0.43\charm\core\math\elliptic_curve\ecmodule.h Charm-Crypto-0.43\charm\core\math\pairing\pairingmodule.h
-
Open Mingw32 shell (C:\msys32\mingw32.exe)
-
Build charm-crypto (please note that we specify the path to python35.exe there)
./configure.sh --prefix=/mingw32 --python=/c/users/user/AppData/Local/Programs/Python/Python35-32/python.exe make make install
-
If the pre-built packages (see above) doesn't work or not appropriate for some reasons, then please find detailed steps on how to build charm-crypto on Win_x64 using Mingw64:
-
Install and prepare mingw64
-
Install MSYS2 MSYS2_64_installer
-
Open MSYS2 shell (C:\msys64\msys2.exe)
-
Update packages (from MSYS2 shell):
pacman -Sy pacman pacman -Syu pacman -Su
-
Install a Mingw64 toolchain (from MSYS2 shell):
pacman -S mingw-w64-x86_64-gcc pacman -S make
-
-
Install charm-crypto dependencies (from MSYS2 shell):
- Open MSYS2 shell (C:\msys64\msys2.exe)
- Install bison
pacman -S bison
- Install openssl-dev
pacman -S openssl-devel
- Install gmp-dev
pacman -S gmp-devel
-
Build PBC lib (charm-crypto dependency)
-
Get and extract pbc source PBC
-
Open Mingw64 shell (C:\msys64\mingw64.exe)
-
Go to extracted PBC location
-
Build PBC:
./configure --prefix=/mingw64 --disable-static --enable-shared make make install
-
-
Add mingw64/bin (C:\msys64\mingw64\bin) to PATH
-
Install Python 3.5 for Windows x86-64: Python3.5_win_x86_64. In what follows we assume that it was installed to C:\Users\user\AppData\Local\Application Data\Programs\Python\Python35.
-
Patch Python to be able to build and use 64 bit binaries
-
Download and extract gendef.exe from gendef
-
Copy dendef.exe into mingw64/bin (C:\msys64\mingw64/bin)
-
Copy python35.dll to libs folder:
cd C:\Users\user\AppData\Local\Application Data\Programs\Python\Python35 cp python35.dll libs
-
Patch libpython35.a
cd C:\Users\user\AppData\Local\Application Data\Programs\Python\Python35\libs rename python35.lib old_python35.lib gendef python35.dll dlltool --dllname python35.dll --def python35.def --output-lib libpython35.a
-
Patch pyconfig.h:
-
Open C:\Users\user\AppData\Local\Application Data\Programs\Python\Python35\include\pyconfig.h
-
In that file search for the text
#ifdef _WIN64
, and cut out the following three lines:#ifdef _WIN64 #define MS_WIN64 #endif
-
Search for the text
#ifdef _MSC_VER
. Paste in the cut-out lines, ABOVE the#ifdef _MSC_VER
.
-
-
Patch the cygwin compiler in distutils:
- Open C:\Users\user\AppData\Local\Application Data\Programs\Python\Python35\Lib\distutils\cygwinccompiler.py
- Comment out all lines with
get_msvcr()
call.
-
-
Build charm-crypto
-
Get and extract charm-crypto source charm-crypto-0.43
-
Go to extracted charm-crypto folder
-
Add
#include <stdint.h>
at the top of the following files:Charm-Crypto-0.43\charm\core\math\integer\integermodule.h Charm-Crypto-0.43\charm\core\math\elliptic_curve\ecmodule.h Charm-Crypto-0.43\charm\core\math\pairing\pairingmodule.h
-
Open Mingw64 shell (C:\msys64\mingw64.exe)
-
Build charm-crypto (please note that we specify the path to python35.exe there)
./configure.sh --prefix=/mingw64 --python=/c/users/user/AppData/Local/Programs/Python/Python35/python.exe make make install
-