This repository has been archived by the owner on Jul 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathCMakeLists.txt
273 lines (225 loc) · 8.34 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
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
cmake_minimum_required(VERSION 3.0)
project(GmSSL)
set(CMAKE_MACOSX_RPATH 1)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
include_directories(include)
add_library(
gmssl
SHARED
src/aes.c
src/aes_modes.c
src/asn1.c
src/base64.c
src/block_cipher.c
src/chacha20.c
src/cms.c
src/debug.c
src/des.c
src/digest.c
src/ec.c
src/gcm.c
src/gf128.c
src/hash_drbg.c
src/hex.c
src/hkdf.c
src/hmac.c
src/md5.c
src/pbkdf2.c
src/pem.c
src/pkcs8.c
src/rand.c
src/rc4.c
src/rsa.c
src/sha1.c
src/sha256.c
src/sha512.c
src/sm2_algo.c
src/sm2_asn1.c
src/sm2_lib.c
src/sm2_prn.c
src/sm3.c
src/sm3_hmac.c
src/sm4_common.c
src/sm4_enc.c
src/sm4_modes.c
src/sm4_setkey.c
# src/sm9_keygen.c
# src/sm9_math.c
# src/sm9_sign.c
src/tlcp.c
src/tls.c
src/tls12.c
src/tls13.c
src/tls_trace.c
src/version.c
src/x509_alg.c
src/x509_cer.c
src/x509_crl.c
src/x509_ext.c
src/x509_oid.c
src/x509_req.c
src/x509_str.c
src/zuc_core.c
src/zuc_eea.c
src/zuc_eia.c
)
SET_TARGET_PROPERTIES(gmssl PROPERTIES VERSION 3.0 SOVERSION 3)
# tools
add_executable (sm2keygen tools/sm2keygen.c)
add_executable (sm2sign tools/sm2sign.c)
add_executable (sm2verify tools/sm2verify.c)
add_executable (sm2encrypt tools/sm2encrypt.c)
add_executable (sm2decrypt tools/sm2decrypt.c)
add_executable (sm3 tools/sm3.c)
add_executable (sm3hmac tools/sm3hmac.c)
add_executable (reqgen tools/reqgen.c)
add_executable (reqparse tools/reqparse.c)
add_executable (certgen tools/certgen.c)
add_executable (certparse tools/certparse.c)
add_executable (certverify tools/certverify.c)
add_executable (reqsign tools/reqsign.c)
add_executable (tlcp_client tools/tlcp_client.c)
add_executable (tlcp_server tools/tlcp_server.c)
add_executable (tls12_client tools/tls12_client.c)
add_executable (tls12_server tools/tls12_server.c)
add_executable (tls13_client tools/tls13_client.c)
add_executable (tls13_server tools/tls13_server.c)
target_link_libraries (sm2keygen LINK_PUBLIC gmssl)
target_link_libraries (sm2sign LINK_PUBLIC gmssl)
target_link_libraries (sm2verify LINK_PUBLIC gmssl)
target_link_libraries (sm2encrypt LINK_PUBLIC gmssl)
target_link_libraries (sm2decrypt LINK_PUBLIC gmssl)
target_link_libraries (sm3 LINK_PUBLIC gmssl)
target_link_libraries (sm3hmac LINK_PUBLIC gmssl)
target_link_libraries (reqgen LINK_PUBLIC gmssl)
target_link_libraries (reqparse LINK_PUBLIC gmssl)
target_link_libraries (reqsign LINK_PUBLIC gmssl)
target_link_libraries (certgen LINK_PUBLIC gmssl)
target_link_libraries (certparse LINK_PUBLIC gmssl)
target_link_libraries (certverify LINK_PUBLIC gmssl)
target_link_libraries (tlcp_client LINK_PUBLIC gmssl)
target_link_libraries (tlcp_server LINK_PUBLIC gmssl)
target_link_libraries (tls12_client LINK_PUBLIC gmssl)
target_link_libraries (tls12_server LINK_PUBLIC gmssl)
target_link_libraries (tls13_client LINK_PUBLIC gmssl)
target_link_libraries (tls13_server LINK_PUBLIC gmssl)
# tests
enable_testing()
add_executable(aestest tests/aestest.c)
target_link_libraries (aestest LINK_PUBLIC gmssl)
add_executable(asn1test tests/asn1test.c)
target_link_libraries (asn1test LINK_PUBLIC gmssl)
add_executable(base64test tests/base64test.c)
target_link_libraries (base64test LINK_PUBLIC gmssl)
add_executable(block_ciphertest tests/block_ciphertest.c)
target_link_libraries (block_ciphertest LINK_PUBLIC gmssl)
add_executable(chacha20test tests/chacha20test.c)
target_link_libraries (chacha20test LINK_PUBLIC gmssl)
add_executable(cmstest tests/cmstest.c)
target_link_libraries (cmstest LINK_PUBLIC gmssl)
add_executable(destest tests/destest.c)
target_link_libraries (destest LINK_PUBLIC gmssl)
add_executable(digesttest tests/digesttest.c)
target_link_libraries (digesttest LINK_PUBLIC gmssl)
add_executable(ectest tests/ectest.c)
target_link_libraries (ectest LINK_PUBLIC gmssl)
add_executable(gcmtest tests/gcmtest.c)
target_link_libraries (gcmtest LINK_PUBLIC gmssl)
add_executable(gf128test tests/gf128test.c)
target_link_libraries (gf128test LINK_PUBLIC gmssl)
add_executable(hash_drbgtest tests/hash_drbgtest.c)
target_link_libraries (hash_drbgtest LINK_PUBLIC gmssl)
add_executable(hextest tests/hextest.c)
target_link_libraries (hextest LINK_PUBLIC gmssl)
add_executable(hkdftest tests/hkdftest.c)
target_link_libraries (hkdftest LINK_PUBLIC gmssl)
add_executable(hmactest tests/hmactest.c)
target_link_libraries (hmactest LINK_PUBLIC gmssl)
add_executable(md5test tests/md5test.c)
target_link_libraries (md5test LINK_PUBLIC gmssl)
add_executable(pbkdf2test tests/pbkdf2test.c)
target_link_libraries (pbkdf2test LINK_PUBLIC gmssl)
add_executable(pemtest tests/pemtest.c)
target_link_libraries (pemtest LINK_PUBLIC gmssl)
add_executable(pkcs8test tests/pkcs8test.c)
target_link_libraries (pkcs8test LINK_PUBLIC gmssl)
add_executable(rc4test tests/rc4test.c)
target_link_libraries (rc4test LINK_PUBLIC gmssl)
add_executable(sha1test tests/sha1test.c)
target_link_libraries (sha1test LINK_PUBLIC gmssl)
add_executable(sha224test tests/sha224test.c)
target_link_libraries (sha224test LINK_PUBLIC gmssl)
add_executable(sha256test tests/sha256test.c)
target_link_libraries (sha256test LINK_PUBLIC gmssl)
add_executable(sha384test tests/sha384test.c)
target_link_libraries (sha384test LINK_PUBLIC gmssl)
add_executable(sha512test tests/sha512test.c)
target_link_libraries (sha512test LINK_PUBLIC gmssl)
add_executable(sm2test tests/sm2test.c)
target_link_libraries (sm2test LINK_PUBLIC gmssl)
add_executable(sm3test tests/sm3test.c)
target_link_libraries (sm3test LINK_PUBLIC gmssl)
add_executable(sm4test tests/sm4test.c)
target_link_libraries (sm4test LINK_PUBLIC gmssl)
add_executable(x509test tests/x509test.c)
target_link_libraries (x509test LINK_PUBLIC gmssl)
add_executable(x509_oidtest tests/x509_oidtest.c)
target_link_libraries (x509_oidtest LINK_PUBLIC gmssl)
add_executable(x509_algtest tests/x509_algtest.c)
target_link_libraries (x509_algtest LINK_PUBLIC gmssl)
add_executable(x509_strtest tests/x509_strtest.c)
target_link_libraries (x509_strtest LINK_PUBLIC gmssl)
add_executable(x509_reqtest tests/x509_reqtest.c)
target_link_libraries (x509_reqtest LINK_PUBLIC gmssl)
add_executable(x509_crltest tests/x509_crltest.c)
target_link_libraries (x509_crltest LINK_PUBLIC gmssl)
add_executable(x509_exttest tests/x509_exttest.c)
target_link_libraries (x509_exttest LINK_PUBLIC gmssl)
add_executable(zuctest tests/zuctest.c)
target_link_libraries (zuctest LINK_PUBLIC gmssl)
add_executable(tlstest tests/tlstest.c)
target_link_libraries (tlstest LINK_PUBLIC gmssl)
enable_testing()
add_test(NAME aes COMMAND aestest)
add_test(NAME asn1 COMMAND asn1test)
add_test(NAME base64 COMMAND base64test)
add_test(NAME block_cipher COMMAND block_ciphertest)
add_test(NAME chacha20 COMMAND chacha20test)
add_test(NAME cms COMMAND cmstest)
add_test(NAME des COMMAND destest)
add_test(NAME digest COMMAND digesttest)
add_test(NAME ec COMMAND ectest)
add_test(NAME gcm COMMAND gcmtest)
add_test(NAME gf128 COMMAND gf128test)
add_test(NAME hash_drbg COMMAND hash_drbgtest)
add_test(NAME hkdf COMMAND hkdftest)
add_test(NAME hex COMMAND hextest)
add_test(NAME hmac COMMAND hmactest)
add_test(NAME md5 COMMAND md5test)
add_test(NAME pbkdf2 COMMAND pbkdf2test)
add_test(NAME pem COMMAND pemtest)
add_test(NAME pkcs8 COMMAND pkcs8test)
add_test(NAME rc4 COMMAND rc4test)
add_test(NAME sha1 COMMAND sha1test)
add_test(NAME sha224 COMMAND sha224test)
add_test(NAME sha256 COMMAND sha256test)
add_test(NAME sha384 COMMAND sha384test)
add_test(NAME sha512 COMMAND sha512test)
add_test(NAME sm2 COMMAND sm2test)
add_test(NAME sm3 COMMAND sm3test)
add_test(NAME sm4 COMMAND sm4test)
add_test(NAME tls COMMAND tlstest)
add_test(NAME x509 COMMAND x509test)
add_test(NAME x509_oid COMMAND x509_oidtest)
add_test(NAME x509_alg COMMAND x509_algtest)
add_test(NAME x509_str COMMAND x509_strtest)
add_test(NAME x509_req COMMAND x509_reqtest)
add_test(NAME x509_crl COMMAND x509_crltest)
add_test(NAME x509_ext COMMAND x509_exttest)
add_test(NAME zuc COMMAND zuctest)
INSTALL(TARGETS sm3 sm3hmac sm2keygen sm2sign sm2verify sm2encrypt sm2decrypt RUNTIME DESTINATION bin)
INSTALL(TARGETS certparse certgen certverify reqgen reqparse reqsign RUNTIME DESTINATION bin)
INSTALL(TARGETS tlcp_client tlcp_server tls12_client tls12_server tls13_client tls13_server RUNTIME DESTINATION bin)
INSTALL(TARGETS gmssl LIBRARY DESTINATION lib)
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/gmssl DESTINATION include)