blob: 955352ce27aa736df9d1e61a78298c339690a925 [file] [log] [blame]
Dan Willemsen21986fb2016-07-14 15:23:56 -07001// Note that some host libraries have the same module name as the target
2// libraries. This is currently needed to build, for example, adb. But it's
3// probably something that should be changed.
4
Paul Duffincb6fdd22019-06-04 13:24:44 +01005package {
6 default_visibility: ["//visibility:private"],
7}
8
Dan Willemsen21986fb2016-07-14 15:23:56 -07009// Pull in the autogenerated sources modules
10build = ["sources.bp"]
11
12// Used by libcrypto, libssl, bssl tool, and native tests
13cc_defaults {
14 name: "boringssl_flags",
Steven Morelandf593be82017-04-14 04:51:23 -070015 vendor_available: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -070016
17 cflags: [
18 "-fvisibility=hidden",
19 "-DBORINGSSL_SHARED_LIBRARY",
David Benjaminfc8a7862018-06-25 19:02:46 -040020 "-DBORINGSSL_ANDROID_SYSTEM",
Dan Willemsen21986fb2016-07-14 15:23:56 -070021 "-DOPENSSL_SMALL",
22 "-D_XOPEN_SOURCE=700",
Chih-Hung Hsieh9146d992017-09-27 10:26:03 -070023 "-Werror",
Dan Willemsen21986fb2016-07-14 15:23:56 -070024 "-Wno-unused-parameter",
25 ],
26
27 cppflags: [
28 "-Wall",
29 "-Werror",
30 ],
31
32 conlyflags: ["-std=c99"],
David Benjaminfc8a7862018-06-25 19:02:46 -040033
34 // Build BoringSSL and its tests against the same STL.
35 sdk_version: "9",
36 target: {
37 android: {
38 stl: "libc++_static",
39 },
40 },
Dan Willemsen21986fb2016-07-14 15:23:56 -070041}
42
43// Used by libcrypto + libssl
44cc_defaults {
45 name: "boringssl_defaults",
46
47 local_include_dirs: ["src/include"],
48 export_include_dirs: ["src/include"],
David Benjaminfc8a7862018-06-25 19:02:46 -040049 cflags: ["-DBORINGSSL_IMPLEMENTATION"],
Dan Willemsen21986fb2016-07-14 15:23:56 -070050}
51
52//// libcrypto
Dan Willemsen21986fb2016-07-14 15:23:56 -070053cc_defaults {
54 name: "libcrypto_defaults",
55 host_supported: true,
56
57 // Windows and Macs both have problems with assembly files
58 target: {
59 windows: {
60 enabled: true,
61 cflags: ["-DOPENSSL_NO_ASM"],
62 host_ldlibs: ["-lws2_32"],
63 },
64 darwin: {
65 cflags: ["-DOPENSSL_NO_ASM"],
66 },
Kenny Root7b550be2016-09-20 15:25:24 -070067 host: {
Dan Willemsen21986fb2016-07-14 15:23:56 -070068 host_ldlibs: ["-lpthread"],
69 },
Pete Bentley1e9e5852020-06-30 16:45:33 +010070 android: {
71 // On FIPS builds (i.e. Android only) prevent other libraries
72 // from pre-empting symbols in libcrypto which could affect FIPS
73 // compliance and cause integrity checks to fail. See b/160231064.
74 ldflags: ["-Wl,-Bsymbolic"],
75 },
Dan Willemsen21986fb2016-07-14 15:23:56 -070076 },
77
78 local_include_dirs: ["src/crypto"],
Pete Bentleye6a478a2019-08-19 22:20:24 +010079}
80
81cc_object {
82 name: "bcm_object",
83 device_supported: true,
84 recovery_available: true,
85 native_bridge_supported: true,
86 defaults: [
87 "libcrypto_bcm_sources",
88 "libcrypto_defaults",
89 "boringssl_defaults",
90 "boringssl_flags",
91 ],
Peter Collingbourne22f5f872019-09-27 15:32:38 -070092 sanitize: {
93 address: false,
Tobias Thierer6204b542019-10-18 21:55:05 +010094 hwaddress: false,
Mitch Phillipsf5a60782019-12-10 08:47:30 -080095 fuzzer: false,
Peter Collingbourne22f5f872019-09-27 15:32:38 -070096 },
Pete Bentleye6a478a2019-08-19 22:20:24 +010097 target: {
Martin Stjernholmba9db872020-07-16 03:52:16 +010098 linux_bionic: {
Martin Stjernholmd6888902020-04-08 01:02:41 +010099 header_libs: ["libc_headers"], // TODO(b/153662223): Clean this up.
100 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100101 android: {
Martin Stjernholmd6888902020-04-08 01:02:41 +0100102 header_libs: ["libc_headers"], // TODO(b/153662223): Clean this up.
Pete Bentleye6a478a2019-08-19 22:20:24 +0100103 cflags: [
104 "-DBORINGSSL_FIPS",
105 "-fPIC",
Pete Bentley1d07cf82019-10-18 12:49:31 +0100106 // -fno[data|text]-sections required to ensure a
107 // single text and data section for FIPS integrity check
108 "-fno-data-sections",
109 "-fno-function-sections",
Pete Bentleye6a478a2019-08-19 22:20:24 +0100110 ],
111 linker_script: "src/crypto/fipsmodule/fips_shared.lds",
112 },
Peter Collingbourne0560ada2019-11-22 13:50:29 -0800113 // Temporary hack to let BoringSSL build with a new compiler.
114 // This doesn't enable HWASAN unconditionally, it just causes
115 // BoringSSL's asm code to unconditionally use a HWASAN-compatible
116 // global variable reference so that the non-HWASANified (because of
117 // sanitize: { hwaddress: false } above) code in the BCM can
118 // successfully link against the HWASANified code in the rest of
119 // BoringSSL in HWASAN builds.
120 android_arm64: {
121 asflags: [
122 "-fsanitize=hwaddress",
123 ],
124 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100125 },
Jiyong Park0dcd4e82020-03-09 15:23:05 +0900126 apex_available: [
127 "//apex_available:platform",
128 "com.android.adbd",
129 "com.android.art.debug",
130 "com.android.art.release",
131 "com.android.art.testing",
132 "com.android.bluetooth.updatable",
133 "com.android.conscrypt",
134 "com.android.media",
135 "com.android.resolv",
136 ],
Jooyung Han856ad1d2020-04-16 18:48:25 +0900137 min_sdk_version: "29",
Pete Bentleye6a478a2019-08-19 22:20:24 +0100138}
139
140bootstrap_go_package {
141 name: "bssl_ar",
142 pkgPath: "boringssl.googlesource.com/boringssl/util/ar",
143 srcs: [
144 "src/util/ar/ar.go",
145 ],
146 testSrcs: [
147 "src/util/ar/ar_test.go",
148 ],
149}
150
151bootstrap_go_package {
152 name: "bssl_fipscommon",
153 pkgPath: "boringssl.googlesource.com/boringssl/util/fipstools/fipscommon",
154 srcs: [
155 "src/util/fipstools/fipscommon/const.go",
156 ],
157}
158
159blueprint_go_binary {
160 name: "bssl_inject_hash",
161 srcs: [
162 "src/util/fipstools/inject_hash/inject_hash.go",
163 ],
164 deps: [
165 "bssl_ar",
166 "bssl_fipscommon",
167 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700168}
169
170// Target and host library
171cc_library {
172 name: "libcrypto",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100173 visibility: ["//visibility:public"],
Vijay Venkatraman3caad952017-05-16 12:00:57 -0700174 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200175 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900176 vndk: {
177 enabled: true,
178 },
Jooyung Hanb6b07c32019-01-18 15:31:20 +0900179 double_loadable: true,
Jiyong Parkc3463952018-04-27 21:44:32 +0900180 recovery_available: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100181 defaults: [
182 "libcrypto_sources",
183 "libcrypto_defaults",
184 "boringssl_defaults",
185 "boringssl_flags",
186 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700187 unique_host_soname: true,
Pete Bentleye6a478a2019-08-19 22:20:24 +0100188 srcs: [
189 ":bcm_object",
190 ],
191 target: {
192 android: {
193 cflags: [
194 "-DBORINGSSL_FIPS",
195 ],
Pete Bentleye0c3f632020-05-06 19:52:29 +0100196 sanitize: {
197 // Disable address sanitizing otherwise libcrypto will not report
198 // itself as being in FIPS mode, which causes boringssl_self_test
199 // to fail.
200 address: false,
201 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100202 inject_bssl_hash: true,
Colin Cross4b979db2019-09-18 11:20:16 -0700203 static: {
204 // Disable the static version of libcrypto, as it causes
205 // problems for FIPS certification. Use libcrypto_static for
206 // modules that need static libcrypto but do not need FIPS self
207 // testing, or use dynamic libcrypto.
208 enabled: false,
209 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100210 },
211 },
Joshua Duong26b57e22020-02-10 16:04:44 -0800212 apex_available: [
213 "//apex_available:platform",
214 "com.android.adbd",
Jiyong Park0dcd4e82020-03-09 15:23:05 +0900215 "com.android.art.debug",
216 "com.android.art.release",
217 "com.android.art.testing",
218 "com.android.bluetooth.updatable",
219 "com.android.conscrypt",
220 "com.android.media",
221 "com.android.resolv",
Joshua Duong26b57e22020-02-10 16:04:44 -0800222 ],
Jooyung Han856ad1d2020-04-16 18:48:25 +0900223 min_sdk_version: "29",
Dan Willemsen21986fb2016-07-14 15:23:56 -0700224}
225
226// Static library
Colin Cross4b979db2019-09-18 11:20:16 -0700227// This version of libcrypto will not have FIPS self tests enabled, so its
228// usage is protected through visibility to ensure it doesn't end up used
229// somewhere that needs the FIPS version.
Dan Willemsen21986fb2016-07-14 15:23:56 -0700230cc_library_static {
231 name: "libcrypto_static",
Colin Cross4b979db2019-09-18 11:20:16 -0700232 visibility: [
Paul Duffinebdc4062020-01-22 14:29:01 +0000233 "//art/build/sdk",
Colin Cross4b979db2019-09-18 11:20:16 -0700234 "//bootable/recovery/updater",
235 "//external/conscrypt",
236 "//external/python/cpython2",
Elliott Hughes77319d02020-05-14 15:51:34 -0700237 // Strictly, only the *static* toybox for legacy devices should have
238 // access to libcrypto_static, but we can't express that.
239 "//external/toybox",
Przemyslaw Szczepaniak243d9d52020-02-03 13:38:45 +0000240 "//frameworks/ml/nn:__subpackages__",
Colin Cross4b979db2019-09-18 11:20:16 -0700241 "//hardware/interfaces/confirmationui/1.0/vts/functional",
242 "//hardware/interfaces/drm/1.0/vts/functional",
243 "//hardware/interfaces/drm/1.2/vts/functional",
Robert Shih6526b5c2020-01-21 11:03:32 -0800244 "//hardware/interfaces/drm/1.3/vts/functional",
Colin Cross4b979db2019-09-18 11:20:16 -0700245 "//hardware/interfaces/keymaster/3.0/vts/functional",
246 "//hardware/interfaces/keymaster/4.0/vts/functional",
Shawn Willden1ff77d02020-01-16 23:52:56 -0700247 "//hardware/interfaces/keymaster/4.1/vts/functional",
Luke Huang16a30fc2019-11-22 11:44:50 +0800248 "//packages/modules/DnsResolver/tests:__subpackages__",
Colin Cross4b979db2019-09-18 11:20:16 -0700249 "//system/core/adb",
250 "//system/core/init",
251 "//system/core/fs_mgr/liblp",
252 "//system/core/fs_mgr/liblp/vts_core",
253 "//system/core/fs_mgr/libsnapshot",
254 "//system/libvintf/test",
255 "//system/security/keystore/tests",
256 "//test/vts-testcase/security/avb",
257 ],
Przemyslaw Szczepaniakdab438a2020-02-05 17:33:41 +0000258 apex_available: [
259 "//apex_available:platform",
260 "com.android.neuralnetworks",
Przemyslaw Szczepaniakdab438a2020-02-05 17:33:41 +0000261 ],
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100262 defaults: [
Pete Bentley47637342019-08-19 12:22:49 +0100263 "libcrypto_bcm_sources",
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100264 "libcrypto_sources",
265 "libcrypto_defaults",
266 "boringssl_defaults",
267 "boringssl_flags",
268 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700269}
270
Dan Willemsen21986fb2016-07-14 15:23:56 -0700271//// libssl
272
273// Target static library
Dan Willemsen21986fb2016-07-14 15:23:56 -0700274
275// Static and Shared library
276cc_library {
277 name: "libssl",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100278 visibility: ["//visibility:public"],
Dan Willemsenea55e182018-10-23 13:41:19 -0700279 recovery_available: true,
Justin Yun47949c52017-07-24 15:19:43 +0900280 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200281 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900282 vndk: {
283 enabled: true,
284 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700285 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100286 defaults: [
287 "libssl_sources",
288 "boringssl_defaults",
289 "boringssl_flags",
290 ],
Joshua Duong81ce7a52019-10-31 12:44:47 -0700291 target: {
292 windows: {
293 enabled: true,
294 },
295 },
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700296 unique_host_soname: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -0700297
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700298 shared_libs: ["libcrypto"],
Joshua Duong26b57e22020-02-10 16:04:44 -0800299
300 apex_available: [
301 "//apex_available:platform",
302 "com.android.adbd",
Jiyong Park0dcd4e82020-03-09 15:23:05 +0900303 "com.android.conscrypt",
304 "com.android.resolv",
Joshua Duong26b57e22020-02-10 16:04:44 -0800305 ],
Jooyung Han856ad1d2020-04-16 18:48:25 +0900306 min_sdk_version: "29",
Dan Willemsen21986fb2016-07-14 15:23:56 -0700307}
308
Dan Willemsen21986fb2016-07-14 15:23:56 -0700309// Tool
310cc_binary {
311 name: "bssl",
312 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100313 defaults: [
314 "bssl_sources",
315 "boringssl_flags",
316 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700317
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700318 shared_libs: [
319 "libcrypto",
320 "libssl",
321 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700322 target: {
Dan Willemsen21986fb2016-07-14 15:23:56 -0700323 darwin: {
324 enabled: false,
325 },
Pete Bentleyd7165532020-05-14 12:01:03 +0100326 android: {
327 compile_multilib: "both",
328 },
329 },
330 multilib: {
331 lib32: {
332 suffix: "32",
333 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700334 },
335}
Dan Willemsen2458a412016-07-15 09:28:31 -0700336
Adam Langley7c167932018-02-02 14:44:53 -0800337cc_binary {
338 name: "cavp",
339 host_supported: true,
340 srcs: [
Pete Bentley0c61efe2019-08-13 09:32:23 +0100341 "src/util/fipstools/cavp/cavp_aes_gcm_test.cc",
342 "src/util/fipstools/cavp/cavp_aes_test.cc",
343 "src/util/fipstools/cavp/cavp_ctr_drbg_test.cc",
344 "src/util/fipstools/cavp/cavp_ecdsa2_keypair_test.cc",
345 "src/util/fipstools/cavp/cavp_ecdsa2_pkv_test.cc",
346 "src/util/fipstools/cavp/cavp_ecdsa2_siggen_test.cc",
347 "src/util/fipstools/cavp/cavp_ecdsa2_sigver_test.cc",
348 "src/util/fipstools/cavp/cavp_hmac_test.cc",
349 "src/util/fipstools/cavp/cavp_kas_test.cc",
350 "src/util/fipstools/cavp/cavp_keywrap_test.cc",
351 "src/util/fipstools/cavp/cavp_main.cc",
352 "src/util/fipstools/cavp/cavp_rsa2_keygen_test.cc",
353 "src/util/fipstools/cavp/cavp_rsa2_siggen_test.cc",
354 "src/util/fipstools/cavp/cavp_rsa2_sigver_test.cc",
355 "src/util/fipstools/cavp/cavp_sha_monte_test.cc",
356 "src/util/fipstools/cavp/cavp_sha_test.cc",
357 "src/util/fipstools/cavp/cavp_tdes_test.cc",
358 "src/util/fipstools/cavp/cavp_test_util.cc",
359 "src/util/fipstools/cavp/cavp_tlskdf_test.cc",
Adam Langley7c167932018-02-02 14:44:53 -0800360 ],
Pete Bentleyd7165532020-05-14 12:01:03 +0100361 target: {
362 android: {
363 compile_multilib: "both",
364 },
365 },
366 multilib: {
367 lib32: {
368 suffix: "32",
369 },
370 },
Adam Langley7c167932018-02-02 14:44:53 -0800371
372 shared_libs: [
373 "libcrypto",
374 ],
375
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100376 defaults: [
377 "boringssl_test_support_sources",
378 "boringssl_flags",
379 ],
Adam Langley7c167932018-02-02 14:44:53 -0800380}
381
Dan Willemsen2458a412016-07-15 09:28:31 -0700382// Test support library
383cc_library_static {
384 name: "boringssl_test_support",
385 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100386 defaults: [
387 "boringssl_test_support_sources",
388 "boringssl_flags",
389 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700390
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700391 shared_libs: [
392 "libcrypto",
393 "libssl",
394 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700395}
396
397// Tests
398cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100399 name: "boringssl_crypto_test",
400 test_suites: ["device-tests"],
401 host_supported: true,
402 defaults: [
403 "boringssl_crypto_test_sources",
404 "boringssl_flags",
405 ],
406 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500407
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100408 shared_libs: ["libcrypto"],
David Benjaminf31229b2017-01-25 14:08:15 -0500409}
410
411cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100412 name: "boringssl_ssl_test",
413 test_suites: ["device-tests"],
414 host_supported: true,
415 defaults: [
416 "boringssl_ssl_test_sources",
417 "boringssl_flags",
418 ],
419 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500420
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100421 shared_libs: [
422 "libcrypto",
423 "libssl",
424 ],
David Benjaminf31229b2017-01-25 14:08:15 -0500425}
Adam Langleyb6f75152019-10-18 12:20:11 -0700426
427// Utility binary for CMVP on-site testing.
428cc_binary {
Tobias Thierer6204b542019-10-18 21:55:05 +0100429 name: "test_fips",
430 host_supported: false,
431 defaults: [
432 "boringssl_flags",
433 ],
434 shared_libs: [
435 "libcrypto",
436 ],
437 srcs: [
438 "src/util/fipstools/cavp/test_fips.c",
439 ],
Adam Langleyb6f75152019-10-18 12:20:11 -0700440}