This repository has been archived by the owner on Feb 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
143 lines (102 loc) · 4.02 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.7.1)
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Wno-gnu -pthread")
set(THREADS_PREFER_PTHREAD_FLAG ON)
# Hunter snapshot that will be used
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.18.43.tar.gz"
SHA1 "d2c8c42cd07f7cefe18fd9a9b9c13114b1a15a27"
)
# ignore warnings from
include_directories(SYSTEM "include")
project(cryptopals)
# Download dependencies
hunter_add_package(Catch)
hunter_add_package(cxxopts)
hunter_add_package(fmt)
hunter_add_package(Boost)
hunter_add_package(OpenSSL)
hunter_add_package(Boost COMPONENTS system filesystem)
hunter_add_package(CURL)
hunter_add_package(RapidJSON)
find_package(Threads REQUIRED)
# Find dependencies
find_package(Catch CONFIG REQUIRED)
find_package(cxxopts CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(Boost CONFIG REQUIRED system)
find_package(OpenSSL REQUIRED)
find_package(CURL CONFIG REQUIRED)
find_package(RapidJSON CONFIG REQUIRED)
find_package( ZLIB REQUIRED )
set(BYTE
src/bytearray.cpp
src/utils.cpp
src/analysis/aes.cpp
src/hex.cpp
src/fs.cpp
src/hamming.cpp
src/oracle/aes.cpp
src/oracle/profile.cpp
src/analysis/frequency.cpp
src/mt19937.cpp
src/sha1.cpp
src/bigint.cpp
src/dh.cpp
src/mac.cpp
)
set(SRP
src/srp/server.cpp
src/srp/client.cpp
)
set(AES
src/methods/aes.cpp
src/methods/padding.cpp
)
# Targets
add_executable(simple src/simple.cpp src/hist.cpp ${AES} ${BYTE} ${SRP})
if ( ZLIB_FOUND )
include_directories(${ZLIB_INCLUDE_DIRS})
target_link_libraries(simple PUBLIC cxxopts::cxxopts fmt Boost::boost OpenSSL::SSL OpenSSL::Crypto Boost::system Threads::Threads PRIVATE CURL::libcurl RapidJSON::rapidjson ${ZLIB_LIBRARIES})
endif( ZLIB_FOUND )
add_executable(server src/server.cpp src/bytearray.cpp src/sha1.cpp src/hex.cpp)
target_link_libraries(server PUBLIC fmt Boost::system Threads::Threads)
# Tests
add_executable(challenge1 tests/base.cpp tests/challenge1.cpp src/hist.cpp ${AES} ${BYTE})
target_link_libraries(challenge1 PUBLIC Catch::Catch OpenSSL::SSL OpenSSL::Crypto)
#
add_executable(challenge2 tests/base.cpp tests/challenge2.cpp src/bytearray.cpp src/hist.cpp ${AES} ${BYTE})
target_link_libraries(challenge2 PUBLIC Catch::Catch OpenSSL::SSL OpenSSL::Crypto)
#
add_executable(challenge3 tests/base.cpp tests/challenge3.cpp src/bytearray.cpp src/hist.cpp ${AES} ${BYTE})
target_link_libraries(challenge3 PUBLIC Catch::Catch OpenSSL::SSL OpenSSL::Crypto)
#
add_executable(challenge4 tests/base.cpp tests/challenge4.cpp src/bytearray.cpp src/hist.cpp ${AES} ${BYTE})
target_link_libraries(challenge4 PUBLIC Catch::Catch OpenSSL::SSL OpenSSL::Crypto)
#
add_executable(challenge5 tests/base.cpp tests/challenge5.cpp src/hist.cpp ${BYTE} ${AES})
target_link_libraries(challenge5 PUBLIC Boost::boost OpenSSL::SSL OpenSSL::Crypto Boost::system Threads::Threads)
add_executable(challenge6 tests/base.cpp tests/challenge6.cpp src/hist.cpp ${BYTE} ${AES})
target_link_libraries(challenge6 PUBLIC Boost::boost OpenSSL::SSL OpenSSL::Crypto Boost::system Threads::Threads)
add_executable(hist tests/base.cpp tests/hist.cpp src/hist.cpp src/bytearray.cpp)
target_link_libraries(hist PUBLIC Catch::Catch)
#
add_executable(hamming tests/base.cpp tests/hamming.cpp src/hamming.cpp src/bytearray.cpp)
target_link_libraries(hamming PUBLIC Catch::Catch)
add_executable(mt19937 tests/base.cpp tests/mt19937.cpp src/bytearray.cpp src/mt19937.cpp)
target_link_libraries(mt19937 PUBLIC Catch::Catch)
# Testing
enable_testing()
include_directories(src)
add_test(NAME Challenge1 COMMAND challenge1)
add_test(NAME Challenge2 COMMAND challenge2)
add_test(NAME Challenge3 COMMAND challenge3)
add_test(NAME Challenge4 COMMAND challenge4)
add_test(NAME Challenge5 COMMAND challenge5)
add_test(NAME Challenge6 COMMAND challenge6)
add_test(NAME Histogram COMMAND hist)
add_test(NAME Hamming COMMAND hamming)
add_test(NAME MT19937 COMMAND mt19937)