blob: 8cc3fe61e9f7a169d53bc6ec828718a71f923f21 [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 },
70 },
71
72 local_include_dirs: ["src/crypto"],
Pete Bentleye6a478a2019-08-19 22:20:24 +010073}
74
75cc_object {
76 name: "bcm_object",
77 device_supported: true,
78 recovery_available: true,
79 native_bridge_supported: true,
80 defaults: [
81 "libcrypto_bcm_sources",
82 "libcrypto_defaults",
83 "boringssl_defaults",
84 "boringssl_flags",
85 ],
Peter Collingbourne22f5f872019-09-27 15:32:38 -070086 sanitize: {
87 address: false,
Tobias Thierer6204b542019-10-18 21:55:05 +010088 hwaddress: false,
Mitch Phillipsf5a60782019-12-10 08:47:30 -080089 fuzzer: false,
Peter Collingbourne22f5f872019-09-27 15:32:38 -070090 },
Pete Bentleye6a478a2019-08-19 22:20:24 +010091 target: {
92 android: {
93 cflags: [
94 "-DBORINGSSL_FIPS",
95 "-fPIC",
Pete Bentley1d07cf82019-10-18 12:49:31 +010096 // -fno[data|text]-sections required to ensure a
97 // single text and data section for FIPS integrity check
98 "-fno-data-sections",
99 "-fno-function-sections",
Pete Bentleye6a478a2019-08-19 22:20:24 +0100100 ],
101 linker_script: "src/crypto/fipsmodule/fips_shared.lds",
102 },
Peter Collingbourne0560ada2019-11-22 13:50:29 -0800103 // Temporary hack to let BoringSSL build with a new compiler.
104 // This doesn't enable HWASAN unconditionally, it just causes
105 // BoringSSL's asm code to unconditionally use a HWASAN-compatible
106 // global variable reference so that the non-HWASANified (because of
107 // sanitize: { hwaddress: false } above) code in the BCM can
108 // successfully link against the HWASANified code in the rest of
109 // BoringSSL in HWASAN builds.
110 android_arm64: {
111 asflags: [
112 "-fsanitize=hwaddress",
113 ],
114 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100115 },
116}
117
118bootstrap_go_package {
119 name: "bssl_ar",
120 pkgPath: "boringssl.googlesource.com/boringssl/util/ar",
121 srcs: [
122 "src/util/ar/ar.go",
123 ],
124 testSrcs: [
125 "src/util/ar/ar_test.go",
126 ],
127}
128
129bootstrap_go_package {
130 name: "bssl_fipscommon",
131 pkgPath: "boringssl.googlesource.com/boringssl/util/fipstools/fipscommon",
132 srcs: [
133 "src/util/fipstools/fipscommon/const.go",
134 ],
135}
136
137blueprint_go_binary {
138 name: "bssl_inject_hash",
139 srcs: [
140 "src/util/fipstools/inject_hash/inject_hash.go",
141 ],
142 deps: [
143 "bssl_ar",
144 "bssl_fipscommon",
145 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700146}
147
148// Target and host library
149cc_library {
150 name: "libcrypto",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100151 visibility: ["//visibility:public"],
Vijay Venkatraman3caad952017-05-16 12:00:57 -0700152 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200153 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900154 vndk: {
155 enabled: true,
156 },
Jooyung Hanb6b07c32019-01-18 15:31:20 +0900157 double_loadable: true,
Jiyong Parkc3463952018-04-27 21:44:32 +0900158 recovery_available: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100159 defaults: [
160 "libcrypto_sources",
161 "libcrypto_defaults",
162 "boringssl_defaults",
163 "boringssl_flags",
164 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700165 unique_host_soname: true,
Pete Bentleye6a478a2019-08-19 22:20:24 +0100166 srcs: [
167 ":bcm_object",
168 ],
169 target: {
170 android: {
171 cflags: [
172 "-DBORINGSSL_FIPS",
173 ],
174 inject_bssl_hash: true,
Colin Cross4b979db2019-09-18 11:20:16 -0700175 static: {
176 // Disable the static version of libcrypto, as it causes
177 // problems for FIPS certification. Use libcrypto_static for
178 // modules that need static libcrypto but do not need FIPS self
179 // testing, or use dynamic libcrypto.
180 enabled: false,
181 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100182 },
183 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700184}
185
186// Static library
Colin Cross4b979db2019-09-18 11:20:16 -0700187// This version of libcrypto will not have FIPS self tests enabled, so its
188// usage is protected through visibility to ensure it doesn't end up used
189// somewhere that needs the FIPS version.
Dan Willemsen21986fb2016-07-14 15:23:56 -0700190cc_library_static {
191 name: "libcrypto_static",
Colin Cross4b979db2019-09-18 11:20:16 -0700192 visibility: [
193 "//bootable/recovery/updater",
194 "//external/conscrypt",
195 "//external/python/cpython2",
Przemyslaw Szczepaniak0f2e90f2019-10-31 13:41:16 +0000196 "//frameworks/ml/nn/runtime:__subpackages__",
Colin Cross4b979db2019-09-18 11:20:16 -0700197 "//hardware/interfaces/confirmationui/1.0/vts/functional",
198 "//hardware/interfaces/drm/1.0/vts/functional",
199 "//hardware/interfaces/drm/1.2/vts/functional",
Robert Shih6526b5c2020-01-21 11:03:32 -0800200 "//hardware/interfaces/drm/1.3/vts/functional",
Colin Cross4b979db2019-09-18 11:20:16 -0700201 "//hardware/interfaces/keymaster/3.0/vts/functional",
202 "//hardware/interfaces/keymaster/4.0/vts/functional",
Shawn Willden1ff77d02020-01-16 23:52:56 -0700203 "//hardware/interfaces/keymaster/4.1/vts/functional",
Luke Huang16a30fc2019-11-22 11:44:50 +0800204 "//packages/modules/DnsResolver/tests:__subpackages__",
Colin Cross4b979db2019-09-18 11:20:16 -0700205 "//system/core/adb",
206 "//system/core/init",
207 "//system/core/fs_mgr/liblp",
208 "//system/core/fs_mgr/liblp/vts_core",
209 "//system/core/fs_mgr/libsnapshot",
210 "//system/libvintf/test",
211 "//system/security/keystore/tests",
212 "//test/vts-testcase/security/avb",
213 ],
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100214 defaults: [
Pete Bentley47637342019-08-19 12:22:49 +0100215 "libcrypto_bcm_sources",
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100216 "libcrypto_sources",
217 "libcrypto_defaults",
218 "boringssl_defaults",
219 "boringssl_flags",
220 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700221}
222
Dan Willemsen21986fb2016-07-14 15:23:56 -0700223//// libssl
224
225// Target static library
Dan Willemsen21986fb2016-07-14 15:23:56 -0700226
227// Static and Shared library
228cc_library {
229 name: "libssl",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100230 visibility: ["//visibility:public"],
Dan Willemsenea55e182018-10-23 13:41:19 -0700231 recovery_available: true,
Justin Yun47949c52017-07-24 15:19:43 +0900232 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200233 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900234 vndk: {
235 enabled: true,
236 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700237 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100238 defaults: [
239 "libssl_sources",
240 "boringssl_defaults",
241 "boringssl_flags",
242 ],
Joshua Duong81ce7a52019-10-31 12:44:47 -0700243 target: {
244 windows: {
245 enabled: true,
246 },
247 },
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700248 unique_host_soname: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -0700249
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700250 shared_libs: ["libcrypto"],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700251}
252
Dan Willemsen21986fb2016-07-14 15:23:56 -0700253// Tool
254cc_binary {
255 name: "bssl",
256 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100257 defaults: [
258 "bssl_sources",
259 "boringssl_flags",
260 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700261
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700262 shared_libs: [
263 "libcrypto",
264 "libssl",
265 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700266 target: {
Dan Willemsen21986fb2016-07-14 15:23:56 -0700267 darwin: {
268 enabled: false,
269 },
270 },
271}
Dan Willemsen2458a412016-07-15 09:28:31 -0700272
Adam Langley7c167932018-02-02 14:44:53 -0800273cc_binary {
274 name: "cavp",
275 host_supported: true,
276 srcs: [
Pete Bentley0c61efe2019-08-13 09:32:23 +0100277 "src/util/fipstools/cavp/cavp_aes_gcm_test.cc",
278 "src/util/fipstools/cavp/cavp_aes_test.cc",
279 "src/util/fipstools/cavp/cavp_ctr_drbg_test.cc",
280 "src/util/fipstools/cavp/cavp_ecdsa2_keypair_test.cc",
281 "src/util/fipstools/cavp/cavp_ecdsa2_pkv_test.cc",
282 "src/util/fipstools/cavp/cavp_ecdsa2_siggen_test.cc",
283 "src/util/fipstools/cavp/cavp_ecdsa2_sigver_test.cc",
284 "src/util/fipstools/cavp/cavp_hmac_test.cc",
285 "src/util/fipstools/cavp/cavp_kas_test.cc",
286 "src/util/fipstools/cavp/cavp_keywrap_test.cc",
287 "src/util/fipstools/cavp/cavp_main.cc",
288 "src/util/fipstools/cavp/cavp_rsa2_keygen_test.cc",
289 "src/util/fipstools/cavp/cavp_rsa2_siggen_test.cc",
290 "src/util/fipstools/cavp/cavp_rsa2_sigver_test.cc",
291 "src/util/fipstools/cavp/cavp_sha_monte_test.cc",
292 "src/util/fipstools/cavp/cavp_sha_test.cc",
293 "src/util/fipstools/cavp/cavp_tdes_test.cc",
294 "src/util/fipstools/cavp/cavp_test_util.cc",
295 "src/util/fipstools/cavp/cavp_tlskdf_test.cc",
Adam Langley7c167932018-02-02 14:44:53 -0800296 ],
297
298 shared_libs: [
299 "libcrypto",
300 ],
301
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100302 defaults: [
303 "boringssl_test_support_sources",
304 "boringssl_flags",
305 ],
Adam Langley7c167932018-02-02 14:44:53 -0800306}
307
Dan Willemsen2458a412016-07-15 09:28:31 -0700308// Test support library
309cc_library_static {
310 name: "boringssl_test_support",
311 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100312 defaults: [
313 "boringssl_test_support_sources",
314 "boringssl_flags",
315 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700316
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700317 shared_libs: [
318 "libcrypto",
319 "libssl",
320 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700321}
322
323// Tests
324cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100325 name: "boringssl_crypto_test",
326 test_suites: ["device-tests"],
327 host_supported: true,
328 defaults: [
329 "boringssl_crypto_test_sources",
330 "boringssl_flags",
331 ],
332 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500333
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100334 shared_libs: ["libcrypto"],
David Benjaminf31229b2017-01-25 14:08:15 -0500335}
336
337cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100338 name: "boringssl_ssl_test",
339 test_suites: ["device-tests"],
340 host_supported: true,
341 defaults: [
342 "boringssl_ssl_test_sources",
343 "boringssl_flags",
344 ],
345 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500346
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100347 shared_libs: [
348 "libcrypto",
349 "libssl",
350 ],
David Benjaminf31229b2017-01-25 14:08:15 -0500351}
Adam Langleyb6f75152019-10-18 12:20:11 -0700352
353// Utility binary for CMVP on-site testing.
354cc_binary {
Tobias Thierer6204b542019-10-18 21:55:05 +0100355 name: "test_fips",
356 host_supported: false,
357 defaults: [
358 "boringssl_flags",
359 ],
360 shared_libs: [
361 "libcrypto",
362 ],
363 srcs: [
364 "src/util/fipstools/cavp/test_fips.c",
365 ],
Adam Langleyb6f75152019-10-18 12:20:11 -0700366}