comparison Resources/CMake/OpenSslConfiguration.cmake @ 3731:e7ff4f9b34bd storage-commitment

integration mainline->storage-commitment
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 09 Mar 2020 17:19:45 +0100
parents faa695f433d5
children a3e38994d95a
comparison
equal deleted inserted replaced
3718:922c56b76edc 3731:e7ff4f9b34bd
1 if (STATIC_BUILD OR NOT USE_SYSTEM_OPENSSL) 1 if (STATIC_BUILD OR NOT USE_SYSTEM_OPENSSL)
2 SET(OPENSSL_SOURCES_DIR ${CMAKE_BINARY_DIR}/openssl-1.0.2p) 2 if (OPENSSL_STATIC_VERSION STREQUAL "1.0.2")
3 SET(OPENSSL_URL "http://orthanc.osimis.io/ThirdPartyDownloads/openssl-1.0.2p.tar.gz") 3 include(${CMAKE_CURRENT_LIST_DIR}/OpenSslConfigurationStatic-1.0.2.cmake)
4 SET(OPENSSL_MD5 "ac5eb30bf5798aa14b1ae6d0e7da58df") 4 elseif (OPENSSL_STATIC_VERSION STREQUAL "1.1.1")
5 5 include(${CMAKE_CURRENT_LIST_DIR}/OpenSslConfigurationStatic-1.1.1.cmake)
6 if (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}")
7 set(FirstRun OFF)
8 else() 6 else()
9 set(FirstRun ON) 7 message(FATAL_ERROR "Unsupported version of OpenSSL: ${OPENSSL_STATIC_VERSION}")
10 endif()
11
12 DownloadPackage(${OPENSSL_MD5} ${OPENSSL_URL} "${OPENSSL_SOURCES_DIR}")
13
14 if (FirstRun)
15 file(MAKE_DIRECTORY ${OPENSSL_SOURCES_DIR}/include/openssl)
16
17 foreach(header
18 ${OPENSSL_SOURCES_DIR}/crypto/aes/aes.h
19 ${OPENSSL_SOURCES_DIR}/crypto/asn1/asn1.h
20 ${OPENSSL_SOURCES_DIR}/crypto/asn1/asn1_mac.h
21 ${OPENSSL_SOURCES_DIR}/crypto/asn1/asn1t.h
22 ${OPENSSL_SOURCES_DIR}/crypto/bf/blowfish.h
23 ${OPENSSL_SOURCES_DIR}/crypto/bio/bio.h
24 ${OPENSSL_SOURCES_DIR}/crypto/bn/bn.h
25 ${OPENSSL_SOURCES_DIR}/crypto/buffer/buffer.h
26 ${OPENSSL_SOURCES_DIR}/crypto/camellia/camellia.h
27 ${OPENSSL_SOURCES_DIR}/crypto/cast/cast.h
28 ${OPENSSL_SOURCES_DIR}/crypto/cmac/cmac.h
29 ${OPENSSL_SOURCES_DIR}/crypto/cms/cms.h
30 ${OPENSSL_SOURCES_DIR}/crypto/comp/comp.h
31 ${OPENSSL_SOURCES_DIR}/crypto/conf/conf.h
32 ${OPENSSL_SOURCES_DIR}/crypto/conf/conf_api.h
33 ${OPENSSL_SOURCES_DIR}/crypto/crypto.h
34 ${OPENSSL_SOURCES_DIR}/crypto/des/des.h
35 ${OPENSSL_SOURCES_DIR}/crypto/des/des_old.h
36 ${OPENSSL_SOURCES_DIR}/crypto/dh/dh.h
37 ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsa.h
38 ${OPENSSL_SOURCES_DIR}/crypto/dso/dso.h
39 ${OPENSSL_SOURCES_DIR}/crypto/ebcdic.h
40 ${OPENSSL_SOURCES_DIR}/crypto/ec/ec.h
41 ${OPENSSL_SOURCES_DIR}/crypto/ecdh/ecdh.h
42 ${OPENSSL_SOURCES_DIR}/crypto/ecdsa/ecdsa.h
43 ${OPENSSL_SOURCES_DIR}/crypto/engine/engine.h
44 ${OPENSSL_SOURCES_DIR}/crypto/err/err.h
45 ${OPENSSL_SOURCES_DIR}/crypto/evp/evp.h
46 ${OPENSSL_SOURCES_DIR}/crypto/hmac/hmac.h
47 ${OPENSSL_SOURCES_DIR}/crypto/idea/idea.h
48 ${OPENSSL_SOURCES_DIR}/crypto/jpake/jpake.h
49 ${OPENSSL_SOURCES_DIR}/crypto/krb5/krb5_asn.h
50 ${OPENSSL_SOURCES_DIR}/crypto/lhash/lhash.h
51 ${OPENSSL_SOURCES_DIR}/crypto/md2/md2.h
52 ${OPENSSL_SOURCES_DIR}/crypto/md4/md4.h
53 ${OPENSSL_SOURCES_DIR}/crypto/md5/md5.h
54 ${OPENSSL_SOURCES_DIR}/crypto/mdc2/mdc2.h
55 ${OPENSSL_SOURCES_DIR}/crypto/modes/modes.h
56 ${OPENSSL_SOURCES_DIR}/crypto/objects/obj_mac.h
57 ${OPENSSL_SOURCES_DIR}/crypto/objects/objects.h
58 ${OPENSSL_SOURCES_DIR}/crypto/ocsp/ocsp.h
59 ${OPENSSL_SOURCES_DIR}/crypto/opensslconf.h
60 ${OPENSSL_SOURCES_DIR}/crypto/opensslv.h
61 ${OPENSSL_SOURCES_DIR}/crypto/ossl_typ.h
62 ${OPENSSL_SOURCES_DIR}/crypto/pem/pem.h
63 ${OPENSSL_SOURCES_DIR}/crypto/pem/pem2.h
64 ${OPENSSL_SOURCES_DIR}/crypto/pkcs12/pkcs12.h
65 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/pkcs7.h
66 ${OPENSSL_SOURCES_DIR}/crypto/pqueue/pqueue.h
67 ${OPENSSL_SOURCES_DIR}/crypto/rand/rand.h
68 ${OPENSSL_SOURCES_DIR}/crypto/rc2/rc2.h
69 ${OPENSSL_SOURCES_DIR}/crypto/rc4/rc4.h
70 ${OPENSSL_SOURCES_DIR}/crypto/rc5/rc5.h
71 ${OPENSSL_SOURCES_DIR}/crypto/ripemd/ripemd.h
72 ${OPENSSL_SOURCES_DIR}/crypto/rsa/rsa.h
73 ${OPENSSL_SOURCES_DIR}/crypto/seed/seed.h
74 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha.h
75 ${OPENSSL_SOURCES_DIR}/crypto/srp/srp.h
76 ${OPENSSL_SOURCES_DIR}/crypto/stack/safestack.h
77 ${OPENSSL_SOURCES_DIR}/crypto/stack/stack.h
78 ${OPENSSL_SOURCES_DIR}/crypto/store/store.h
79 ${OPENSSL_SOURCES_DIR}/crypto/symhacks.h
80 ${OPENSSL_SOURCES_DIR}/crypto/ts/ts.h
81 ${OPENSSL_SOURCES_DIR}/crypto/txt_db/txt_db.h
82 ${OPENSSL_SOURCES_DIR}/crypto/ui/ui.h
83 ${OPENSSL_SOURCES_DIR}/crypto/ui/ui_compat.h
84 ${OPENSSL_SOURCES_DIR}/crypto/whrlpool/whrlpool.h
85 ${OPENSSL_SOURCES_DIR}/crypto/x509/x509.h
86 ${OPENSSL_SOURCES_DIR}/crypto/x509/x509_vfy.h
87 ${OPENSSL_SOURCES_DIR}/crypto/x509v3/x509v3.h
88 ${OPENSSL_SOURCES_DIR}/e_os2.h
89 ${OPENSSL_SOURCES_DIR}/ssl/dtls1.h
90 ${OPENSSL_SOURCES_DIR}/ssl/kssl.h
91 ${OPENSSL_SOURCES_DIR}/ssl/srtp.h
92 ${OPENSSL_SOURCES_DIR}/ssl/ssl.h
93 ${OPENSSL_SOURCES_DIR}/ssl/ssl2.h
94 ${OPENSSL_SOURCES_DIR}/ssl/ssl23.h
95 ${OPENSSL_SOURCES_DIR}/ssl/ssl3.h
96 ${OPENSSL_SOURCES_DIR}/ssl/tls1.h
97 )
98 file(COPY ${header} DESTINATION ${OPENSSL_SOURCES_DIR}/include/openssl)
99 endforeach()
100
101 file(RENAME
102 ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2.h
103 ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2_source.h)
104
105 # The following patch of "e_os2.h" prevents from building OpenSSL
106 # as a DLL under Windows. Otherwise, symbols have inconsistent
107 # linkage if ${OPENSSL_SOURCES} is used to create a DLL (notably
108 # if building an Orthanc plugin such as MySQL).
109 file(WRITE ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2.h "
110 #include \"e_os2_source.h\"
111 #if defined(_WIN32)
112 # undef OPENSSL_EXPORT
113 # undef OPENSSL_IMPORT
114 # undef OPENSSL_EXTERN
115 # undef OPENSSL_GLOBAL
116 # define OPENSSL_EXPORT
117 # define OPENSSL_IMPORT
118 # define OPENSSL_EXTERN extern
119 # define OPENSSL_GLOBAL
120 #endif
121 ")
122 endif()
123
124 add_definitions(
125 -DOPENSSL_THREADS
126 -DOPENSSL_IA32_SSE2
127 -DOPENSSL_NO_ASM
128 -DOPENSSL_NO_DYNAMIC_ENGINE
129 -DNO_WINDOWS_BRAINDEATH
130
131 -DOPENSSL_NO_BF
132 -DOPENSSL_NO_CAMELLIA
133 -DOPENSSL_NO_CAST
134 -DOPENSSL_NO_EC_NISTP_64_GCC_128
135 -DOPENSSL_NO_GMP
136 -DOPENSSL_NO_GOST
137 -DOPENSSL_NO_HW
138 -DOPENSSL_NO_JPAKE
139 -DOPENSSL_NO_IDEA
140 -DOPENSSL_NO_KRB5
141 -DOPENSSL_NO_MD2
142 -DOPENSSL_NO_MDC2
143 #-DOPENSSL_NO_MD4 # MD4 is necessary for MariaDB/MySQL client
144 -DOPENSSL_NO_RC2
145 -DOPENSSL_NO_RC4
146 -DOPENSSL_NO_RC5
147 -DOPENSSL_NO_RFC3779
148 -DOPENSSL_NO_SCTP
149 -DOPENSSL_NO_STORE
150 -DOPENSSL_NO_SEED
151 -DOPENSSL_NO_WHIRLPOOL
152 -DOPENSSL_NO_RIPEMD
153 )
154
155 include_directories(
156 ${OPENSSL_SOURCES_DIR}
157 ${OPENSSL_SOURCES_DIR}/crypto
158 ${OPENSSL_SOURCES_DIR}/crypto/asn1
159 ${OPENSSL_SOURCES_DIR}/crypto/modes
160 ${OPENSSL_SOURCES_DIR}/crypto/evp
161 ${OPENSSL_SOURCES_DIR}/include
162 )
163
164 set(OPENSSL_SOURCES_SUBDIRS
165 ${OPENSSL_SOURCES_DIR}/crypto
166 ${OPENSSL_SOURCES_DIR}/crypto/aes
167 ${OPENSSL_SOURCES_DIR}/crypto/asn1
168 ${OPENSSL_SOURCES_DIR}/crypto/bio
169 ${OPENSSL_SOURCES_DIR}/crypto/bn
170 ${OPENSSL_SOURCES_DIR}/crypto/buffer
171 ${OPENSSL_SOURCES_DIR}/crypto/cmac
172 ${OPENSSL_SOURCES_DIR}/crypto/cms
173 ${OPENSSL_SOURCES_DIR}/crypto/comp
174 ${OPENSSL_SOURCES_DIR}/crypto/conf
175 ${OPENSSL_SOURCES_DIR}/crypto/des
176 ${OPENSSL_SOURCES_DIR}/crypto/dh
177 ${OPENSSL_SOURCES_DIR}/crypto/dsa
178 ${OPENSSL_SOURCES_DIR}/crypto/dso
179 ${OPENSSL_SOURCES_DIR}/crypto/engine
180 ${OPENSSL_SOURCES_DIR}/crypto/err
181 ${OPENSSL_SOURCES_DIR}/crypto/evp
182 ${OPENSSL_SOURCES_DIR}/crypto/hmac
183 ${OPENSSL_SOURCES_DIR}/crypto/lhash
184 ${OPENSSL_SOURCES_DIR}/crypto/md4
185 ${OPENSSL_SOURCES_DIR}/crypto/md5
186 ${OPENSSL_SOURCES_DIR}/crypto/modes
187 ${OPENSSL_SOURCES_DIR}/crypto/objects
188 ${OPENSSL_SOURCES_DIR}/crypto/ocsp
189 ${OPENSSL_SOURCES_DIR}/crypto/pem
190 ${OPENSSL_SOURCES_DIR}/crypto/pkcs12
191 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7
192 ${OPENSSL_SOURCES_DIR}/crypto/pqueue
193 ${OPENSSL_SOURCES_DIR}/crypto/rand
194 ${OPENSSL_SOURCES_DIR}/crypto/rsa
195 ${OPENSSL_SOURCES_DIR}/crypto/sha
196 ${OPENSSL_SOURCES_DIR}/crypto/srp
197 ${OPENSSL_SOURCES_DIR}/crypto/stack
198 ${OPENSSL_SOURCES_DIR}/crypto/ts
199 ${OPENSSL_SOURCES_DIR}/crypto/txt_db
200 ${OPENSSL_SOURCES_DIR}/crypto/ui
201 ${OPENSSL_SOURCES_DIR}/crypto/x509
202 ${OPENSSL_SOURCES_DIR}/crypto/x509v3
203 ${OPENSSL_SOURCES_DIR}/ssl
204 )
205
206 if (ENABLE_OPENSSL_ENGINES)
207 list(APPEND OPENSSL_SOURCES_SUBDIRS
208 ${OPENSSL_SOURCES_DIR}/engines
209 )
210 endif()
211
212 list(APPEND OPENSSL_SOURCES_SUBDIRS
213 # EC, ECDH and ECDSA are necessary for PKCS11, and for contacting
214 # HTTPS servers that use TLS certificate encrypted with ECDSA
215 # (check the output of a recent version of the "sslscan"
216 # command). Until Orthanc <= 1.4.1, these features were only
217 # enabled if ENABLE_PKCS11 support was set to "ON".
218 # https://groups.google.com/d/msg/orthanc-users/2l-bhYIMEWg/oMmK33bYBgAJ
219 ${OPENSSL_SOURCES_DIR}/crypto/ec
220 ${OPENSSL_SOURCES_DIR}/crypto/ecdh
221 ${OPENSSL_SOURCES_DIR}/crypto/ecdsa
222 )
223
224 foreach(d ${OPENSSL_SOURCES_SUBDIRS})
225 AUX_SOURCE_DIRECTORY(${d} OPENSSL_SOURCES)
226 endforeach()
227
228 list(REMOVE_ITEM OPENSSL_SOURCES
229 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_unix.c
230 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_vms.c
231 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_win.c
232 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_win32.c
233 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_wince.c
234 ${OPENSSL_SOURCES_DIR}/crypto/armcap.c
235 ${OPENSSL_SOURCES_DIR}/crypto/bf/bfs.cpp
236 ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_rtcp.c
237 ${OPENSSL_SOURCES_DIR}/crypto/bn/exp.c
238 ${OPENSSL_SOURCES_DIR}/crypto/conf/cnf_save.c
239 ${OPENSSL_SOURCES_DIR}/crypto/conf/test.c
240 ${OPENSSL_SOURCES_DIR}/crypto/des/des.c
241 ${OPENSSL_SOURCES_DIR}/crypto/des/des3s.cpp
242 ${OPENSSL_SOURCES_DIR}/crypto/des/des_opts.c
243 ${OPENSSL_SOURCES_DIR}/crypto/des/dess.cpp
244 ${OPENSSL_SOURCES_DIR}/crypto/des/read_pwd.c
245 ${OPENSSL_SOURCES_DIR}/crypto/des/speed.c
246 ${OPENSSL_SOURCES_DIR}/crypto/evp/e_dsa.c
247 ${OPENSSL_SOURCES_DIR}/crypto/evp/m_ripemd.c
248 ${OPENSSL_SOURCES_DIR}/crypto/lhash/lh_test.c
249 ${OPENSSL_SOURCES_DIR}/crypto/md4/md4.c
250 ${OPENSSL_SOURCES_DIR}/crypto/md4/md4s.cpp
251 ${OPENSSL_SOURCES_DIR}/crypto/md4/md4test.c
252 ${OPENSSL_SOURCES_DIR}/crypto/md5/md5s.cpp
253 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/bio_ber.c
254 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/pk7_enc.c
255 ${OPENSSL_SOURCES_DIR}/crypto/ppccap.c
256 ${OPENSSL_SOURCES_DIR}/crypto/rand/randtest.c
257 ${OPENSSL_SOURCES_DIR}/crypto/s390xcap.c
258 ${OPENSSL_SOURCES_DIR}/crypto/sparcv9cap.c
259 ${OPENSSL_SOURCES_DIR}/crypto/x509v3/tabtest.c
260 ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3conf.c
261 ${OPENSSL_SOURCES_DIR}/ssl/ssl_task.c
262 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_nyi.c
263 ${OPENSSL_SOURCES_DIR}/crypto/aes/aes_x86core.c
264 ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_dgram.c
265 ${OPENSSL_SOURCES_DIR}/crypto/bn/bntest.c
266 ${OPENSSL_SOURCES_DIR}/crypto/bn/expspeed.c
267 ${OPENSSL_SOURCES_DIR}/crypto/bn/exptest.c
268 ${OPENSSL_SOURCES_DIR}/crypto/engine/enginetest.c
269 ${OPENSSL_SOURCES_DIR}/crypto/evp/evp_test.c
270 ${OPENSSL_SOURCES_DIR}/crypto/hmac/hmactest.c
271 ${OPENSSL_SOURCES_DIR}/crypto/md5/md5.c
272 ${OPENSSL_SOURCES_DIR}/crypto/md5/md5test.c
273 ${OPENSSL_SOURCES_DIR}/crypto/o_dir_test.c
274 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/dec.c
275 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/enc.c
276 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/sign.c
277 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/verify.c
278 ${OPENSSL_SOURCES_DIR}/crypto/rsa/rsa_test.c
279 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha.c
280 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1.c
281 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1t.c
282 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1test.c
283 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha256t.c
284 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha512t.c
285 ${OPENSSL_SOURCES_DIR}/crypto/sha/shatest.c
286 ${OPENSSL_SOURCES_DIR}/crypto/srp/srptest.c
287
288 ${OPENSSL_SOURCES_DIR}/crypto/bn/divtest.c
289 ${OPENSSL_SOURCES_DIR}/crypto/bn/bnspeed.c
290 ${OPENSSL_SOURCES_DIR}/crypto/des/destest.c
291 ${OPENSSL_SOURCES_DIR}/crypto/dh/p192.c
292 ${OPENSSL_SOURCES_DIR}/crypto/dh/p512.c
293 ${OPENSSL_SOURCES_DIR}/crypto/dh/p1024.c
294 ${OPENSSL_SOURCES_DIR}/crypto/des/rpw.c
295 ${OPENSSL_SOURCES_DIR}/ssl/ssltest.c
296 ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsagen.c
297 ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsatest.c
298 ${OPENSSL_SOURCES_DIR}/crypto/dh/dhtest.c
299 ${OPENSSL_SOURCES_DIR}/crypto/pqueue/pq_test.c
300 ${OPENSSL_SOURCES_DIR}/crypto/des/ncbc_enc.c
301
302 ${OPENSSL_SOURCES_DIR}/crypto/evp/evp_extra_test.c
303 ${OPENSSL_SOURCES_DIR}/crypto/evp/verify_extra_test.c
304 ${OPENSSL_SOURCES_DIR}/crypto/x509/verify_extra_test.c
305 ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3prin.c
306 ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3nametest.c
307 ${OPENSSL_SOURCES_DIR}/crypto/constant_time_test.c
308
309 ${OPENSSL_SOURCES_DIR}/ssl/heartbeat_test.c
310 ${OPENSSL_SOURCES_DIR}/ssl/fatalerrtest.c
311 ${OPENSSL_SOURCES_DIR}/ssl/dtlstest.c
312 ${OPENSSL_SOURCES_DIR}/ssl/bad_dtls_test.c
313 ${OPENSSL_SOURCES_DIR}/ssl/clienthellotest.c
314 ${OPENSSL_SOURCES_DIR}/ssl/sslv2conftest.c
315
316 ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256.c
317 ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256_table.c
318 ${OPENSSL_SOURCES_DIR}/crypto/ec/ectest.c
319 ${OPENSSL_SOURCES_DIR}/crypto/ecdh/ecdhtest.c
320 ${OPENSSL_SOURCES_DIR}/crypto/ecdsa/ecdsatest.c
321 )
322
323
324 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
325 set_source_files_properties(
326 ${OPENSSL_SOURCES}
327 PROPERTIES COMPILE_DEFINITIONS
328 "OPENSSL_SYSNAME_WIN32;SO_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN")
329
330 if (ENABLE_OPENSSL_ENGINES)
331 link_libraries(crypt32)
332 endif()
333 endif() 8 endif()
334 9
335 source_group(ThirdParty\\OpenSSL REGULAR_EXPRESSION ${OPENSSL_SOURCES_DIR}/.*) 10 source_group(ThirdParty\\OpenSSL REGULAR_EXPRESSION ${OPENSSL_SOURCES_DIR}/.*)
336 11
337 else() 12 else()