blob: 46a7dafcb0faba2f81abdf2c39c63ed26d289988 [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",
Luke Huang16a30fc2019-11-22 11:44:50 +0800201 "//packages/modules/DnsResolver/tests:__subpackages__",
Colin Cross4b979db2019-09-18 11:20:16 -0700202 "//system/core/adb",
203 "//system/core/init",
204 "//system/core/fs_mgr/liblp",
205 "//system/core/fs_mgr/liblp/vts_core",
206 "//system/core/fs_mgr/libsnapshot",
207 "//system/libvintf/test",
208 "//system/security/keystore/tests",
209 "//test/vts-testcase/security/avb",
210 ],
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100211 defaults: [
Pete Bentley47637342019-08-19 12:22:49 +0100212 "libcrypto_bcm_sources",
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100213 "libcrypto_sources",
214 "libcrypto_defaults",
215 "boringssl_defaults",
216 "boringssl_flags",
217 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700218}
219
Dan Willemsen21986fb2016-07-14 15:23:56 -0700220//// libssl
221
222// Target static library
Dan Willemsen21986fb2016-07-14 15:23:56 -0700223
224// Static and Shared library
225cc_library {
226 name: "libssl",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100227 visibility: ["//visibility:public"],
Dan Willemsenea55e182018-10-23 13:41:19 -0700228 recovery_available: true,
Justin Yun47949c52017-07-24 15:19:43 +0900229 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200230 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900231 vndk: {
232 enabled: true,
233 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700234 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100235 defaults: [
236 "libssl_sources",
237 "boringssl_defaults",
238 "boringssl_flags",
239 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700240 unique_host_soname: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -0700241
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700242 shared_libs: ["libcrypto"],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700243}
244
Dan Willemsen21986fb2016-07-14 15:23:56 -0700245// Tool
246cc_binary {
247 name: "bssl",
248 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100249 defaults: [
250 "bssl_sources",
251 "boringssl_flags",
252 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700253
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700254 shared_libs: [
255 "libcrypto",
256 "libssl",
257 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700258 target: {
Dan Willemsen21986fb2016-07-14 15:23:56 -0700259 darwin: {
260 enabled: false,
261 },
262 },
263}
Dan Willemsen2458a412016-07-15 09:28:31 -0700264
Adam Langley7c167932018-02-02 14:44:53 -0800265cc_binary {
266 name: "cavp",
267 host_supported: true,
268 srcs: [
Pete Bentley0c61efe2019-08-13 09:32:23 +0100269 "src/util/fipstools/cavp/cavp_aes_gcm_test.cc",
270 "src/util/fipstools/cavp/cavp_aes_test.cc",
271 "src/util/fipstools/cavp/cavp_ctr_drbg_test.cc",
272 "src/util/fipstools/cavp/cavp_ecdsa2_keypair_test.cc",
273 "src/util/fipstools/cavp/cavp_ecdsa2_pkv_test.cc",
274 "src/util/fipstools/cavp/cavp_ecdsa2_siggen_test.cc",
275 "src/util/fipstools/cavp/cavp_ecdsa2_sigver_test.cc",
276 "src/util/fipstools/cavp/cavp_hmac_test.cc",
277 "src/util/fipstools/cavp/cavp_kas_test.cc",
278 "src/util/fipstools/cavp/cavp_keywrap_test.cc",
279 "src/util/fipstools/cavp/cavp_main.cc",
280 "src/util/fipstools/cavp/cavp_rsa2_keygen_test.cc",
281 "src/util/fipstools/cavp/cavp_rsa2_siggen_test.cc",
282 "src/util/fipstools/cavp/cavp_rsa2_sigver_test.cc",
283 "src/util/fipstools/cavp/cavp_sha_monte_test.cc",
284 "src/util/fipstools/cavp/cavp_sha_test.cc",
285 "src/util/fipstools/cavp/cavp_tdes_test.cc",
286 "src/util/fipstools/cavp/cavp_test_util.cc",
287 "src/util/fipstools/cavp/cavp_tlskdf_test.cc",
Adam Langley7c167932018-02-02 14:44:53 -0800288 ],
289
290 shared_libs: [
291 "libcrypto",
292 ],
293
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100294 defaults: [
295 "boringssl_test_support_sources",
296 "boringssl_flags",
297 ],
Adam Langley7c167932018-02-02 14:44:53 -0800298}
299
Dan Willemsen2458a412016-07-15 09:28:31 -0700300// Test support library
301cc_library_static {
302 name: "boringssl_test_support",
303 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100304 defaults: [
305 "boringssl_test_support_sources",
306 "boringssl_flags",
307 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700308
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700309 shared_libs: [
310 "libcrypto",
311 "libssl",
312 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700313}
314
315// Tests
316cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100317 name: "boringssl_crypto_test",
318 test_suites: ["device-tests"],
319 host_supported: true,
320 defaults: [
321 "boringssl_crypto_test_sources",
322 "boringssl_flags",
323 ],
324 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500325
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100326 shared_libs: ["libcrypto"],
David Benjaminf31229b2017-01-25 14:08:15 -0500327}
328
329cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100330 name: "boringssl_ssl_test",
331 test_suites: ["device-tests"],
332 host_supported: true,
333 defaults: [
334 "boringssl_ssl_test_sources",
335 "boringssl_flags",
336 ],
337 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500338
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100339 shared_libs: [
340 "libcrypto",
341 "libssl",
342 ],
David Benjaminf31229b2017-01-25 14:08:15 -0500343}
Adam Langleyb6f75152019-10-18 12:20:11 -0700344
345// Utility binary for CMVP on-site testing.
346cc_binary {
Tobias Thierer6204b542019-10-18 21:55:05 +0100347 name: "test_fips",
348 host_supported: false,
349 defaults: [
350 "boringssl_flags",
351 ],
352 shared_libs: [
353 "libcrypto",
354 ],
355 srcs: [
356 "src/util/fipstools/cavp/test_fips.c",
357 ],
Adam Langleyb6f75152019-10-18 12:20:11 -0700358}