blob: 0ea1c9a848ace275f8c11066e63c4921dbcfc812 [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"],
Bob Badourb313bb52021-02-12 15:33:59 -08007 default_applicable_licenses: ["external_boringssl_license"],
8}
9
10// Added automatically by a large-scale-change that took the approach of
11// 'apply every license found to every target'. While this makes sure we respect
12// every license restriction, it may not be entirely correct.
13//
14// e.g. GPL in an MIT project might only apply to the contrib/ directory.
15//
16// Please consider splitting the single license below into multiple licenses,
17// taking care not to lose any license_kind information, and overriding the
18// default license using the 'licenses: [...]' property on targets as needed.
19//
20// For unused files, consider creating a 'fileGroup' with "//visibility:private"
21// to attach the license to, and including a comment whether the files may be
22// used in the current project.
23// See: http://go/android-license-faq
24license {
25 name: "external_boringssl_license",
26 visibility: [":__subpackages__"],
27 license_kinds: [
28 "SPDX-license-identifier-Apache-2.0",
29 "SPDX-license-identifier-BSD",
30 "SPDX-license-identifier-ISC",
31 "SPDX-license-identifier-MIT",
32 "SPDX-license-identifier-OpenSSL",
33 "legacy_unencumbered",
34 ],
35 license_text: [
36 "NOTICE",
37 ],
Paul Duffincb6fdd22019-06-04 13:24:44 +010038}
39
Dan Willemsen21986fb2016-07-14 15:23:56 -070040// Pull in the autogenerated sources modules
41build = ["sources.bp"]
42
43// Used by libcrypto, libssl, bssl tool, and native tests
44cc_defaults {
45 name: "boringssl_flags",
Steven Morelandf593be82017-04-14 04:51:23 -070046 vendor_available: true,
Justin Yun56083292020-11-11 15:43:11 +090047 product_available: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -070048
49 cflags: [
50 "-fvisibility=hidden",
51 "-DBORINGSSL_SHARED_LIBRARY",
David Benjaminfc8a7862018-06-25 19:02:46 -040052 "-DBORINGSSL_ANDROID_SYSTEM",
Dan Willemsen21986fb2016-07-14 15:23:56 -070053 "-DOPENSSL_SMALL",
54 "-D_XOPEN_SOURCE=700",
Chih-Hung Hsieh9146d992017-09-27 10:26:03 -070055 "-Werror",
Dan Willemsen21986fb2016-07-14 15:23:56 -070056 "-Wno-unused-parameter",
57 ],
58
59 cppflags: [
60 "-Wall",
61 "-Werror",
62 ],
63
64 conlyflags: ["-std=c99"],
David Benjaminfc8a7862018-06-25 19:02:46 -040065
66 // Build BoringSSL and its tests against the same STL.
67 sdk_version: "9",
68 target: {
69 android: {
70 stl: "libc++_static",
71 },
72 },
Dan Willemsen21986fb2016-07-14 15:23:56 -070073}
74
75// Used by libcrypto + libssl
76cc_defaults {
77 name: "boringssl_defaults",
78
79 local_include_dirs: ["src/include"],
80 export_include_dirs: ["src/include"],
David Benjaminfc8a7862018-06-25 19:02:46 -040081 cflags: ["-DBORINGSSL_IMPLEMENTATION"],
Dan Willemsen21986fb2016-07-14 15:23:56 -070082}
83
84//// libcrypto
Dan Willemsen21986fb2016-07-14 15:23:56 -070085cc_defaults {
86 name: "libcrypto_defaults",
87 host_supported: true,
Yifan Hongca6b4e82020-10-21 18:11:12 -070088 ramdisk_available: true,
89 vendor_ramdisk_available: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -070090
91 // Windows and Macs both have problems with assembly files
92 target: {
93 windows: {
94 enabled: true,
95 cflags: ["-DOPENSSL_NO_ASM"],
96 host_ldlibs: ["-lws2_32"],
97 },
98 darwin: {
99 cflags: ["-DOPENSSL_NO_ASM"],
100 },
Kenny Root7b550be2016-09-20 15:25:24 -0700101 host: {
Dan Willemsen21986fb2016-07-14 15:23:56 -0700102 host_ldlibs: ["-lpthread"],
103 },
Pete Bentley1e9e5852020-06-30 16:45:33 +0100104 android: {
105 // On FIPS builds (i.e. Android only) prevent other libraries
106 // from pre-empting symbols in libcrypto which could affect FIPS
107 // compliance and cause integrity checks to fail. See b/160231064.
108 ldflags: ["-Wl,-Bsymbolic"],
109 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700110 },
111
112 local_include_dirs: ["src/crypto"],
Pete Bentleye6a478a2019-08-19 22:20:24 +0100113}
114
115cc_object {
116 name: "bcm_object",
117 device_supported: true,
118 recovery_available: true,
119 native_bridge_supported: true,
120 defaults: [
121 "libcrypto_bcm_sources",
122 "libcrypto_defaults",
123 "boringssl_defaults",
124 "boringssl_flags",
125 ],
Peter Collingbourne22f5f872019-09-27 15:32:38 -0700126 sanitize: {
127 address: false,
Tobias Thierer6204b542019-10-18 21:55:05 +0100128 hwaddress: false,
Mitch Phillipsf5a60782019-12-10 08:47:30 -0800129 fuzzer: false,
Peter Collingbourne22f5f872019-09-27 15:32:38 -0700130 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100131 target: {
Martin Stjernholmba9db872020-07-16 03:52:16 +0100132 linux_bionic: {
Martin Stjernholmd6888902020-04-08 01:02:41 +0100133 header_libs: ["libc_headers"], // TODO(b/153662223): Clean this up.
134 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100135 android: {
Martin Stjernholmd6888902020-04-08 01:02:41 +0100136 header_libs: ["libc_headers"], // TODO(b/153662223): Clean this up.
Pete Bentleye6a478a2019-08-19 22:20:24 +0100137 cflags: [
138 "-DBORINGSSL_FIPS",
139 "-fPIC",
Pete Bentley1d07cf82019-10-18 12:49:31 +0100140 // -fno[data|text]-sections required to ensure a
141 // single text and data section for FIPS integrity check
142 "-fno-data-sections",
143 "-fno-function-sections",
Pete Bentleye6a478a2019-08-19 22:20:24 +0100144 ],
145 linker_script: "src/crypto/fipsmodule/fips_shared.lds",
146 },
Peter Collingbourne0560ada2019-11-22 13:50:29 -0800147 // Temporary hack to let BoringSSL build with a new compiler.
148 // This doesn't enable HWASAN unconditionally, it just causes
149 // BoringSSL's asm code to unconditionally use a HWASAN-compatible
150 // global variable reference so that the non-HWASANified (because of
151 // sanitize: { hwaddress: false } above) code in the BCM can
152 // successfully link against the HWASANified code in the rest of
153 // BoringSSL in HWASAN builds.
154 android_arm64: {
155 asflags: [
156 "-fsanitize=hwaddress",
157 ],
158 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100159 },
Jiyong Park0dcd4e82020-03-09 15:23:05 +0900160 apex_available: [
161 "//apex_available:platform",
162 "com.android.adbd",
Martin Stjernholm98b03622020-10-12 15:10:40 +0100163 "com.android.art",
Jiyong Park0dcd4e82020-03-09 15:23:05 +0900164 "com.android.art.debug",
Jiyong Park0dcd4e82020-03-09 15:23:05 +0900165 "com.android.art.testing",
166 "com.android.bluetooth.updatable",
167 "com.android.conscrypt",
168 "com.android.media",
169 "com.android.resolv",
Jiyong Park16f7c572021-01-05 14:41:56 +0900170 "com.android.virt",
Jiyong Park0dcd4e82020-03-09 15:23:05 +0900171 ],
Jooyung Han856ad1d2020-04-16 18:48:25 +0900172 min_sdk_version: "29",
Pete Bentleye6a478a2019-08-19 22:20:24 +0100173}
174
175bootstrap_go_package {
176 name: "bssl_ar",
177 pkgPath: "boringssl.googlesource.com/boringssl/util/ar",
178 srcs: [
179 "src/util/ar/ar.go",
180 ],
181 testSrcs: [
182 "src/util/ar/ar_test.go",
183 ],
184}
185
186bootstrap_go_package {
187 name: "bssl_fipscommon",
188 pkgPath: "boringssl.googlesource.com/boringssl/util/fipstools/fipscommon",
189 srcs: [
190 "src/util/fipstools/fipscommon/const.go",
191 ],
192}
193
194blueprint_go_binary {
195 name: "bssl_inject_hash",
196 srcs: [
197 "src/util/fipstools/inject_hash/inject_hash.go",
198 ],
199 deps: [
200 "bssl_ar",
201 "bssl_fipscommon",
202 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700203}
204
205// Target and host library
206cc_library {
207 name: "libcrypto",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100208 visibility: ["//visibility:public"],
Vijay Venkatraman3caad952017-05-16 12:00:57 -0700209 vendor_available: true,
Justin Yun56083292020-11-11 15:43:11 +0900210 product_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200211 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900212 vndk: {
213 enabled: true,
214 },
Jooyung Hanb6b07c32019-01-18 15:31:20 +0900215 double_loadable: true,
Jiyong Parkc3463952018-04-27 21:44:32 +0900216 recovery_available: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100217 defaults: [
218 "libcrypto_sources",
219 "libcrypto_defaults",
220 "boringssl_defaults",
221 "boringssl_flags",
222 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700223 unique_host_soname: true,
Pete Bentleye6a478a2019-08-19 22:20:24 +0100224 srcs: [
225 ":bcm_object",
226 ],
227 target: {
228 android: {
229 cflags: [
230 "-DBORINGSSL_FIPS",
231 ],
Pete Bentleye0c3f632020-05-06 19:52:29 +0100232 sanitize: {
233 // Disable address sanitizing otherwise libcrypto will not report
234 // itself as being in FIPS mode, which causes boringssl_self_test
235 // to fail.
236 address: false,
237 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100238 inject_bssl_hash: true,
Colin Cross4b979db2019-09-18 11:20:16 -0700239 static: {
240 // Disable the static version of libcrypto, as it causes
241 // problems for FIPS certification. Use libcrypto_static for
242 // modules that need static libcrypto but do not need FIPS self
243 // testing, or use dynamic libcrypto.
244 enabled: false,
245 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100246 },
247 },
Joshua Duong26b57e22020-02-10 16:04:44 -0800248 apex_available: [
249 "//apex_available:platform",
250 "com.android.adbd",
Martin Stjernholm98b03622020-10-12 15:10:40 +0100251 "com.android.art",
Jiyong Park0dcd4e82020-03-09 15:23:05 +0900252 "com.android.art.debug",
Jiyong Park0dcd4e82020-03-09 15:23:05 +0900253 "com.android.art.testing",
254 "com.android.bluetooth.updatable",
255 "com.android.conscrypt",
256 "com.android.media",
257 "com.android.resolv",
Jiyong Park16f7c572021-01-05 14:41:56 +0900258 "com.android.virt",
Joshua Duong26b57e22020-02-10 16:04:44 -0800259 ],
Jooyung Han856ad1d2020-04-16 18:48:25 +0900260 min_sdk_version: "29",
Dan Willemsen21986fb2016-07-14 15:23:56 -0700261}
262
263// Static library
Colin Cross4b979db2019-09-18 11:20:16 -0700264// This version of libcrypto will not have FIPS self tests enabled, so its
265// usage is protected through visibility to ensure it doesn't end up used
266// somewhere that needs the FIPS version.
Dan Willemsen21986fb2016-07-14 15:23:56 -0700267cc_library_static {
268 name: "libcrypto_static",
Colin Cross4b979db2019-09-18 11:20:16 -0700269 visibility: [
Paul Duffinebdc4062020-01-22 14:29:01 +0000270 "//art/build/sdk",
Colin Cross4b979db2019-09-18 11:20:16 -0700271 "//bootable/recovery/updater",
272 "//external/conscrypt",
273 "//external/python/cpython2",
Elliott Hughes77319d02020-05-14 15:51:34 -0700274 // Strictly, only the *static* toybox for legacy devices should have
275 // access to libcrypto_static, but we can't express that.
276 "//external/toybox",
Colin Cross4b979db2019-09-18 11:20:16 -0700277 "//hardware/interfaces/confirmationui/1.0/vts/functional",
278 "//hardware/interfaces/drm/1.0/vts/functional",
279 "//hardware/interfaces/drm/1.2/vts/functional",
Robert Shih6526b5c2020-01-21 11:03:32 -0800280 "//hardware/interfaces/drm/1.3/vts/functional",
Colin Cross4b979db2019-09-18 11:20:16 -0700281 "//hardware/interfaces/keymaster/3.0/vts/functional",
282 "//hardware/interfaces/keymaster/4.0/vts/functional",
Shawn Willden1ff77d02020-01-16 23:52:56 -0700283 "//hardware/interfaces/keymaster/4.1/vts/functional",
Luke Huang16a30fc2019-11-22 11:44:50 +0800284 "//packages/modules/DnsResolver/tests:__subpackages__",
Baligh Uddinf58f8702020-11-24 05:58:10 +0000285 "//packages/modules/NeuralNetworks:__subpackages__",
Colin Cross4b979db2019-09-18 11:20:16 -0700286 "//system/core/adb",
287 "//system/core/init",
288 "//system/core/fs_mgr/liblp",
289 "//system/core/fs_mgr/liblp/vts_core",
290 "//system/core/fs_mgr/libsnapshot",
291 "//system/libvintf/test",
292 "//system/security/keystore/tests",
293 "//test/vts-testcase/security/avb",
294 ],
Przemyslaw Szczepaniakdab438a2020-02-05 17:33:41 +0000295 apex_available: [
296 "//apex_available:platform",
297 "com.android.neuralnetworks",
Przemyslaw Szczepaniakdab438a2020-02-05 17:33:41 +0000298 ],
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100299 defaults: [
Pete Bentley47637342019-08-19 12:22:49 +0100300 "libcrypto_bcm_sources",
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100301 "libcrypto_sources",
302 "libcrypto_defaults",
303 "boringssl_defaults",
304 "boringssl_flags",
305 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700306}
307
Dan Willemsen21986fb2016-07-14 15:23:56 -0700308//// libssl
309
310// Target static library
Dan Willemsen21986fb2016-07-14 15:23:56 -0700311
312// Static and Shared library
313cc_library {
314 name: "libssl",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100315 visibility: ["//visibility:public"],
Dan Willemsenea55e182018-10-23 13:41:19 -0700316 recovery_available: true,
Justin Yun47949c52017-07-24 15:19:43 +0900317 vendor_available: true,
Justin Yun56083292020-11-11 15:43:11 +0900318 product_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200319 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900320 vndk: {
321 enabled: true,
322 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700323 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100324 defaults: [
325 "libssl_sources",
326 "boringssl_defaults",
327 "boringssl_flags",
328 ],
Joshua Duong81ce7a52019-10-31 12:44:47 -0700329 target: {
330 windows: {
331 enabled: true,
332 },
333 },
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700334 unique_host_soname: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -0700335
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700336 shared_libs: ["libcrypto"],
Joshua Duong26b57e22020-02-10 16:04:44 -0800337
338 apex_available: [
339 "//apex_available:platform",
340 "com.android.adbd",
Jiyong Park0dcd4e82020-03-09 15:23:05 +0900341 "com.android.conscrypt",
342 "com.android.resolv",
Joshua Duong26b57e22020-02-10 16:04:44 -0800343 ],
Jooyung Han856ad1d2020-04-16 18:48:25 +0900344 min_sdk_version: "29",
Dan Willemsen21986fb2016-07-14 15:23:56 -0700345}
346
Dan Willemsen21986fb2016-07-14 15:23:56 -0700347// Tool
348cc_binary {
349 name: "bssl",
350 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100351 defaults: [
352 "bssl_sources",
353 "boringssl_flags",
354 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700355
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700356 shared_libs: [
357 "libcrypto",
358 "libssl",
359 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700360 target: {
Dan Willemsen21986fb2016-07-14 15:23:56 -0700361 darwin: {
362 enabled: false,
363 },
Pete Bentleyd7165532020-05-14 12:01:03 +0100364 android: {
365 compile_multilib: "both",
366 },
367 },
368 multilib: {
369 lib32: {
370 suffix: "32",
371 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700372 },
373}
Dan Willemsen2458a412016-07-15 09:28:31 -0700374
Pete Bentley390f5872020-12-10 11:19:10 +0000375// Used for CAVP testing for FIPS certification.
376// Not installed on devices by default.
Adam Langley7c167932018-02-02 14:44:53 -0800377cc_binary {
378 name: "cavp",
379 host_supported: true,
380 srcs: [
Pete Bentley0c61efe2019-08-13 09:32:23 +0100381 "src/util/fipstools/cavp/cavp_aes_gcm_test.cc",
382 "src/util/fipstools/cavp/cavp_aes_test.cc",
383 "src/util/fipstools/cavp/cavp_ctr_drbg_test.cc",
384 "src/util/fipstools/cavp/cavp_ecdsa2_keypair_test.cc",
385 "src/util/fipstools/cavp/cavp_ecdsa2_pkv_test.cc",
386 "src/util/fipstools/cavp/cavp_ecdsa2_siggen_test.cc",
387 "src/util/fipstools/cavp/cavp_ecdsa2_sigver_test.cc",
388 "src/util/fipstools/cavp/cavp_hmac_test.cc",
389 "src/util/fipstools/cavp/cavp_kas_test.cc",
390 "src/util/fipstools/cavp/cavp_keywrap_test.cc",
391 "src/util/fipstools/cavp/cavp_main.cc",
392 "src/util/fipstools/cavp/cavp_rsa2_keygen_test.cc",
393 "src/util/fipstools/cavp/cavp_rsa2_siggen_test.cc",
394 "src/util/fipstools/cavp/cavp_rsa2_sigver_test.cc",
395 "src/util/fipstools/cavp/cavp_sha_monte_test.cc",
396 "src/util/fipstools/cavp/cavp_sha_test.cc",
397 "src/util/fipstools/cavp/cavp_tdes_test.cc",
398 "src/util/fipstools/cavp/cavp_test_util.cc",
399 "src/util/fipstools/cavp/cavp_tlskdf_test.cc",
Adam Langley7c167932018-02-02 14:44:53 -0800400 ],
Pete Bentleyd7165532020-05-14 12:01:03 +0100401 target: {
402 android: {
403 compile_multilib: "both",
404 },
405 },
406 multilib: {
407 lib32: {
408 suffix: "32",
409 },
410 },
Adam Langley7c167932018-02-02 14:44:53 -0800411
412 shared_libs: [
413 "libcrypto",
414 ],
415
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100416 defaults: [
417 "boringssl_test_support_sources",
418 "boringssl_flags",
419 ],
Adam Langley7c167932018-02-02 14:44:53 -0800420}
421
Pete Bentley390f5872020-12-10 11:19:10 +0000422// Used for ACVP testing for FIPS certification.
423// Not installed on devices by default.
424cc_binary {
425 name: "acvp_modulewrapper",
426 host_supported: true,
427 srcs: [
428 "src/util/fipstools/acvp/modulewrapper/modulewrapper.cc",
429 ],
430 target: {
431 android: {
432 compile_multilib: "both",
433 },
434 },
435 stem: "modulewrapper",
436 multilib: {
437 lib32: {
438 suffix: "32",
439 },
440 },
441
442 shared_libs: [
443 "libcrypto",
444 ],
445
446 defaults: [
447 "boringssl_flags",
448 ],
449}
450
Dan Willemsen2458a412016-07-15 09:28:31 -0700451// Test support library
452cc_library_static {
453 name: "boringssl_test_support",
454 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100455 defaults: [
456 "boringssl_test_support_sources",
457 "boringssl_flags",
458 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700459
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700460 shared_libs: [
461 "libcrypto",
462 "libssl",
463 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700464}
465
466// Tests
467cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100468 name: "boringssl_crypto_test",
469 test_suites: ["device-tests"],
470 host_supported: true,
471 defaults: [
472 "boringssl_crypto_test_sources",
473 "boringssl_flags",
474 ],
475 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500476
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100477 shared_libs: ["libcrypto"],
David Benjaminf31229b2017-01-25 14:08:15 -0500478}
479
480cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100481 name: "boringssl_ssl_test",
482 test_suites: ["device-tests"],
483 host_supported: true,
484 defaults: [
485 "boringssl_ssl_test_sources",
486 "boringssl_flags",
487 ],
488 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500489
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100490 shared_libs: [
491 "libcrypto",
492 "libssl",
493 ],
David Benjaminf31229b2017-01-25 14:08:15 -0500494}
Adam Langleyb6f75152019-10-18 12:20:11 -0700495
496// Utility binary for CMVP on-site testing.
497cc_binary {
Tobias Thierer6204b542019-10-18 21:55:05 +0100498 name: "test_fips",
499 host_supported: false,
500 defaults: [
501 "boringssl_flags",
502 ],
503 shared_libs: [
504 "libcrypto",
505 ],
506 srcs: [
507 "src/util/fipstools/cavp/test_fips.c",
508 ],
Adam Langleyb6f75152019-10-18 12:20:11 -0700509}