comparison Resources/CMake/OpenSslConfigurationStatic-1.1.1.cmake @ 3720:faa695f433d5

upgraded OpenSSL to 1.1.1d
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 05 Mar 2020 16:42:55 +0100
parents
children c575fb0adf91
comparison
equal deleted inserted replaced
3719:d737173197e1 3720:faa695f433d5
1 SET(OPENSSL_SOURCES_DIR ${CMAKE_BINARY_DIR}/openssl-1.1.1d)
2 SET(OPENSSL_URL "http://orthanc.osimis.io/ThirdPartyDownloads/openssl-1.1.1d.tar.gz")
3 SET(OPENSSL_MD5 "3be209000dbc7e1b95bcdf47980a3baa")
4
5 if (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}")
6 set(FirstRun OFF)
7 else()
8 set(FirstRun ON)
9 endif()
10
11 DownloadPackage(${OPENSSL_MD5} ${OPENSSL_URL} "${OPENSSL_SOURCES_DIR}")
12
13 if (FirstRun)
14 file(WRITE ${AUTOGENERATED_DIR}/openssl_cversion.c "
15 #include \"internal/cryptlib.h\"
16 unsigned long OpenSSL_version_num(void)
17 {
18 return OPENSSL_VERSION_NUMBER;
19 }
20 ")
21 file(WRITE ${OPENSSL_SOURCES_DIR}/crypto/include/internal/bn_conf.h "")
22 file(WRITE ${OPENSSL_SOURCES_DIR}/crypto/include/internal/dso_conf.h "")
23
24 # Apply the patches
25 execute_process(
26 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
27 ${ORTHANC_ROOT}/Resources/Patches/openssl-1.1.1d.patch
28 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
29 RESULT_VARIABLE Failure
30 )
31
32 if (Failure)
33 message(FATAL_ERROR "Error while patching a file")
34 endif()
35 else()
36 message("The patches for OpenSSL have already been applied")
37 endif()
38
39 add_definitions(
40 -DOPENSSL_THREADS
41 -DOPENSSL_IA32_SSE2
42 -DOPENSSL_NO_ASM
43 -DOPENSSL_NO_DYNAMIC_ENGINE
44
45 -DOPENSSL_NO_BF
46 -DOPENSSL_NO_CAMELLIA
47 -DOPENSSL_NO_CAST
48 -DOPENSSL_NO_EC_NISTP_64_GCC_128
49 -DOPENSSL_NO_GMP
50 -DOPENSSL_NO_GOST
51 -DOPENSSL_NO_HW
52 -DOPENSSL_NO_JPAKE
53 -DOPENSSL_NO_IDEA
54 -DOPENSSL_NO_KRB5
55 -DOPENSSL_NO_MD2
56 -DOPENSSL_NO_MDC2
57 #-DOPENSSL_NO_MD4 # MD4 is necessary for MariaDB/MySQL client
58 -DOPENSSL_NO_RC2
59 -DOPENSSL_NO_RC4
60 -DOPENSSL_NO_RC5
61 -DOPENSSL_NO_RFC3779
62 -DOPENSSL_NO_SCTP
63 -DOPENSSL_NO_STORE
64 -DOPENSSL_NO_SEED
65 -DOPENSSL_NO_WHIRLPOOL
66 -DOPENSSL_NO_RIPEMD
67
68 -DOPENSSLDIR="/usr/local/ssl"
69 )
70
71
72 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
73 # In order for "crypto/mem_sec.c" to compile on LSB
74 add_definitions(-DOPENSSL_NO_SECURE_MEMORY)
75 endif()
76
77
78 include_directories(
79 ${OPENSSL_SOURCES_DIR}
80 ${OPENSSL_SOURCES_DIR}/crypto
81 ${OPENSSL_SOURCES_DIR}/crypto/asn1
82 ${OPENSSL_SOURCES_DIR}/crypto/ec/curve448
83 ${OPENSSL_SOURCES_DIR}/crypto/ec/curve448/arch_32
84 ${OPENSSL_SOURCES_DIR}/crypto/evp
85 ${OPENSSL_SOURCES_DIR}/crypto/include
86 ${OPENSSL_SOURCES_DIR}/crypto/modes
87 ${OPENSSL_SOURCES_DIR}/include
88 )
89
90
91 set(OPENSSL_SOURCES_SUBDIRS
92 ${OPENSSL_SOURCES_DIR}/crypto
93 ${OPENSSL_SOURCES_DIR}/crypto/aes
94 ${OPENSSL_SOURCES_DIR}/crypto/aria
95 ${OPENSSL_SOURCES_DIR}/crypto/asn1
96 ${OPENSSL_SOURCES_DIR}/crypto/async
97 ${OPENSSL_SOURCES_DIR}/crypto/async/arch
98 ${OPENSSL_SOURCES_DIR}/crypto/bio
99 ${OPENSSL_SOURCES_DIR}/crypto/blake2
100 ${OPENSSL_SOURCES_DIR}/crypto/bn
101 ${OPENSSL_SOURCES_DIR}/crypto/buffer
102 ${OPENSSL_SOURCES_DIR}/crypto/chacha
103 ${OPENSSL_SOURCES_DIR}/crypto/cmac
104 ${OPENSSL_SOURCES_DIR}/crypto/cms
105 ${OPENSSL_SOURCES_DIR}/crypto/comp
106 ${OPENSSL_SOURCES_DIR}/crypto/conf
107 ${OPENSSL_SOURCES_DIR}/crypto/ct
108 ${OPENSSL_SOURCES_DIR}/crypto/des
109 ${OPENSSL_SOURCES_DIR}/crypto/dh
110 ${OPENSSL_SOURCES_DIR}/crypto/dsa
111 ${OPENSSL_SOURCES_DIR}/crypto/dso
112 ${OPENSSL_SOURCES_DIR}/crypto/ec
113 ${OPENSSL_SOURCES_DIR}/crypto/ec/curve448
114 ${OPENSSL_SOURCES_DIR}/crypto/ec/curve448/arch_32
115 ${OPENSSL_SOURCES_DIR}/crypto/err
116 ${OPENSSL_SOURCES_DIR}/crypto/evp
117 ${OPENSSL_SOURCES_DIR}/crypto/hmac
118 ${OPENSSL_SOURCES_DIR}/crypto/kdf
119 ${OPENSSL_SOURCES_DIR}/crypto/lhash
120 ${OPENSSL_SOURCES_DIR}/crypto/md4
121 ${OPENSSL_SOURCES_DIR}/crypto/md5
122 ${OPENSSL_SOURCES_DIR}/crypto/modes
123 ${OPENSSL_SOURCES_DIR}/crypto/objects
124 ${OPENSSL_SOURCES_DIR}/crypto/ocsp
125 ${OPENSSL_SOURCES_DIR}/crypto/pem
126 ${OPENSSL_SOURCES_DIR}/crypto/pkcs12
127 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7
128 ${OPENSSL_SOURCES_DIR}/crypto/poly1305
129 ${OPENSSL_SOURCES_DIR}/crypto/pqueue
130 ${OPENSSL_SOURCES_DIR}/crypto/rand
131 ${OPENSSL_SOURCES_DIR}/crypto/ripemd
132 ${OPENSSL_SOURCES_DIR}/crypto/rsa
133 ${OPENSSL_SOURCES_DIR}/crypto/sha
134 ${OPENSSL_SOURCES_DIR}/crypto/siphash
135 ${OPENSSL_SOURCES_DIR}/crypto/sm2
136 ${OPENSSL_SOURCES_DIR}/crypto/sm3
137 ${OPENSSL_SOURCES_DIR}/crypto/sm4
138 ${OPENSSL_SOURCES_DIR}/crypto/srp
139 ${OPENSSL_SOURCES_DIR}/crypto/stack
140 ${OPENSSL_SOURCES_DIR}/crypto/store
141 ${OPENSSL_SOURCES_DIR}/crypto/ts
142 ${OPENSSL_SOURCES_DIR}/crypto/txt_db
143 ${OPENSSL_SOURCES_DIR}/crypto/ui
144 ${OPENSSL_SOURCES_DIR}/crypto/x509
145 ${OPENSSL_SOURCES_DIR}/crypto/x509v3
146 ${OPENSSL_SOURCES_DIR}/ssl
147 ${OPENSSL_SOURCES_DIR}/ssl/record
148 ${OPENSSL_SOURCES_DIR}/ssl/statem
149 )
150
151 if (ENABLE_OPENSSL_ENGINES)
152 # Engines support is not done yet, as Orthanc only needs it for
153 # OpenSSL < 1.1.0
154
155 #add_definitions(
156 # -DENGINESDIR="/usr/local/lib/engines-1.1"
157 # )
158
159 #list(APPEND OPENSSL_SOURCES_SUBDIRS
160 # ${OPENSSL_SOURCES_DIR}/engines
161 # ${OPENSSL_SOURCES_DIR}/crypto/engine
162 # )
163
164 add_definitions(-DOPENSSL_NO_ENGINE)
165 else()
166 add_definitions(-DOPENSSL_NO_ENGINE)
167 endif()
168
169 list(APPEND OPENSSL_SOURCES_SUBDIRS
170 # EC, ECDH and ECDSA are necessary for PKCS11, and for contacting
171 # HTTPS servers that use TLS certificate encrypted with ECDSA
172 # (check the output of a recent version of the "sslscan"
173 # command). Until Orthanc <= 1.4.1, these features were only
174 # enabled if ENABLE_PKCS11 support was set to "ON".
175 # https://groups.google.com/d/msg/orthanc-users/2l-bhYIMEWg/oMmK33bYBgAJ
176 ${OPENSSL_SOURCES_DIR}/crypto/ec
177 ${OPENSSL_SOURCES_DIR}/crypto/ecdh
178 ${OPENSSL_SOURCES_DIR}/crypto/ecdsa
179 )
180
181 foreach(d ${OPENSSL_SOURCES_SUBDIRS})
182 AUX_SOURCE_DIRECTORY(${d} OPENSSL_SOURCES)
183 endforeach()
184
185 list(APPEND OPENSSL_SOURCES ${AUTOGENERATED_DIR}/openssl_cversion.c)
186
187 list(REMOVE_ITEM OPENSSL_SOURCES
188 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_nyi.c
189 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_unix.c
190 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_vms.c
191 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_win.c
192 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_win32.c
193 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_wince.c
194 ${OPENSSL_SOURCES_DIR}/crypto/aes/aes_x86core.c
195 ${OPENSSL_SOURCES_DIR}/crypto/armcap.c
196 ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_dgram.c
197 ${OPENSSL_SOURCES_DIR}/crypto/cversion.c
198 ${OPENSSL_SOURCES_DIR}/crypto/des/ncbc_enc.c
199 ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256.c
200 ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256_table.c
201 ${OPENSSL_SOURCES_DIR}/crypto/engine/eng_devcrypto.c
202 ${OPENSSL_SOURCES_DIR}/crypto/ppccap.c
203 ${OPENSSL_SOURCES_DIR}/crypto/s390xcap.c
204 ${OPENSSL_SOURCES_DIR}/crypto/sparcv9cap.c
205 )
206
207 # Check out "${OPENSSL_SOURCES_DIR}/Configurations/README": "this is
208 # default if no option is specified, it works on any supported system"
209 set(OPENSSL_DEFINITIONS "THIRTY_TWO_BIT")
210
211 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
212 set(OPENSSL_DEFINITIONS
213 "${OPENSSL_DEFINITIONS};OPENSSL_SYSNAME_WIN32;SO_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN")
214
215 if (ENABLE_OPENSSL_ENGINES)
216 link_libraries(crypt32)
217 endif()
218 endif()
219
220 set_source_files_properties(
221 ${OPENSSL_SOURCES}
222 PROPERTIES COMPILE_DEFINITIONS
223 "${OPENSSL_DEFINITIONS};DSO_NONE;NO_WINDOWS_BRAINDEATH"
224 )