blob: 496d50f7c2e5a9cbb2954799cb7f26f3f339d354 [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 },
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,
Colin Cross4b979db2019-09-18 11:20:16 -0700162 static: {
163 // Disable the static version of libcrypto, as it causes
164 // problems for FIPS certification. Use libcrypto_static for
165 // modules that need static libcrypto but do not need FIPS self
166 // testing, or use dynamic libcrypto.
167 enabled: false,
168 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100169 },
170 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700171}
172
173// Static library
Colin Cross4b979db2019-09-18 11:20:16 -0700174// This version of libcrypto will not have FIPS self tests enabled, so its
175// usage is protected through visibility to ensure it doesn't end up used
176// somewhere that needs the FIPS version.
Dan Willemsen21986fb2016-07-14 15:23:56 -0700177cc_library_static {
178 name: "libcrypto_static",
Colin Cross4b979db2019-09-18 11:20:16 -0700179 visibility: [
180 "//bootable/recovery/updater",
181 "//external/conscrypt",
182 "//external/python/cpython2",
Przemyslaw Szczepaniak0f2e90f2019-10-31 13:41:16 +0000183 "//frameworks/ml/nn/runtime:__subpackages__",
Colin Cross4b979db2019-09-18 11:20:16 -0700184 "//hardware/interfaces/confirmationui/1.0/vts/functional",
185 "//hardware/interfaces/drm/1.0/vts/functional",
186 "//hardware/interfaces/drm/1.2/vts/functional",
187 "//hardware/interfaces/keymaster/3.0/vts/functional",
188 "//hardware/interfaces/keymaster/4.0/vts/functional",
189 "//system/core/adb",
190 "//system/core/init",
191 "//system/core/fs_mgr/liblp",
192 "//system/core/fs_mgr/liblp/vts_core",
193 "//system/core/fs_mgr/libsnapshot",
194 "//system/libvintf/test",
195 "//system/security/keystore/tests",
196 "//test/vts-testcase/security/avb",
197 ],
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100198 defaults: [
Pete Bentley47637342019-08-19 12:22:49 +0100199 "libcrypto_bcm_sources",
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100200 "libcrypto_sources",
201 "libcrypto_defaults",
202 "boringssl_defaults",
203 "boringssl_flags",
204 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700205}
206
Dan Willemsen21986fb2016-07-14 15:23:56 -0700207//// libssl
208
209// Target static library
Dan Willemsen21986fb2016-07-14 15:23:56 -0700210
211// Static and Shared library
212cc_library {
213 name: "libssl",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100214 visibility: ["//visibility:public"],
Dan Willemsenea55e182018-10-23 13:41:19 -0700215 recovery_available: true,
Justin Yun47949c52017-07-24 15:19:43 +0900216 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200217 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900218 vndk: {
219 enabled: true,
220 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700221 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100222 defaults: [
223 "libssl_sources",
224 "boringssl_defaults",
225 "boringssl_flags",
226 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700227 unique_host_soname: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -0700228
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700229 shared_libs: ["libcrypto"],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700230}
231
Dan Willemsen21986fb2016-07-14 15:23:56 -0700232// Tool
233cc_binary {
234 name: "bssl",
235 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100236 defaults: [
237 "bssl_sources",
238 "boringssl_flags",
239 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700240
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700241 shared_libs: [
242 "libcrypto",
243 "libssl",
244 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700245 target: {
Dan Willemsen21986fb2016-07-14 15:23:56 -0700246 darwin: {
247 enabled: false,
248 },
249 },
250}
Dan Willemsen2458a412016-07-15 09:28:31 -0700251
Adam Langley7c167932018-02-02 14:44:53 -0800252cc_binary {
253 name: "cavp",
254 host_supported: true,
255 srcs: [
Pete Bentley0c61efe2019-08-13 09:32:23 +0100256 "src/util/fipstools/cavp/cavp_aes_gcm_test.cc",
257 "src/util/fipstools/cavp/cavp_aes_test.cc",
258 "src/util/fipstools/cavp/cavp_ctr_drbg_test.cc",
259 "src/util/fipstools/cavp/cavp_ecdsa2_keypair_test.cc",
260 "src/util/fipstools/cavp/cavp_ecdsa2_pkv_test.cc",
261 "src/util/fipstools/cavp/cavp_ecdsa2_siggen_test.cc",
262 "src/util/fipstools/cavp/cavp_ecdsa2_sigver_test.cc",
263 "src/util/fipstools/cavp/cavp_hmac_test.cc",
264 "src/util/fipstools/cavp/cavp_kas_test.cc",
265 "src/util/fipstools/cavp/cavp_keywrap_test.cc",
266 "src/util/fipstools/cavp/cavp_main.cc",
267 "src/util/fipstools/cavp/cavp_rsa2_keygen_test.cc",
268 "src/util/fipstools/cavp/cavp_rsa2_siggen_test.cc",
269 "src/util/fipstools/cavp/cavp_rsa2_sigver_test.cc",
270 "src/util/fipstools/cavp/cavp_sha_monte_test.cc",
271 "src/util/fipstools/cavp/cavp_sha_test.cc",
272 "src/util/fipstools/cavp/cavp_tdes_test.cc",
273 "src/util/fipstools/cavp/cavp_test_util.cc",
274 "src/util/fipstools/cavp/cavp_tlskdf_test.cc",
Adam Langley7c167932018-02-02 14:44:53 -0800275 ],
276
277 shared_libs: [
278 "libcrypto",
279 ],
280
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100281 defaults: [
282 "boringssl_test_support_sources",
283 "boringssl_flags",
284 ],
Adam Langley7c167932018-02-02 14:44:53 -0800285}
286
Dan Willemsen2458a412016-07-15 09:28:31 -0700287// Test support library
288cc_library_static {
289 name: "boringssl_test_support",
290 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100291 defaults: [
292 "boringssl_test_support_sources",
293 "boringssl_flags",
294 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700295
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700296 shared_libs: [
297 "libcrypto",
298 "libssl",
299 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700300}
301
302// Tests
303cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100304 name: "boringssl_crypto_test",
305 test_suites: ["device-tests"],
306 host_supported: true,
307 defaults: [
308 "boringssl_crypto_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: ["libcrypto"],
David Benjaminf31229b2017-01-25 14:08:15 -0500314}
315
316cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100317 name: "boringssl_ssl_test",
318 test_suites: ["device-tests"],
319 host_supported: true,
320 defaults: [
321 "boringssl_ssl_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: [
327 "libcrypto",
328 "libssl",
329 ],
David Benjaminf31229b2017-01-25 14:08:15 -0500330}
Adam Langleyb6f75152019-10-18 12:20:11 -0700331
332// Utility binary for CMVP on-site testing.
333cc_binary {
Tobias Thierer6204b542019-10-18 21:55:05 +0100334 name: "test_fips",
335 host_supported: false,
336 defaults: [
337 "boringssl_flags",
338 ],
339 shared_libs: [
340 "libcrypto",
341 ],
342 srcs: [
343 "src/util/fipstools/cavp/test_fips.c",
344 ],
Adam Langleyb6f75152019-10-18 12:20:11 -0700345}