blob: 8ac988a8766e55d34fcc3f00d751983bfa645ea9 [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"],
73
Dan Willemsen21986fb2016-07-14 15:23:56 -070074 arch: {
Dan Willemsen21986fb2016-07-14 15:23:56 -070075 arm64: {
76 clang_asflags: ["-march=armv8-a+crypto"],
77 },
78 },
Pete Bentleye6a478a2019-08-19 22:20:24 +010079 // To allow integrity check to read and checksum the code
80 xom: false,
81}
82
83cc_object {
84 name: "bcm_object",
85 device_supported: true,
86 recovery_available: true,
87 native_bridge_supported: true,
88 defaults: [
89 "libcrypto_bcm_sources",
90 "libcrypto_defaults",
91 "boringssl_defaults",
92 "boringssl_flags",
93 ],
94 target: {
95 android: {
96 cflags: [
97 "-DBORINGSSL_FIPS",
98 "-fPIC",
99 ],
100 linker_script: "src/crypto/fipsmodule/fips_shared.lds",
101 },
102 },
103}
104
105bootstrap_go_package {
106 name: "bssl_ar",
107 pkgPath: "boringssl.googlesource.com/boringssl/util/ar",
108 srcs: [
109 "src/util/ar/ar.go",
110 ],
111 testSrcs: [
112 "src/util/ar/ar_test.go",
113 ],
114}
115
116bootstrap_go_package {
117 name: "bssl_fipscommon",
118 pkgPath: "boringssl.googlesource.com/boringssl/util/fipstools/fipscommon",
119 srcs: [
120 "src/util/fipstools/fipscommon/const.go",
121 ],
122}
123
124blueprint_go_binary {
125 name: "bssl_inject_hash",
126 srcs: [
127 "src/util/fipstools/inject_hash/inject_hash.go",
128 ],
129 deps: [
130 "bssl_ar",
131 "bssl_fipscommon",
132 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700133}
134
135// Target and host library
136cc_library {
137 name: "libcrypto",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100138 visibility: ["//visibility:public"],
Vijay Venkatraman3caad952017-05-16 12:00:57 -0700139 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200140 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900141 vndk: {
142 enabled: true,
143 },
Jooyung Hanb6b07c32019-01-18 15:31:20 +0900144 double_loadable: true,
Jiyong Parkc3463952018-04-27 21:44:32 +0900145 recovery_available: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100146 defaults: [
147 "libcrypto_sources",
148 "libcrypto_defaults",
149 "boringssl_defaults",
150 "boringssl_flags",
151 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700152 unique_host_soname: true,
Pete Bentleye6a478a2019-08-19 22:20:24 +0100153 srcs: [
154 ":bcm_object",
155 ],
156 target: {
157 android: {
158 cflags: [
159 "-DBORINGSSL_FIPS",
160 ],
161 inject_bssl_hash: true,
162 },
163 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700164}
165
166// Static library
167// This should only be used for host modules that will be in a JVM, all other
168// modules should use the static variant of libcrypto.
169cc_library_static {
170 name: "libcrypto_static",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100171 visibility: ["//visibility:public"],
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100172 defaults: [
Pete Bentley47637342019-08-19 12:22:49 +0100173 "libcrypto_bcm_sources",
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100174 "libcrypto_sources",
175 "libcrypto_defaults",
176 "boringssl_defaults",
177 "boringssl_flags",
178 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700179
180 target: {
181 host: {
David Benjaminc0dedc02017-01-24 17:54:24 -0500182 // TODO: b/26160319. ASAN breaks use of this library in JVM.
Dan Willemsen21986fb2016-07-14 15:23:56 -0700183 // Re-enable sanitization when the issue with making clients of this library
184 // preload ASAN runtime is resolved. Without that, clients are getting runtime
David Benjaminc0dedc02017-01-24 17:54:24 -0500185 // errors due to unresolved ASAN symbols, such as
Dan Willemsen21986fb2016-07-14 15:23:56 -0700186 // __asan_option_detect_stack_use_after_return.
187 sanitize: {
188 never: true,
189 },
190 },
191 },
192}
193
Dan Willemsen21986fb2016-07-14 15:23:56 -0700194//// libssl
195
196// Target static library
Dan Willemsen21986fb2016-07-14 15:23:56 -0700197
198// Static and Shared library
199cc_library {
200 name: "libssl",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100201 visibility: ["//visibility:public"],
Dan Willemsenea55e182018-10-23 13:41:19 -0700202 recovery_available: true,
Justin Yun47949c52017-07-24 15:19:43 +0900203 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200204 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900205 vndk: {
206 enabled: true,
207 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700208 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100209 defaults: [
210 "libssl_sources",
211 "boringssl_defaults",
212 "boringssl_flags",
213 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700214 unique_host_soname: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -0700215
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700216 shared_libs: ["libcrypto"],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700217}
218
Dan Willemsen21986fb2016-07-14 15:23:56 -0700219// Tool
220cc_binary {
221 name: "bssl",
222 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100223 defaults: [
224 "bssl_sources",
225 "boringssl_flags",
226 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700227
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700228 shared_libs: [
229 "libcrypto",
230 "libssl",
231 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700232 target: {
Dan Willemsen21986fb2016-07-14 15:23:56 -0700233 darwin: {
234 enabled: false,
235 },
236 },
237}
Dan Willemsen2458a412016-07-15 09:28:31 -0700238
Adam Langley7c167932018-02-02 14:44:53 -0800239cc_binary {
240 name: "cavp",
241 host_supported: true,
242 srcs: [
Pete Bentley0c61efe2019-08-13 09:32:23 +0100243 "src/util/fipstools/cavp/cavp_aes_gcm_test.cc",
244 "src/util/fipstools/cavp/cavp_aes_test.cc",
245 "src/util/fipstools/cavp/cavp_ctr_drbg_test.cc",
246 "src/util/fipstools/cavp/cavp_ecdsa2_keypair_test.cc",
247 "src/util/fipstools/cavp/cavp_ecdsa2_pkv_test.cc",
248 "src/util/fipstools/cavp/cavp_ecdsa2_siggen_test.cc",
249 "src/util/fipstools/cavp/cavp_ecdsa2_sigver_test.cc",
250 "src/util/fipstools/cavp/cavp_hmac_test.cc",
251 "src/util/fipstools/cavp/cavp_kas_test.cc",
252 "src/util/fipstools/cavp/cavp_keywrap_test.cc",
253 "src/util/fipstools/cavp/cavp_main.cc",
254 "src/util/fipstools/cavp/cavp_rsa2_keygen_test.cc",
255 "src/util/fipstools/cavp/cavp_rsa2_siggen_test.cc",
256 "src/util/fipstools/cavp/cavp_rsa2_sigver_test.cc",
257 "src/util/fipstools/cavp/cavp_sha_monte_test.cc",
258 "src/util/fipstools/cavp/cavp_sha_test.cc",
259 "src/util/fipstools/cavp/cavp_tdes_test.cc",
260 "src/util/fipstools/cavp/cavp_test_util.cc",
261 "src/util/fipstools/cavp/cavp_tlskdf_test.cc",
Adam Langley7c167932018-02-02 14:44:53 -0800262 ],
263
264 shared_libs: [
265 "libcrypto",
266 ],
267
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100268 defaults: [
269 "boringssl_test_support_sources",
270 "boringssl_flags",
271 ],
Adam Langley7c167932018-02-02 14:44:53 -0800272}
273
Dan Willemsen2458a412016-07-15 09:28:31 -0700274// Test support library
275cc_library_static {
276 name: "boringssl_test_support",
277 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100278 defaults: [
279 "boringssl_test_support_sources",
280 "boringssl_flags",
281 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700282
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700283 shared_libs: [
284 "libcrypto",
285 "libssl",
286 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700287}
288
289// Tests
290cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100291 name: "boringssl_crypto_test",
292 test_suites: ["device-tests"],
293 host_supported: true,
294 defaults: [
295 "boringssl_crypto_test_sources",
296 "boringssl_flags",
297 ],
298 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500299
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100300 shared_libs: ["libcrypto"],
David Benjaminf31229b2017-01-25 14:08:15 -0500301}
302
303cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100304 name: "boringssl_ssl_test",
305 test_suites: ["device-tests"],
306 host_supported: true,
307 defaults: [
308 "boringssl_ssl_test_sources",
309 "boringssl_flags",
310 ],
311 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500312
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100313 shared_libs: [
314 "libcrypto",
315 "libssl",
316 ],
David Benjaminf31229b2017-01-25 14:08:15 -0500317}