1 | # $Id: Config.kmk 84230 2020-05-10 00:52:05Z vboxsync $
|
---|
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.1g
|
---|
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/cmserr.h=>cmserr.h \
|
---|
81 | include/openssl/comp.h=>comp.h \
|
---|
82 | include/openssl/comperr.h=>comperr.h \
|
---|
83 | include/openssl/conf.h=>conf.h \
|
---|
84 | include/openssl/conferr.h=>conferr.h \
|
---|
85 | include/openssl/conf_api.h=>conf_api.h \
|
---|
86 | include/openssl/crypto.h=>crypto.h \
|
---|
87 | include/openssl/cryptoerr.h=>cryptoerr.h \
|
---|
88 | include/openssl/ct.h=>ct.h \
|
---|
89 | include/openssl/cterr.h=>cterr.h \
|
---|
90 | include/openssl/des.h=>des.h \
|
---|
91 | include/openssl/dh.h=>dh.h \
|
---|
92 | include/openssl/dherr.h=>dherr.h \
|
---|
93 | include/openssl/dsa.h=>dsa.h \
|
---|
94 | include/openssl/dsaerr.h=>dsaerr.h \
|
---|
95 | include/openssl/dtls1.h=>dtls1.h \
|
---|
96 | include/openssl/ebcdic.h=>ebcdic.h \
|
---|
97 | include/openssl/ec.h=>ec.h \
|
---|
98 | include/openssl/ecerr.h=>ecerr.h \
|
---|
99 | include/openssl/ecdh.h=>ecdh.h \
|
---|
100 | include/openssl/ecdsa.h=>ecdsa.h \
|
---|
101 | include/openssl/engine.h=>engine.h \
|
---|
102 | include/openssl/err.h=>err.h \
|
---|
103 | include/openssl/evp.h=>evp.h \
|
---|
104 | include/openssl/evperr.h=>evperr.h \
|
---|
105 | include/openssl/e_os2.h=>e_os2.h \
|
---|
106 | include/openssl/hmac.h=>hmac.h \
|
---|
107 | include/openssl/idea.h=>idea.h \
|
---|
108 | include/openssl/lhash.h=>lhash.h \
|
---|
109 | include/openssl/md2.h=>md2.h \
|
---|
110 | include/openssl/md4.h=>md4.h \
|
---|
111 | include/openssl/md5.h=>md5.h \
|
---|
112 | include/openssl/mdc2.h=>mdc2.h \
|
---|
113 | include/openssl/modes.h=>modes.h \
|
---|
114 | include/openssl/objects.h=>objects.h \
|
---|
115 | include/openssl/objectserr.h=>objectserr.h \
|
---|
116 | include/openssl/obj_mac.h=>obj_mac.h \
|
---|
117 | include/openssl/ocsp.h=>ocsp.h \
|
---|
118 | include/openssl/ocsperr.h=>ocsperr.h \
|
---|
119 | openssl-mangling.h=>openssl-mangling.h \
|
---|
120 | include/openssl/opensslconf.h=>opensslconf.h \
|
---|
121 | include/openssl/opensslv.h=>opensslv.h \
|
---|
122 | include/openssl/ossl_typ.h=>ossl_typ.h \
|
---|
123 | include/openssl/pem.h=>pem.h \
|
---|
124 | include/openssl/pemerr.h=>pemerr.h \
|
---|
125 | include/openssl/pem2.h=>pem2.h \
|
---|
126 | include/openssl/pkcs12.h=>pkcs12.h \
|
---|
127 | include/openssl/pkcs12err.h=>pkcs12err.h \
|
---|
128 | include/openssl/pkcs7.h=>pkcs7.h \
|
---|
129 | include/openssl/pkcs7err.h=>pkcs7err.h \
|
---|
130 | include/openssl/rand.h=>rand.h \
|
---|
131 | include/openssl/randerr.h=>randerr.h \
|
---|
132 | include/openssl/rc2.h=>rc2.h \
|
---|
133 | include/openssl/rc4.h=>rc4.h \
|
---|
134 | include/openssl/ripemd.h=>ripemd.h \
|
---|
135 | include/openssl/rsa.h=>rsa.h \
|
---|
136 | include/openssl/rsaerr.h=>rsaerr.h \
|
---|
137 | include/openssl/safestack.h=>safestack.h \
|
---|
138 | include/openssl/seed.h=>seed.h \
|
---|
139 | include/openssl/sha.h=>sha.h \
|
---|
140 | include/openssl/srp.h=>srp.h \
|
---|
141 | include/openssl/srtp.h=>srtp.h \
|
---|
142 | include/openssl/ssl.h=>ssl.h \
|
---|
143 | include/openssl/sslerr.h=>sslerr.h \
|
---|
144 | include/openssl/ssl2.h=>ssl2.h \
|
---|
145 | include/openssl/ssl3.h=>ssl3.h \
|
---|
146 | include/openssl/stack.h=>stack.h \
|
---|
147 | include/openssl/symhacks.h=>symhacks.h \
|
---|
148 | include/openssl/tls1.h=>tls1.h \
|
---|
149 | include/openssl/ts.h=>ts.h \
|
---|
150 | include/openssl/txt_db.h=>txt_db.h \
|
---|
151 | include/openssl/ui.h=>ui.h \
|
---|
152 | include/openssl/x509.h=>x509.h \
|
---|
153 | include/openssl/x509err.h=>x509err.h \
|
---|
154 | include/openssl/x509v3.h=>x509v3.h \
|
---|
155 | include/openssl/x509v3err.h=>x509v3err.h \
|
---|
156 | include/openssl/x509_vfy.h=>x509_vfy.h
|
---|
157 |
|
---|
158 |
|
---|
159 |
|
---|
160 | #
|
---|
161 | # The templates used for the crypo lib and all its sublibraries.
|
---|
162 | #
|
---|
163 | TEMPLATE_LIBCRYPTO = Template for the OpenSSL crypto library.
|
---|
164 | TEMPLATE_LIBCRYPTO_EXTENDS = VBoxR3RuntimeDllNonPedantic
|
---|
165 | ifneq ($(KBUILD_TARGET), win)
|
---|
166 | ## @todo correct inheritance here to make it use all the VBOXR3NP settings instead of overriding all of them.
|
---|
167 | TEMPLATE_LIBCRYPTO_ASTOOL = $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_TOOL)
|
---|
168 | TEMPLATE_LIBCRYPTO_ASFLAGS = -include $(VBOX_PATH_OPENSSL)/openssl-mangling.h
|
---|
169 | TEMPLATE_LIBCRYPTO_ASFLAGS.x86 = -m32
|
---|
170 | TEMPLATE_LIBCRYPTO_ASFLAGS.amd64 = -m64
|
---|
171 | TEMPLATE_LIBCRYPTO_ASDEFS = $(NO_SUCH_VARIABLE)
|
---|
172 | TEMPLATE_LIBCRYPTO_ASDEFS.darwin = OPENSSL_MANGLE_ASM
|
---|
173 | endif
|
---|
174 |
|
---|
175 | TEMPLATE_LIBCRYPTO_DEFS = \
|
---|
176 | $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_DEFS) \
|
---|
177 | VBOX_SUFF_DLL=$(VBOX_SUFF_DLL) \
|
---|
178 | IN_RT_R3 \
|
---|
179 | DSO_NONE \
|
---|
180 | OPENSSL_USE_NODELETE \
|
---|
181 | OPENSSL_PIC \
|
---|
182 | OPENSSL_IA32_SSE2
|
---|
183 | ifdef VBOX_WITH_CRYPTO_ASM
|
---|
184 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
185 | OPENSSL_BN_ASM_MONT \
|
---|
186 | OPENSSL_BN_ASM_GF2m \
|
---|
187 | SHA1_ASM \
|
---|
188 | SHA256_ASM \
|
---|
189 | SHA512_ASM \
|
---|
190 | RC4_ASM \
|
---|
191 | MD5_ASM \
|
---|
192 | AES_ASM \
|
---|
193 | VPAES_ASM \
|
---|
194 | ECP_NISTZ256_ASM \
|
---|
195 | PADLOCK_ASM \
|
---|
196 | POLY1305_ASM
|
---|
197 | TEMPLATE_LIBCRYPTO_DEFS.amd64 = \
|
---|
198 | BSAES_ASM \
|
---|
199 | GHASH_ASM \
|
---|
200 | KECCAK1600_ASM \
|
---|
201 | OPENSSL_BN_ASM_MONT5 \
|
---|
202 | X25519_ASM
|
---|
203 | else
|
---|
204 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
205 | OPENSSL_NO_ASM
|
---|
206 | endif
|
---|
207 | if1of ($(KBUILD_TARGET), linux solaris)
|
---|
208 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
209 | _REENTRANT \
|
---|
210 | _GNU_SOURCE
|
---|
211 | endif
|
---|
212 | ifeq ($(sort $(filter -fPIC,$(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CFLAGS))),-fPIC)
|
---|
213 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
214 | OPENSSL_PIC
|
---|
215 | endif
|
---|
216 | TEMPLATE_LIBCRYPTO_DEFS.amd64 += \
|
---|
217 | MD32_REG_T=int
|
---|
218 | ifeq ($(KBUILD_TARGET),win)
|
---|
219 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
220 | OPENSSL_SYSNAME_WIN32 \
|
---|
221 | OPENSSL_RAND_SEED_OS
|
---|
222 | # Exclude WinCrypt.h, causes trouble all over the place
|
---|
223 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
224 | NOCRYPT
|
---|
225 | endif
|
---|
226 | if1of ($(KBUILD_TARGET_ARCH), x86 amd64)
|
---|
227 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
228 | L_ENDIAN
|
---|
229 | else
|
---|
230 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
231 | B_ENDIAN
|
---|
232 | endif
|
---|
233 | ifeq ($(KBUILD_TARGET),os2)
|
---|
234 | TEMPLATE_LIBCRYPTO_DEFS += \
|
---|
235 | OPENSSL_NO_SECURE_MEMORY
|
---|
236 | endif
|
---|
237 | # Enable for running with valgrind:
|
---|
238 | #TEMPLATE_LIBCRYPTO_DEFS += PURIFY
|
---|
239 |
|
---|
240 | TEMPLATE_LIBCRYPTO_CFLAGS = $(filter-out $(VBOX_GCC_fvisibility-hidden),$(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CFLAGS))
|
---|
241 | TEMPLATE_LIBCRYPTO_CFLAGS.win = $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CFLAGS.win)
|
---|
242 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4305 # asn1_lib.c(455) : warning C4305: 'type cast' : truncation from 'const unsigned char *' to 'unsigned long'
|
---|
243 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4306 # tasn_new.c(338) : warning C4306: 'type cast' : conversion from 'int' to 'ASN1_VALUE *' of greater size
|
---|
244 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4701 # tasn_dec.c(840) : warning C4701: potentially uninitialized local variable 'buf' used
|
---|
245 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4101 # bn_asm.c(619) : warning C4101: 'bh' : unreferenced local variable
|
---|
246 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4206 # e_camellia.c(120) : warning C4206: nonstandard extension used : translation unit is empty
|
---|
247 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4232 # warning C4232: nonstandard extension used : 'malloc_func' : address of dllimport 'malloc' is not stati c, identity not guaranteed
|
---|
248 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4146 # x_long.c(79) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
|
---|
249 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4130 # b_addr.c(750) : warning C4130: '==' : logical operation on address of string constant
|
---|
250 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4090 # ssl_lib.c(229) : warning C4090: 'function' : different 'const' qualifiers
|
---|
251 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4310 # bss_acpt.c(223) : warning C4310: cast truncates constant value [(int)INVALID_SOCKET]
|
---|
252 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4210 # bn_exp.c(913) : warning C4210: nonstandard extension used : function given file scope
|
---|
253 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4067 # mem.c(14) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
|
---|
254 |
|
---|
255 | if1of ($(VBOX_VCC_TOOL_STEM), VCC120)
|
---|
256 | TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4005 # sdk\v7.1\include\sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition
|
---|
257 | endif
|
---|
258 | TEMPLATE_LIBCRYPTO_CFLAGS.freebsd = -std=gnu99
|
---|
259 |
|
---|
260 | TEMPLATE_LIBCRYPTO_INCS := \
|
---|
261 | $(VBOX_PATH_OPENSSL) \
|
---|
262 | $(VBOX_PATH_OPENSSL)/include \
|
---|
263 | $(VBOX_PATH_CRYPTO)/include \
|
---|
264 | $(VBOX_PATH_CRYPTO_MODES) \
|
---|
265 | $(VBOX_PATH_CRYPTO)/ec/curve448 \
|
---|
266 | $(VBOX_PATH_CRYPTO)/ec/curve448/arch_32 \
|
---|
267 | $(patsubst %/openssl,%,$(VBOX_PATH_CRYPTO_HEADERS))
|
---|
268 |
|
---|
269 | #TEMPLATE_LIBCRYPTO_INTERMEDIATES = $($(crypto-headers)_1_STAGE_TARGET)
|
---|
270 | TEMPLATE_LIBCRYPTO_INTERMEDIATES := \
|
---|
271 | $(foreach f,$(crypto-headers_SOURCES),$(VBOX_PATH_CRYPTO_HEADERS)/$(lastword $(subst =>, ,$(f))))
|
---|
272 |
|
---|
273 | # Same as LIBCRYPTO except that we don't install these libraries.
|
---|
274 | TEMPLATE_SUBLIBCRYPTO = Template for the OpenSSL crypto sub-libraries.
|
---|
275 | TEMPLATE_SUBLIBCRYPTO_EXTENDS = LIBCRYPTO
|
---|
276 | TEMPLATE_SUBLIBCRYPTO_INSTTYPE = none
|
---|
277 |
|
---|
278 | # Somewhat similar to LIBCRYPTO.
|
---|
279 | TEMPLATE_LIBCRYPTOTST = Template for the OpenSSL crypto testcases.
|
---|
280 | TEMPLATE_LIBCRYPTOTST_EXTENDS = VBOXR3TSTEXE
|
---|
281 | TEMPLATE_LIBCRYPTOTST_DEFS = $(TEMPLATE_VBOXR3TSTEXE_DEFS) $(filter-out $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_DEFS) IN_RT_R3,$(TEMPLATE_LIBCRYPTO_DEFS))
|
---|
282 | TEMPLATE_LIBCRYPTOTST_INCS = $(TEMPLATE_LIBCRYPTO_INCS) $(TEMPLATE_VBOXR3TSTEXE_INCS)
|
---|
283 | ifeq ($(KBUILD_TARGET),win)
|
---|
284 | TEMPLATE_LIBCRYPTOTST_CFLAGS = $(filter-out $(VBOX_VCC_WERR), $(TEMPLATE_VBOXR3TSTEXE_CXXFLAGS)) $(VBOX_VCC_NON_PEDANTIC)
|
---|
285 | else
|
---|
286 | TEMPLATE_LIBCRYPTOTST_CFLAGS = $(filter-out $(VBOX_GCC_PEDANTIC_C), $(TEMPLATE_VBOXR3TSTEXE_CFLAGS)) $(VBOX_GCC_NON_PEDANTIC_C)
|
---|
287 | endif
|
---|
288 | TEMPLATE_LIBCRYPTOTST_LIBS = $(PATH_STAGE_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB) $(TEMPLATE_VBOXR3TSTEXE_LIBS)
|
---|
289 |
|
---|
290 | #
|
---|
291 | # 32-bit version of LIBCRYPTO and SUBLIBCRYPTO.
|
---|
292 | #
|
---|
293 | TEMPLATE_VBoxLibCrypto-x86 = 32-bit template for the OpenSSL crypto library.
|
---|
294 | TEMPLATE_VBoxLibCrypto-x86_EXTENDS = LIBCRYPTO
|
---|
295 | TEMPLATE_VBoxLibCrypto-x86_BLD_TRG_ARCH = x86
|
---|
296 | TEMPLATE_VBoxLibCrypto-x86_DEFS = $(filter-out HC_ARCH_BITS%,$(TEMPLATE_LIBCRYPTO_DEFS)) HC_ARCH_BITS=32 ARCH_BITS=32
|
---|
297 |
|
---|
298 | TEMPLATE_VBoxSubLibCrypto-x86 = 32-bit template for the OpenSSL crypto sub-library.
|
---|
299 | TEMPLATE_VBoxSubLibCrypto-x86_EXTENDS = VBoxLibCrypto-x86
|
---|
300 | TEMPLATE_VBoxSubLibCrypto-x86_INSTTYPE = none
|
---|
301 |
|
---|
302 | ifdef VBOX_WITH_32_ON_64_MAIN_API # 32-bit edition.
|
---|
303 | define VBOX_OPENSSL_X86
|
---|
304 | $(eval LIBRARIES += $(1)-x86)
|
---|
305 | $(1)-x86_TEMPLATE := VBoxSubLibCrypto-x86
|
---|
306 | $(1)-x86_EXTENDS := $(1)
|
---|
307 | endef
|
---|
308 | else
|
---|
309 | define VBOX_OPENSSL_X86
|
---|
310 | endef
|
---|
311 | endif
|
---|
312 |
|
---|