blob: 29fc802f7aad9cdcb7de2591d6aa992a94ffc8ec [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}
80
81cc_object {
82 name: "bcm_object",
83 device_supported: true,
84 recovery_available: true,
85 native_bridge_supported: true,
86 defaults: [
87 "libcrypto_bcm_sources",
88 "libcrypto_defaults",
89 "boringssl_defaults",
90 "boringssl_flags",
91 ],
92 target: {
93 android: {
94 cflags: [
95 "-DBORINGSSL_FIPS",
96 "-fPIC",
97 ],
98 linker_script: "src/crypto/fipsmodule/fips_shared.lds",
99 },
100 },
101}
102
103bootstrap_go_package {
104 name: "bssl_ar",
105 pkgPath: "boringssl.googlesource.com/boringssl/util/ar",
106 srcs: [
107 "src/util/ar/ar.go",
108 ],
109 testSrcs: [
110 "src/util/ar/ar_test.go",
111 ],
112}
113
114bootstrap_go_package {
115 name: "bssl_fipscommon",
116 pkgPath: "boringssl.googlesource.com/boringssl/util/fipstools/fipscommon",
117 srcs: [
118 "src/util/fipstools/fipscommon/const.go",
119 ],
120}
121
122blueprint_go_binary {
123 name: "bssl_inject_hash",
124 srcs: [
125 "src/util/fipstools/inject_hash/inject_hash.go",
126 ],
127 deps: [
128 "bssl_ar",
129 "bssl_fipscommon",
130 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700131}
132
133// Target and host library
134cc_library {
135 name: "libcrypto",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100136 visibility: ["//visibility:public"],
Vijay Venkatraman3caad952017-05-16 12:00:57 -0700137 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200138 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900139 vndk: {
140 enabled: true,
141 },
Jooyung Hanb6b07c32019-01-18 15:31:20 +0900142 double_loadable: true,
Jiyong Parkc3463952018-04-27 21:44:32 +0900143 recovery_available: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100144 defaults: [
145 "libcrypto_sources",
146 "libcrypto_defaults",
147 "boringssl_defaults",
148 "boringssl_flags",
149 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700150 unique_host_soname: true,
Pete Bentleye6a478a2019-08-19 22:20:24 +0100151 srcs: [
152 ":bcm_object",
153 ],
154 target: {
155 android: {
156 cflags: [
157 "-DBORINGSSL_FIPS",
158 ],
159 inject_bssl_hash: true,
Colin Cross4b979db2019-09-18 11:20:16 -0700160 static: {
161 // Disable the static version of libcrypto, as it causes
162 // problems for FIPS certification. Use libcrypto_static for
163 // modules that need static libcrypto but do not need FIPS self
164 // testing, or use dynamic libcrypto.
165 enabled: false,
166 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100167 },
168 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700169}
170
171// Static library
Colin Cross4b979db2019-09-18 11:20:16 -0700172// This version of libcrypto will not have FIPS self tests enabled, so its
173// usage is protected through visibility to ensure it doesn't end up used
174// somewhere that needs the FIPS version.
Dan Willemsen21986fb2016-07-14 15:23:56 -0700175cc_library_static {
176 name: "libcrypto_static",
Colin Cross4b979db2019-09-18 11:20:16 -0700177 visibility: [
178 "//bootable/recovery/updater",
179 "//external/conscrypt",
180 "//external/python/cpython2",
181 "//frameworks/ml/nn/runtime/test",
182 "//hardware/interfaces/confirmationui/1.0/vts/functional",
183 "//hardware/interfaces/drm/1.0/vts/functional",
184 "//hardware/interfaces/drm/1.2/vts/functional",
185 "//hardware/interfaces/keymaster/3.0/vts/functional",
186 "//hardware/interfaces/keymaster/4.0/vts/functional",
187 "//system/core/adb",
188 "//system/core/init",
189 "//system/core/fs_mgr/liblp",
190 "//system/core/fs_mgr/liblp/vts_core",
191 "//system/core/fs_mgr/libsnapshot",
192 "//system/libvintf/test",
193 "//system/security/keystore/tests",
194 "//test/vts-testcase/security/avb",
195 ],
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100196 defaults: [
Pete Bentley47637342019-08-19 12:22:49 +0100197 "libcrypto_bcm_sources",
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100198 "libcrypto_sources",
199 "libcrypto_defaults",
200 "boringssl_defaults",
201 "boringssl_flags",
202 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700203}
204
Dan Willemsen21986fb2016-07-14 15:23:56 -0700205//// libssl
206
207// Target static library
Dan Willemsen21986fb2016-07-14 15:23:56 -0700208
209// Static and Shared library
210cc_library {
211 name: "libssl",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100212 visibility: ["//visibility:public"],
Dan Willemsenea55e182018-10-23 13:41:19 -0700213 recovery_available: true,
Justin Yun47949c52017-07-24 15:19:43 +0900214 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200215 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900216 vndk: {
217 enabled: true,
218 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700219 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100220 defaults: [
221 "libssl_sources",
222 "boringssl_defaults",
223 "boringssl_flags",
224 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700225 unique_host_soname: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -0700226
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700227 shared_libs: ["libcrypto"],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700228}
229
Dan Willemsen21986fb2016-07-14 15:23:56 -0700230// Tool
231cc_binary {
232 name: "bssl",
233 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100234 defaults: [
235 "bssl_sources",
236 "boringssl_flags",
237 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700238
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700239 shared_libs: [
240 "libcrypto",
241 "libssl",
242 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700243 target: {
Dan Willemsen21986fb2016-07-14 15:23:56 -0700244 darwin: {
245 enabled: false,
246 },
247 },
248}
Dan Willemsen2458a412016-07-15 09:28:31 -0700249
Adam Langley7c167932018-02-02 14:44:53 -0800250cc_binary {
251 name: "cavp",
252 host_supported: true,
253 srcs: [
Pete Bentley0c61efe2019-08-13 09:32:23 +0100254 "src/util/fipstools/cavp/cavp_aes_gcm_test.cc",
255 "src/util/fipstools/cavp/cavp_aes_test.cc",
256 "src/util/fipstools/cavp/cavp_ctr_drbg_test.cc",
257 "src/util/fipstools/cavp/cavp_ecdsa2_keypair_test.cc",
258 "src/util/fipstools/cavp/cavp_ecdsa2_pkv_test.cc",
259 "src/util/fipstools/cavp/cavp_ecdsa2_siggen_test.cc",
260 "src/util/fipstools/cavp/cavp_ecdsa2_sigver_test.cc",
261 "src/util/fipstools/cavp/cavp_hmac_test.cc",
262 "src/util/fipstools/cavp/cavp_kas_test.cc",
263 "src/util/fipstools/cavp/cavp_keywrap_test.cc",
264 "src/util/fipstools/cavp/cavp_main.cc",
265 "src/util/fipstools/cavp/cavp_rsa2_keygen_test.cc",
266 "src/util/fipstools/cavp/cavp_rsa2_siggen_test.cc",
267 "src/util/fipstools/cavp/cavp_rsa2_sigver_test.cc",
268 "src/util/fipstools/cavp/cavp_sha_monte_test.cc",
269 "src/util/fipstools/cavp/cavp_sha_test.cc",
270 "src/util/fipstools/cavp/cavp_tdes_test.cc",
271 "src/util/fipstools/cavp/cavp_test_util.cc",
272 "src/util/fipstools/cavp/cavp_tlskdf_test.cc",
Adam Langley7c167932018-02-02 14:44:53 -0800273 ],
274
275 shared_libs: [
276 "libcrypto",
277 ],
278
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100279 defaults: [
280 "boringssl_test_support_sources",
281 "boringssl_flags",
282 ],
Adam Langley7c167932018-02-02 14:44:53 -0800283}
284
Dan Willemsen2458a412016-07-15 09:28:31 -0700285// Test support library
286cc_library_static {
287 name: "boringssl_test_support",
288 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100289 defaults: [
290 "boringssl_test_support_sources",
291 "boringssl_flags",
292 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700293
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700294 shared_libs: [
295 "libcrypto",
296 "libssl",
297 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700298}
299
300// Tests
301cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100302 name: "boringssl_crypto_test",
303 test_suites: ["device-tests"],
304 host_supported: true,
305 defaults: [
306 "boringssl_crypto_test_sources",
307 "boringssl_flags",
308 ],
309 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500310
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100311 shared_libs: ["libcrypto"],
David Benjaminf31229b2017-01-25 14:08:15 -0500312}
313
314cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100315 name: "boringssl_ssl_test",
316 test_suites: ["device-tests"],
317 host_supported: true,
318 defaults: [
319 "boringssl_ssl_test_sources",
320 "boringssl_flags",
321 ],
322 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500323
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100324 shared_libs: [
325 "libcrypto",
326 "libssl",
327 ],
David Benjaminf31229b2017-01-25 14:08:15 -0500328}