Skip to content

Commit 2aa8819

Browse files
committed
new build script
1 parent 3085367 commit 2aa8819

15 files changed

+83
-234
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ frontend_cryptoTools/certs/*
2424

2525
.DS_Store
2626
*/.DS_Store
27+
__pycache__/
2728

2829
# Build results
2930
[Dd]ebug/

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ if (POLICY CMP0048)
33
cmake_policy(SET CMP0048 NEW)
44
endif (POLICY CMP0048)
55

6-
project(cryptoTools VERSION 1.6.0)
6+
project(cryptoTools VERSION 1.7.0)
77

88

99

CMakeSettings.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

__init__.py

Whitespace-only changes.

build.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import os
2+
import platform
3+
import sys
4+
from .thirdparty import getBoost
5+
from .thirdparty import getRelic
6+
#import thirdparty
7+
8+
def Setup():
9+
dir_path = os.path.dirname(os.path.realpath(__file__))
10+
os.chdir(dir_path + "/thirdparty")
11+
12+
if "boost" in sys.argv:
13+
getBoost.getBoost()
14+
if "relic" in sys.argv:
15+
getRelic.getRelic()
16+
17+
18+
def Build():
19+
20+
osStr = (platform.system())
21+
buildDir = ""
22+
args = sys.argv[1:]
23+
config = ""
24+
buildType = ""
25+
if len(args) > 0 and args[0] == "Debug":
26+
buildType = "Debug"
27+
args = args[1:]
28+
else:
29+
buildType = "Release"
30+
31+
32+
if osStr == "Windows":
33+
buildDir = "out/build/x64-{0}".format(buildType)
34+
config = "--config {0}".format(buildType)
35+
args.append("-DCOMMON_FLAGS=/MP /Qpar")
36+
else:
37+
buildDir = "out/build/linux"
38+
39+
40+
args.append("-DCMAKE_BUILD_TYPE={0}".format(buildType))
41+
42+
argStr = ""
43+
for a in args:
44+
argStr = argStr + " " + a
45+
46+
mkDirCmd = "mkdir -p {0}".format(buildDir);
47+
CMakeCmd = "cmake -S . -B {0} {1}".format(buildDir, argStr)
48+
BuildCmd = "cmake --build {0} {1} --parallel ".format(buildDir, config)
49+
50+
print("Build Cmd:\n {0}\n {1}\n {2}\n\n".format(mkDirCmd, CMakeCmd, BuildCmd))
51+
52+
os.system(mkDirCmd)
53+
os.system(CMakeCmd)
54+
os.system(BuildCmd)
55+
56+
57+
if __name__ == "__main__":
58+
if(len(sys.argv) > 1 and sys.argv[1] == "setup"):
59+
Setup()
60+
else:
61+
Build()

build.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

cmake/cryptoToolsDepHelper.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ if(ENABLE_BOOST)
6868

6969
if(NOT BOOST_ROOT OR NOT EXISTS "${BOOST_ROOT}")
7070
if(MSVC)
71-
set(BOOST_ROOT_local "${CMAKE_CURRENT_LIST_DIR}/../cryptoTools/thirdparty/win/boost/")
71+
set(BOOST_ROOT_local "${CMAKE_CURRENT_LIST_DIR}/../thirdparty/boost/")
7272
set(BOOST_ROOT_install "c:/libs/boost/")
7373

7474

@@ -80,7 +80,7 @@ if(ENABLE_BOOST)
8080
set(BOOST_ROOT "${BOOST_ROOT_install}")
8181
endif()
8282
else()
83-
set(BOOST_ROOT "${CMAKE_CURRENT_LIST_DIR}/../thirdparty/linux/boost/")
83+
set(BOOST_ROOT "${CMAKE_CURRENT_LIST_DIR}/../thirdparty/boost/")
8484

8585
set(BOOST_SEARCH_PATHS "${BOOST_SEARCH_PATHS} ${BOOST_ROOT}")
8686
endif()
@@ -98,9 +98,9 @@ if(ENABLE_BOOST)
9898

9999
macro(findBoost)
100100
if(MSVC)
101-
find_package(Boost 1.69 COMPONENTS system thread regex)
101+
find_package(Boost 1.75 COMPONENTS system thread regex)
102102
else()
103-
find_package(Boost 1.69 COMPONENTS system thread)
103+
find_package(Boost 1.75 COMPONENTS system thread)
104104
endif()
105105
endmacro()
106106

@@ -110,7 +110,7 @@ if(ENABLE_BOOST)
110110
endif()
111111

112112
if(NOT Boost_FOUND)
113-
message(FATAL_ERROR "Failed to find boost 1.69+ at ${BOOST_SEARCH_PATHS} or at system install")
113+
message(FATAL_ERROR "Failed to find boost 1.75+ at ${BOOST_ROOT} or at system install")
114114
endif()
115115

116116
message(STATUS "Boost_LIB: ${Boost_LIBRARIES}" )

cryptoTools/Common/Version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33

44
#define CRYPTO_TOOLS_VERSION_MAJOR 1
5-
#define CRYPTO_TOOLS_VERSION_MINOR 6
6-
#define CRYPTO_TOOLS_VERSION_PATCH 1
5+
#define CRYPTO_TOOLS_VERSION_MINOR 7
6+
#define CRYPTO_TOOLS_VERSION_PATCH 0
77

88

99
#define CRYPTO_TOOLS_VERSION (CRYPTO_TOOLS_VERSION_MAJOR * 10000 + CRYPTO_TOOLS_VERSION_MINOR * 100 + CRYPTO_TOOLS_VERSION_PATCH)

cryptoTools/Crypto/RCurve.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extern "C" {
3131
#define RLC_BN_SIZE BN_SIZE
3232
#endif
3333

34-
#if !defined(MULTI) || ((MULTI != PTHREAD) && (MULTI != OPENMP))
34+
#if !defined(MULTI) || ((MULTI != PTHREAD) && (MULTI != OPENMP) && (MULTI != MSVCTLS))
3535
static_assert(0, "Relic must be built with -DMULTI=PTHREAD or -DMULTI=OPENMP");
3636
#endif
3737

readme.md

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,68 +2,33 @@
22
=====
33

44

5-
CryptoTools is a portable c++14 library containing a collection of tools for building cryptographic protocols. This include asynchronous networking (Boost Asio), several fast primitives such as AES (AES-NI), Blake2, SHA1 (assembly), and eliptic curve crypto (Relic-Toolkit). There are also several other utilities tailered for implementing protocols.
5+
CryptoTools is a portable c++14 library containing a collection of tools for building cryptographic protocols. This include asynchronous networking (Boost Asio), several fast primitives such as AES (AES-NI), Blake2 (assembly), and eliptic curve crypto (Relic-Toolkit). There are also several other utilities tailored for implementing protocols.
66

77
Thirdparty networking is also supported. See `frontend_cryptoTools/tutorial/Network.cpp` for an example.
88

99

1010

11-
## Install
11+
## Build
1212

1313
The library is *cross platform* and has been tested on both Windows, Linux and Mac. There are two **optional dependencies** including [Boost 1.69](http://www.boost.org/) (networking), and [Relic](https://github.com/relic-toolkit/relic/) for elliptic curves.
1414

15-
### Windows
16-
17-
In `Powershell`, this will set up the project
15+
16+
In short, this will build the project
1817

1918
```
20-
git clone --recursive https://github.com/ladnir/cryptoTools
21-
cd cryptoTools/thirdparty/win
22-
[build boost at c:\libs\boost or thirdparty\win\boost]
23-
cd ../..
24-
[build using cmake, eg with visual studio]
19+
git clone https://github.com/ladnir/cryptoTools
20+
python build.py setup boost relic
21+
python build.py -DENABLE_RELIC=ON
2522
```
26-
The `libOTe` library will be written to `[build_dir]/libOTe/` and the exectable to `[build_dir]/frontend_cryptoTools/`.
27-
28-
* See `cmake .` for build options.
29-
30-
**Enable elliptic curves using:**
31-
* `cmake . -DENABLE_RELIC=ON`: Build the library with integration to the
32-
[Relic](https://github.com/relic-toolkit/relic/) library. Requires that
33-
relic is built with `cmake . -DMULTI=OPENMP` and installed.
34-
35-
**Boost and visual studio:** If boost does not build with visual studio 2017+
36-
follow [these instructions](https://stackoverflow.com/questions/41464356/build-boost-with-msvc-14-1-vs2017-rc).
37-
38-
### Unix
39-
40-
In short, this will build the project (without elliptic curves)
23+
The resulting binaries are written to `out/build/linux` or `out/build/x64-Release` depending on a unix or windows build. The frontend executable is `frontend_cryptoTools/`.
4124

25+
Relic and Boost are not required. In this case `boost`, `relic` can be omitted, e.g.
4226
```
43-
git clone --recursive https://github.com/ladnir/cryptoTools
44-
cd thirdparty/linux
45-
bash boost.get
46-
cd ../..
47-
cmake .
48-
make
27+
python build.py setup
28+
python build.py -DENABLE_RELIC=OFF -DENABLE_BOOST=OFF
4929
```
50-
The `libOTe` library will be written to `[build_dir]/libOTe/` and the exectable to `[build_dir]/frontend_cryptoTools/`, where `[build_dir]=.` for in source build.
51-
52-
This will build the minimum version of the library (wihtout elliptic curves).
53-
To see all the command line options, execute the program
54-
55-
`./frontend_libOTe`
56-
57-
58-
**Enable elliptic curves using:**
59-
* `cmake . -DENABLE_RELIC=ON`: Build the library with integration to the
60-
[Relic](https://github.com/relic-toolkit/relic/) library. Requires that
61-
relic is built with `cmake . -DMULTI=PTHREAD` and installed.
62-
63-
**Note:** In the case that miracl or boost is already installed, the steps
64-
`cd cryptoTools/thirdparty/linux; bash boost.get` can be skipped and CMake will attempt
65-
to find them instead. Boost is found with the CMake findBoost package.
6630

31+
Several other build options are available. See the output of `python build.py` or `cmake .`
6732

6833
## License
6934
This project is dual licensed under MIT and Unlicensed.

thirdparty/linux/all.get

Lines changed: 0 additions & 11 deletions
This file was deleted.

thirdparty/linux/boost.get

Lines changed: 0 additions & 16 deletions
This file was deleted.

thirdparty/linux/miracl.get

Lines changed: 0 additions & 16 deletions
This file was deleted.

thirdparty/win/getBoost.ps1

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)