blob: 51225daeb89886b77787053d94061cae758f9cf2 [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,
Peter Collingbourne22f5f872019-09-27 15:32:38 -070089 },
Pete Bentleye6a478a2019-08-19 22:20:24 +010090 target: {
91 android: {
92 cflags: [
93 "-DBORINGSSL_FIPS",
94 "-fPIC",
Pete Bentley1d07cf82019-10-18 12:49:31 +010095 // -fno[data|text]-sections required to ensure a
96 // single text and data section for FIPS integrity check
97 "-fno-data-sections",
98 "-fno-function-sections",
Pete Bentleye6a478a2019-08-19 22:20:24 +010099 ],
100 linker_script: "src/crypto/fipsmodule/fips_shared.lds",
101 },
Peter Collingbourne0560ada2019-11-22 13:50:29 -0800102 // Temporary hack to let BoringSSL build with a new compiler.
103 // This doesn't enable HWASAN unconditionally, it just causes
104 // BoringSSL's asm code to unconditionally use a HWASAN-compatible
105 // global variable reference so that the non-HWASANified (because of
106 // sanitize: { hwaddress: false } above) code in the BCM can
107 // successfully link against the HWASANified code in the rest of
108 // BoringSSL in HWASAN builds.
109 android_arm64: {
110 asflags: [
111 "-fsanitize=hwaddress",
112 ],
113 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100114 },
115}
116
117bootstrap_go_package {
118 name: "bssl_ar",
119 pkgPath: "boringssl.googlesource.com/boringssl/util/ar",
120 srcs: [
121 "src/util/ar/ar.go",
122 ],
123 testSrcs: [
124 "src/util/ar/ar_test.go",
125 ],
126}
127
128bootstrap_go_package {
129 name: "bssl_fipscommon",
130 pkgPath: "boringssl.googlesource.com/boringssl/util/fipstools/fipscommon",
131 srcs: [
132 "src/util/fipstools/fipscommon/const.go",
133 ],
134}
135
136blueprint_go_binary {
137 name: "bssl_inject_hash",
138 srcs: [
139 "src/util/fipstools/inject_hash/inject_hash.go",
140 ],
141 deps: [
142 "bssl_ar",
143 "bssl_fipscommon",
144 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700145}
146
147// Target and host library
148cc_library {
149 name: "libcrypto",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100150 visibility: ["//visibility:public"],
Vijay Venkatraman3caad952017-05-16 12:00:57 -0700151 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200152 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900153 vndk: {
154 enabled: true,
155 },
Jooyung Hanb6b07c32019-01-18 15:31:20 +0900156 double_loadable: true,
Jiyong Parkc3463952018-04-27 21:44:32 +0900157 recovery_available: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100158 defaults: [
159 "libcrypto_sources",
160 "libcrypto_defaults",
161 "boringssl_defaults",
162 "boringssl_flags",
163 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700164 unique_host_soname: true,
Pete Bentleye6a478a2019-08-19 22:20:24 +0100165 srcs: [
166 ":bcm_object",
167 ],
168 target: {
169 android: {
170 cflags: [
171 "-DBORINGSSL_FIPS",
172 ],
173 inject_bssl_hash: true,
Colin Cross4b979db2019-09-18 11:20:16 -0700174 static: {
175 // Disable the static version of libcrypto, as it causes
176 // problems for FIPS certification. Use libcrypto_static for
177 // modules that need static libcrypto but do not need FIPS self
178 // testing, or use dynamic libcrypto.
179 enabled: false,
180 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100181 },
182 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700183}
184
185// Static library
Colin Cross4b979db2019-09-18 11:20:16 -0700186// This version of libcrypto will not have FIPS self tests enabled, so its
187// usage is protected through visibility to ensure it doesn't end up used
188// somewhere that needs the FIPS version.
Dan Willemsen21986fb2016-07-14 15:23:56 -0700189cc_library_static {
190 name: "libcrypto_static",
Colin Cross4b979db2019-09-18 11:20:16 -0700191 visibility: [
192 "//bootable/recovery/updater",
193 "//external/conscrypt",
194 "//external/python/cpython2",
Przemyslaw Szczepaniak0f2e90f2019-10-31 13:41:16 +0000195 "//frameworks/ml/nn/runtime:__subpackages__",
Colin Cross4b979db2019-09-18 11:20:16 -0700196 "//hardware/interfaces/confirmationui/1.0/vts/functional",
197 "//hardware/interfaces/drm/1.0/vts/functional",
198 "//hardware/interfaces/drm/1.2/vts/functional",
199 "//hardware/interfaces/keymaster/3.0/vts/functional",
200 "//hardware/interfaces/keymaster/4.0/vts/functional",
201 "//system/core/adb",
202 "//system/core/init",
203 "//system/core/fs_mgr/liblp",
204 "//system/core/fs_mgr/liblp/vts_core",
205 "//system/core/fs_mgr/libsnapshot",
206 "//system/libvintf/test",
207 "//system/security/keystore/tests",
208 "//test/vts-testcase/security/avb",
209 ],
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100210 defaults: [
Pete Bentley47637342019-08-19 12:22:49 +0100211 "libcrypto_bcm_sources",
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100212 "libcrypto_sources",
213 "libcrypto_defaults",
214 "boringssl_defaults",
215 "boringssl_flags",
216 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700217}
218
Dan Willemsen21986fb2016-07-14 15:23:56 -0700219//// libssl
220
221// Target static library
Dan Willemsen21986fb2016-07-14 15:23:56 -0700222
223// Static and Shared library
224cc_library {
225 name: "libssl",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100226 visibility: ["//visibility:public"],
Dan Willemsenea55e182018-10-23 13:41:19 -0700227 recovery_available: true,
Justin Yun47949c52017-07-24 15:19:43 +0900228 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200229 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900230 vndk: {
231 enabled: true,
232 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700233 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100234 defaults: [
235 "libssl_sources",
236 "boringssl_defaults",
237 "boringssl_flags",
238 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700239 unique_host_soname: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -0700240
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700241 shared_libs: ["libcrypto"],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700242}
243
Dan Willemsen21986fb2016-07-14 15:23:56 -0700244// Tool
245cc_binary {
246 name: "bssl",
247 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100248 defaults: [
249 "bssl_sources",
250 "boringssl_flags",
251 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700252
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700253 shared_libs: [
254 "libcrypto",
255 "libssl",
256 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700257 target: {
Dan Willemsen21986fb2016-07-14 15:23:56 -0700258 darwin: {
259 enabled: false,
260 },
261 },
262}
Dan Willemsen2458a412016-07-15 09:28:31 -0700263
Adam Langley7c167932018-02-02 14:44:53 -0800264cc_binary {
265 name: "cavp",
266 host_supported: true,
267 srcs: [
Pete Bentley0c61efe2019-08-13 09:32:23 +0100268 "src/util/fipstools/cavp/cavp_aes_gcm_test.cc",
269 "src/util/fipstools/cavp/cavp_aes_test.cc",
270 "src/util/fipstools/cavp/cavp_ctr_drbg_test.cc",
271 "src/util/fipstools/cavp/cavp_ecdsa2_keypair_test.cc",
272 "src/util/fipstools/cavp/cavp_ecdsa2_pkv_test.cc",
273 "src/util/fipstools/cavp/cavp_ecdsa2_siggen_test.cc",
274 "src/util/fipstools/cavp/cavp_ecdsa2_sigver_test.cc",
275 "src/util/fipstools/cavp/cavp_hmac_test.cc",
276 "src/util/fipstools/cavp/cavp_kas_test.cc",
277 "src/util/fipstools/cavp/cavp_keywrap_test.cc",
278 "src/util/fipstools/cavp/cavp_main.cc",
279 "src/util/fipstools/cavp/cavp_rsa2_keygen_test.cc",
280 "src/util/fipstools/cavp/cavp_rsa2_siggen_test.cc",
281 "src/util/fipstools/cavp/cavp_rsa2_sigver_test.cc",
282 "src/util/fipstools/cavp/cavp_sha_monte_test.cc",
283 "src/util/fipstools/cavp/cavp_sha_test.cc",
284 "src/util/fipstools/cavp/cavp_tdes_test.cc",
285 "src/util/fipstools/cavp/cavp_test_util.cc",
286 "src/util/fipstools/cavp/cavp_tlskdf_test.cc",
Adam Langley7c167932018-02-02 14:44:53 -0800287 ],
288
289 shared_libs: [
290 "libcrypto",
291 ],
292
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100293 defaults: [
294 "boringssl_test_support_sources",
295 "boringssl_flags",
296 ],
Adam Langley7c167932018-02-02 14:44:53 -0800297}
298
Dan Willemsen2458a412016-07-15 09:28:31 -0700299// Test support library
300cc_library_static {
301 name: "boringssl_test_support",
302 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100303 defaults: [
304 "boringssl_test_support_sources",
305 "boringssl_flags",
306 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700307
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700308 shared_libs: [
309 "libcrypto",
310 "libssl",
311 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700312}
313
314// Tests
315cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100316 name: "boringssl_crypto_test",
317 test_suites: ["device-tests"],
318 host_supported: true,
319 defaults: [
320 "boringssl_crypto_test_sources",
321 "boringssl_flags",
322 ],
323 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500324
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100325 shared_libs: ["libcrypto"],
David Benjaminf31229b2017-01-25 14:08:15 -0500326}
327
328cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100329 name: "boringssl_ssl_test",
330 test_suites: ["device-tests"],
331 host_supported: true,
332 defaults: [
333 "boringssl_ssl_test_sources",
334 "boringssl_flags",
335 ],
336 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500337
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100338 shared_libs: [
339 "libcrypto",
340 "libssl",
341 ],
David Benjaminf31229b2017-01-25 14:08:15 -0500342}
Adam Langleyb6f75152019-10-18 12:20:11 -0700343
344// Utility binary for CMVP on-site testing.
345cc_binary {
Tobias Thierer6204b542019-10-18 21:55:05 +0100346 name: "test_fips",
347 host_supported: false,
348 defaults: [
349 "boringssl_flags",
350 ],
351 shared_libs: [
352 "libcrypto",
353 ],
354 srcs: [
355 "src/util/fipstools/cavp/test_fips.c",
356 ],
Adam Langleyb6f75152019-10-18 12:20:11 -0700357}