1 | # $Id: Config.kmk 128585 2019-02-01 16:18:33Z aeichner $
|
---|
2 | ## @file
|
---|
3 | # OpenSSL kBuild Configuration file.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2016 Oracle Corporation
|
---|
8 | #
|
---|
9 | # Oracle Corporation confidential
|
---|
10 | # All rights reserved
|
---|
11 | #
|
---|
12 |
|
---|
13 | # Include the top-level configure file.
|
---|
14 | ifndef VBOX_ROOT_CONFIG_KMK_INCLUDED
|
---|
15 | include $(PATH_ROOT)/Config.kmk
|
---|
16 | endif
|
---|
17 |
|
---|
18 | # Figure out openssl perl asm style for the target
|
---|
19 | VBOX_CRYPTO_ASM_SCHEME := portme
|
---|
20 | if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris)
|
---|
21 | VBOX_CRYPTO_ASM_SCHEME := elf
|
---|
22 | else ifeq ($(KBUILD_TARGET), darwin)
|
---|
23 | VBOX_CRYPTO_ASM_SCHEME := macosx
|
---|
24 | else ifeq ($(KBUILD_TARGET), win)
|
---|
25 | VBOX_CRYPTO_ASM_SCHEME := nasm
|
---|
26 | endif
|
---|
27 |
|
---|
28 | # Can't use relative paths when dealing with sub-makefiles.
|
---|
29 | VBOX_PATH_OPENSSL := $(PATH_ROOT)/src/libs/openssl-1.1.1f
|
---|
30 | VBOX_PATH_CRYPTO := $(VBOX_PATH_OPENSSL)/crypto
|
---|
31 | VBOX_PATH_CRYPTO_GENASM := $(VBOX_PATH_CRYPTO)/genasm-$(VBOX_CRYPTO_ASM_SCHEME)
|
---|
32 | VBOX_PATH_CRYPTO_AES := $(VBOX_PATH_CRYPTO)/aes
|
---|
33 | VBOX_PATH_CRYPTO_BN := $(VBOX_PATH_CRYPTO)/bn
|
---|
34 | VBOX_PATH_CRYPTO_CHACHA := $(VBOX_PATH_CRYPTO)/chacha
|
---|
35 | VBOX_PATH_CRYPTO_EC := $(VBOX_PATH_CRYPTO)/ec
|
---|
36 | VBOX_PATH_CRYPTO_MD5 := $(VBOX_PATH_CRYPTO)/md5
|
---|
37 | VBOX_PATH_CRYPTO_MODES := $(VBOX_PATH_CRYPTO)/modes
|
---|
38 | VBOX_PATH_CRYPTO_RC4 := $(VBOX_PATH_CRYPTO)/rc4
|
---|
39 | VBOX_PATH_CRYPTO_SHA := $(VBOX_PATH_CRYPTO)/sha
|
---|
40 | VBOX_INST_CRYPTO_HEADERS := obj/$(if-expr "$(CURSUBDIR)" == ".",,$(CURSUBDIR)/)crypto-1.1.1-headers/include/openssl/
|
---|
41 | VBOX_PATH_CRYPTO_HEADERS := $(abspath $(PATH_OUT))/$(patsubst %/,%,$(VBOX_INST_CRYPTO_HEADERS))
|
---|
42 |
|
---|
43 | # Enable asm implementation of crypto.
|
---|
44 | if1of ($(KBUILD_TARGET_ARCH), x86 amd64)
|
---|
45 | ifneq ($(VBOX_CRYPTO_ASM_SCHEME),portme)
|
---|
46 | ifn1of ($(KBUILD_TARGET), ) # Selective exclusion for testing.
|
---|
47 | VBOX_WITH_CRYPTO_ASM = 1
|
---|
48 | endif
|
---|
49 | endif
|
---|
50 | endif
|
---|
51 |
|
---|
52 | #
|
---|
53 | # A target for installer the header files into a include directory
|
---|
54 | # for the build. We have to put this in the Config.kmk because it
|
---|
55 | # is required when running make from a sub directory too.
|
---|
56 | #
|
---|
57 | INSTALLS += crypto-headers
|
---|
58 | crypto-headers_INST = $(VBOX_INST_CRYPTO_HEADERS)
|
---|
59 | crypto-headers_MODE = a+r,u+w
|
---|
60 | crypto-headers_DEFPATH = $(VBOX_PATH_OPENSSL)
|
---|
61 | crypto-headers_SOURCES = \
|
---|
62 | include/openssl/aes.h=>aes.h \
|
---|
63 | include/openssl/asn1.h=>asn1.h \
|
---|
64 | include/openssl/asn1err.h=>asn1err.h \
|
---|
65 | include/openssl/asn1t.h=>asn1t.h \
|
---|
66 | include/openssl/asn1_mac.h=>asn1_mac.h \
|
---|
67 | include/openssl/async.h=>async.h \
|
---|
68 | include/openssl/asyncerr.h=>asyncerr.h \
|
---|
69 | include/openssl/bio.h=>bio.h \
|
---|
70 | include/openssl/bioerr.h=>bioerr.h \
|
---|
71 | include/openssl/blowfish.h=>blowfish.h \
|
---|
72 | include/openssl/bn.h=>bn.h \
|
---|
73 | include/openssl/bnerr.h=>bnerr.h \
|
---|
74 | include/openssl/buffer.h=>buffer.h \
|
---|
75 | include/openssl/buffererr.h=>buffererr.h \
|
---|
76 | include/openssl/camellia.h=>camellia.h \
|
---|
77 | include/openssl/cast.h=>cast.h \
|
---|
78 | include/openssl/cmac.h=>cmac.h \
|
---|
79 | include/openssl/cms.h=>cms.h \
|
---|
80 | include/openssl/comp.h=>comp.h \
|
---|
81 | include/openssl/comperr.h=>comperr.h \
|
---|
82 | include/openssl/conf.h=>conf.h \
|
---|
83 | include/openssl/conferr.h=>conferr.h \
|
---|
84 | include/openssl/conf_api.h=>conf_api.h \
|
---|
85 | include/openssl/crypto.h=>crypto.h \
|
---|
86 | include/openssl/cryptoerr.h=>cryptoerr.h \
|
---|
87 | include/openssl/ct.h=>ct.h \
|
---|
88 | include/openssl/cterr.h=>cterr.h \
|
---|
89 | include/openssl/des.h=>des.h \
|
---|
90 | include/openssl/dh.h=>dh.h \
|
---|
91 | include/openssl/dherr.h=>dherr.h \
|
---|
92 | include/openssl/dsa.h=>dsa.h \
|
---|
93 | include/openssl/dsaerr.h=>dsaerr.h \
|
---|
94 | include/openssl/dtls1.h=>dtls1.h \
|
---|
95 | include/openssl/ebcdic.h=>ebcdic.h \
|
---|
96 | include/openssl/ec.h=>ec.h \
|
---|
97 | include/openssl/ecerr.h=>ecerr.h \
|
---|
98 | include/openssl/ecdh.h=>ecdh.h \
|
---|
99 | include/openssl/ecdsa.h=>ecdsa.h \
|
---|
100 | include/openssl/engine.h=>engine.h \
|
---|
101 | include/openssl/err.h=>err.h \
|
---|
102 | include/openssl/evp.h=>evp.h \
|
---|
103 | include/openssl/evperr.h=>evperr.h \
|
---|
104 | include/openssl/e_os2.h=>e_os2.h \
|
---|
105 | include/openssl/hmac.h=>hmac.h \
|
---|
106 | include/openssl/idea.h=>idea.h \
|
---|
107 | include/openssl/lhash.h=>lhash.h \
|
---|
108 | include/openssl/md2.h=>md2.h \
|
---|
109 | include/openssl/md4.h=>md4.h \
|
---|
110 | include/openssl/md5.h=>md5.h \
|
---|
111 | include/openssl/mdc2.h=>mdc2.h \
|
---|
112 | include/openssl/modes.h=>modes.h \
|
---|
113 | include/openssl/objects.h=>objects.h \
|
---|
114 | include/openssl/objectserr.h=>objectserr.h \
|
---|
115 | include/openssl/obj_mac.h=>obj_mac.h \
|
---|
116 | include/openssl/ocsp.h=>ocsp.h \
|
---|
117 | include/openssl/ocsperr.h=>ocsperr.h \
|
---|
118 | openssl-mangling.h=>openssl-mangling.h \
|
---|
119 | include/openssl/opensslconf.h=>opensslconf.h \
|
---|
120 | include/openssl/opensslv.h=>opensslv.h \
|
---|
121 | include/openssl/ossl_typ.h=>ossl_typ.h \
|
---|
122 | include/openssl/pem.h=>pem.h \
|
---|
123 | include/openssl/pemerr.h=>pemerr.h \
|
---|
124 | include/openssl/pem2.h=>pem2.h \
|
---|
125 | include/openssl/pkcs12.h=>pkcs12.h \
|
---|
126 | include/openssl/pkcs12err.h=>pkcs12err.h \
|
---|
127 | include/openssl/pkcs7.h=>pkcs7.h \
|
---|
128 | include/openssl/pkcs7err.h=>pkcs7err.h \
|
---|
129 | include/openssl/rand.h=>rand.h \
|
---|
130 | include/openssl/randerr.h=>randerr.h \
|
---|
131 | include/openssl/rc2.h=>rc2.h \
|
---|
132 | include/openssl/rc4.h=>rc4.h \
|
---|
133 | include/openssl/ripemd.h=>ripemd.h \
|
---|
134 | include/openssl/rsa.h=>rsa.h \
|
---|
135 | include/openssl/rsaerr.h=>rsaerr.h \
|
---|
136 | include/openssl/safestack.h=>safestack.h \
|
---|
137 | include/openssl/seed.h=>seed.h \
|
---|
138 | include/openssl/sha.h=>sha.h \
|
---|
139 | include/openssl/srp.h=>srp.h \
|
---|
140 | include/openssl/srtp.h=>srtp.h \
|
---|
141 | include/openssl/ssl.h=>ssl.h \
|
---|
142 | include/openssl/sslerr.h=>sslerr.h \
|
---|
143 | include/openssl/ssl2.h=>ssl2.h \
|
---|
144 | include/openssl/ssl3.h=>ssl3.h \
|
---|
145 | include/openssl/stack.h=>stack.h \
|
---|
146 | include/openssl/symhacks.h=>symhacks.h \
|
---|
147 | include/openssl/tls1.h=>tls1.h \
|
---|
148 | include/openssl/ts.h=>ts.h \
|
---|
149 | include/openssl/txt_db.h=>txt_db.h \
|
---|
150 | include/openssl/ui.h=>ui.h \
|
---|
151 | include/openssl/x509.h=>x509.h \
|
---|
152 | include/openssl/x509err.h=>x509err.h \
|
---|
153 | include/openssl/x509v3.h=>x509v3.h \
|
---|
154 | include/openssl/x509v3err.h=>x509v3err.h \
|
---|
155 | include/openssl/x509_vfy.h=>x509_vfy.h
|
---|
156 |
|
---|
157 |
|
---|
158 |
|
---|
159 | #
|
---|
160 | # The templates used for the crypo lib and all its sublibraries.
|
---|
161 | #
|
---|
162 | TEMPLATE_LIBCRYPTO = Template for the OpenSSL crypto library.
|
---|
163 | TEMPLATE_LIBCRYPTO_EXTENDS = VBoxR3RuntimeDllNonPedantic
|
---|
164 | ifneq ($(KBUILD_TARGET), win)
|
---|
165 | ## @todo correct inheritance here to make it use all the VBOXR3NP settings instead of overriding all of them.
|
---|
166 | TEMPLATE_LIBCRYPTO_ASTOOL = $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_TOOL)
|
---|
167 | TEMPLATE_LIBCRYPTO_ASFLAGS = -include $(VBOX_PATH_OPENSSL)/openssl-mangling.h
|
---|
168 | TEMPLATE_LIBCRYPTO_ASFLAGS.x86 = -m32
|
---|
169 | TEMPLATE_LIBCRYPTO_ASFLAGS.amd64 = -m64
|
---|
170 | TEMPLATE_LIBCRYPTO_ASDEFS = $(NO_SUCH_VARIABLE)
|
---|
171 | TEMPLATE_LIBCRYPTO_ASDEFS.darwin = OPENSSL_MANGLE_ASM
|
---|
172 | endif
|
---|
173 |
|
---|
174 | TEMPLATE_LIBCRYPTO_DEFS = \
|
---|
175 | $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_DEFS) \
|
---|
176 | VBOX_SUFF_DLL=$(VBOX_SUFF_DLL) \
|
---|
177 | IN_RT_R3 \
|
---|
178 | DSO_NONE \
|
---|
179 | OPENSSL_USE_NODELETE \
|
---|
180 | OPENSSL_PIC \
|
---|
181 | OPENSSL_IA32_SSE2
|
---|
182 | ifdef VBOX_WITH_CRYPTO_ASM
|
---|
183 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
184 | OPENSSL_BN_ASM_MONT \
|
---|
185 | OPENSSL_BN_ASM_GF2m \
|
---|
186 | SHA1_ASM \
|
---|
187 | SHA256_ASM \
|
---|
188 | SHA512_ASM \
|
---|
189 | RC4_ASM \
|
---|
190 | MD5_ASM \
|
---|
191 | AES_ASM \
|
---|
192 | VPAES_ASM \
|
---|
193 | ECP_NISTZ256_ASM \
|
---|
194 | PADLOCK_ASM \
|
---|
195 | POLY1305_ASM
|
---|
196 | TEMPLATE_LIBCRYPTO_DEFS.amd64 = \
|
---|
197 | BSAES_ASM \
|
---|
198 | GHASH_ASM \
|
---|
199 | KECCAK1600_ASM \
|
---|
200 | OPENSSL_BN_ASM_MONT5 \
|
---|
201 | X25519_ASM
|
---|
202 | else
|
---|
203 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
204 | OPENSSL_NO_ASM
|
---|
205 | endif
|
---|
206 | if1of ($(KBUILD_TARGET), linux solaris)
|
---|
207 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
208 | _REENTRANT \
|
---|
209 | _GNU_SOURCE
|
---|
210 | endif
|
---|
211 | ifeq ($(sort $(filter -fPIC,$(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CFLAGS))),-fPIC)
|
---|
212 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
213 | OPENSSL_PIC
|
---|
214 | endif
|
---|
215 | TEMPLATE_LIBCRYPTO_DEFS.amd64 += \
|
---|
216 | MD32_REG_T=int
|
---|
217 | ifeq ($(KBUILD_TARGET),win)
|
---|
218 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
219 | OPENSSL_SYSNAME_WIN32 \
|
---|
220 | OPENSSL_RAND_SEED_OS
|
---|
221 | # Exclude WinCrypt.h, causes trouble all over the place
|
---|
222 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
223 | NOCRYPT
|
---|
224 | endif
|
---|
225 | if1of ($(KBUILD_TARGET_ARCH), x86 amd64)
|
---|
226 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
227 | L_ENDIAN
|
---|
228 | else
|
---|
229 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
230 | B_ENDIAN
|
---|
231 | endif
|
---|
232 | ifeq ($(KBUILD_TARGET),os2)
|
---|
233 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
234 | OPENSSL_NO_SECURE_MEMORY
|
---|
235 | endif
|
---|
236 | # Enable for running with valgrind:
|
---|
237 | #TEMPLATE_LIBCRYPTO_DEFS += PURIFY
|
---|
238 |
|
---|
239 | TEMPLATE_LIBCRYPTO_CFLAGS = $(filter-out $(VBOX_GCC_fvisibility-hidden),$(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CFLAGS))
|
---|
240 | TEMPLATE_LIBCRYPTO_CFLAGS.win = $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CFLAGS.win)
|
---|
241 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4305 # asn1_lib.c(455) : warning C4305: 'type cast' : truncation from 'const unsigned char *' to 'unsigned long'
|
---|
242 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4306 # tasn_new.c(338) : warning C4306: 'type cast' : conversion from 'int' to 'ASN1_VALUE *' of greater size
|
---|
243 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4701 # tasn_dec.c(840) : warning C4701: potentially uninitialized local variable 'buf' used
|
---|
244 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4101 # bn_asm.c(619) : warning C4101: 'bh' : unreferenced local variable
|
---|
245 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4206 # e_camellia.c(120) : warning C4206: nonstandard extension used : translation unit is empty
|
---|
246 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4232 # warning C4232: nonstandard extension used : 'malloc_func' : address of dllimport 'malloc' is not stati c, identity not guaranteed
|
---|
247 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4146 # x_long.c(79) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
|
---|
248 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4130 # b_addr.c(750) : warning C4130: '==' : logical operation on address of string constant
|
---|
249 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4090 # ssl_lib.c(229) : warning C4090: 'function' : different 'const' qualifiers
|
---|
250 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4310 # bss_acpt.c(223) : warning C4310: cast truncates constant value [(int)INVALID_SOCKET]
|
---|
251 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4210 # bn_exp.c(913) : warning C4210: nonstandard extension used : function given file scope
|
---|
252 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4067 # mem.c(14) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
|
---|
253 |
|
---|
254 | if1of ($(VBOX_VCC_TOOL_STEM), VCC120)
|
---|
255 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4005 # sdk\v7.1\include\sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition
|
---|
256 | endif
|
---|
257 | TEMPLATE_LIBCRYPTO_CFLAGS.freebsd = -std=gnu99
|
---|
258 |
|
---|
259 | TEMPLATE_LIBCRYPTO_INCS := \
|
---|
260 | $(VBOX_PATH_OPENSSL) \
|
---|
261 | $(VBOX_PATH_OPENSSL)/include \
|
---|
262 | $(VBOX_PATH_CRYPTO)/include \
|
---|
263 | $(VBOX_PATH_CRYPTO_MODES) \
|
---|
264 | $(VBOX_PATH_CRYPTO)/ec/curve448 \
|
---|
265 | $(VBOX_PATH_CRYPTO)/ec/curve448/arch_32 \
|
---|
266 | $(patsubst %/openssl,%,$(VBOX_PATH_CRYPTO_HEADERS))
|
---|
267 |
|
---|
268 | #TEMPLATE_LIBCRYPTO_INTERMEDIATES = $($(crypto-headers)_1_STAGE_TARGET)
|
---|
269 | TEMPLATE_LIBCRYPTO_INTERMEDIATES := \
|
---|
270 | $(foreach f,$(crypto-headers_SOURCES),$(VBOX_PATH_CRYPTO_HEADERS)/$(lastword $(subst =>, ,$(f))))
|
---|
271 |
|
---|
272 | # Same as LIBCRYPTO except that we don't install these libraries.
|
---|
273 | TEMPLATE_SUBLIBCRYPTO = Template for the OpenSSL crypto sub-libraries.
|
---|
274 | TEMPLATE_SUBLIBCRYPTO_EXTENDS = LIBCRYPTO
|
---|
275 | TEMPLATE_SUBLIBCRYPTO_INSTTYPE = none
|
---|
276 |
|
---|
277 | # Somewhat similar to LIBCRYPTO.
|
---|
278 | TEMPLATE_LIBCRYPTOTST = Template for the OpenSSL crypto testcases.
|
---|
279 | TEMPLATE_LIBCRYPTOTST_EXTENDS = VBOXR3TSTEXE
|
---|
280 | TEMPLATE_LIBCRYPTOTST_DEFS = $(TEMPLATE_VBOXR3TSTEXE_DEFS) $(filter-out $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_DEFS) IN_RT_R3,$(TEMPLATE_LIBCRYPTO_DEFS))
|
---|
281 | TEMPLATE_LIBCRYPTOTST_INCS = $(TEMPLATE_LIBCRYPTO_INCS) $(TEMPLATE_VBOXR3TSTEXE_INCS)
|
---|
282 | ifeq ($(KBUILD_TARGET),win)
|
---|
283 | TEMPLATE_LIBCRYPTOTST_CFLAGS = $(filter-out $(VBOX_VCC_WERR), $(TEMPLATE_VBOXR3TSTEXE_CXXFLAGS)) $(VBOX_VCC_NON_PEDANTIC)
|
---|
284 | else
|
---|
285 | TEMPLATE_LIBCRYPTOTST_CFLAGS = $(filter-out $(VBOX_GCC_PEDANTIC_C), $(TEMPLATE_VBOXR3TSTEXE_CFLAGS)) $(VBOX_GCC_NON_PEDANTIC_C)
|
---|
286 | endif
|
---|
287 | TEMPLATE_LIBCRYPTOTST_LIBS = $(PATH_STAGE_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB) $(TEMPLATE_VBOXR3TSTEXE_LIBS)
|
---|
288 |
|
---|
289 | #
|
---|
290 | # 32-bit version of LIBCRYPTO and SUBLIBCRYPTO.
|
---|
291 | #
|
---|
292 | TEMPLATE_VBoxLibCrypto-x86 = 32-bit template for the OpenSSL crypto library.
|
---|
293 | TEMPLATE_VBoxLibCrypto-x86_EXTENDS = LIBCRYPTO
|
---|
294 | TEMPLATE_VBoxLibCrypto-x86_BLD_TRG_ARCH = x86
|
---|
295 | TEMPLATE_VBoxLibCrypto-x86_DEFS = $(filter-out HC_ARCH_BITS%,$(TEMPLATE_LIBCRYPTO_DEFS)) HC_ARCH_BITS=32 ARCH_BITS=32
|
---|
296 |
|
---|
297 | TEMPLATE_VBoxSubLibCrypto-x86 = 32-bit template for the OpenSSL crypto sub-library.
|
---|
298 | TEMPLATE_VBoxSubLibCrypto-x86_EXTENDS = VBoxLibCrypto-x86
|
---|
299 | TEMPLATE_VBoxSubLibCrypto-x86_INSTTYPE = none
|
---|
300 |
|
---|
301 | ifdef VBOX_WITH_32_ON_64_MAIN_API # 32-bit edition.
|
---|
302 | define VBOX_OPENSSL_X86
|
---|
303 | $(eval LIBRARIES += $(1)-x86)
|
---|
304 | $(1)-x86_TEMPLATE := VBoxSubLibCrypto-x86
|
---|
305 | $(1)-x86_EXTENDS := $(1)
|
---|
306 | endef
|
---|
307 | else
|
---|
308 | define VBOX_OPENSSL_X86
|
---|
309 | endef
|
---|
310 | endif
|
---|
311 |
|
---|