blob: adb238fb6b6d25e99d61857acedb2d068eeb78f3 [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 ],
Peter Collingbourne22f5f872019-09-27 15:32:38 -070092 sanitize: {
93 address: false,
Tobias Thierer6204b542019-10-18 21:55:05 +010094 hwaddress: false,
Peter Collingbourne22f5f872019-09-27 15:32:38 -070095 },
Pete Bentleye6a478a2019-08-19 22:20:24 +010096 target: {
97 android: {
98 cflags: [
99 "-DBORINGSSL_FIPS",
100 "-fPIC",
Pete Bentley1d07cf82019-10-18 12:49:31 +0100101 // -fno[data|text]-sections required to ensure a
102 // single text and data section for FIPS integrity check
103 "-fno-data-sections",
104 "-fno-function-sections",
Pete Bentleye6a478a2019-08-19 22:20:24 +0100105 ],
106 linker_script: "src/crypto/fipsmodule/fips_shared.lds",
107 },
108 },
109}
110
111bootstrap_go_package {
112 name: "bssl_ar",
113 pkgPath: "boringssl.googlesource.com/boringssl/util/ar",
114 srcs: [
115 "src/util/ar/ar.go",
116 ],
117 testSrcs: [
118 "src/util/ar/ar_test.go",
119 ],
120}
121
122bootstrap_go_package {
123 name: "bssl_fipscommon",
124 pkgPath: "boringssl.googlesource.com/boringssl/util/fipstools/fipscommon",
125 srcs: [
126 "src/util/fipstools/fipscommon/const.go",
127 ],
128}
129
130blueprint_go_binary {
131 name: "bssl_inject_hash",
132 srcs: [
133 "src/util/fipstools/inject_hash/inject_hash.go",
134 ],
135 deps: [
136 "bssl_ar",
137 "bssl_fipscommon",
138 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700139}
140
141// Target and host library
142cc_library {
143 name: "libcrypto",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100144 visibility: ["//visibility:public"],
Vijay Venkatraman3caad952017-05-16 12:00:57 -0700145 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200146 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900147 vndk: {
148 enabled: true,
149 },
Jooyung Hanb6b07c32019-01-18 15:31:20 +0900150 double_loadable: true,
Jiyong Parkc3463952018-04-27 21:44:32 +0900151 recovery_available: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100152 defaults: [
153 "libcrypto_sources",
154 "libcrypto_defaults",
155 "boringssl_defaults",
156 "boringssl_flags",
157 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700158 unique_host_soname: true,
Pete Bentleye6a478a2019-08-19 22:20:24 +0100159 srcs: [
160 ":bcm_object",
161 ],
162 target: {
163 android: {
164 cflags: [
165 "-DBORINGSSL_FIPS",
166 ],
167 inject_bssl_hash: true,
Colin Cross4b979db2019-09-18 11:20:16 -0700168 static: {
169 // Disable the static version of libcrypto, as it causes
170 // problems for FIPS certification. Use libcrypto_static for
171 // modules that need static libcrypto but do not need FIPS self
172 // testing, or use dynamic libcrypto.
173 enabled: false,
174 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100175 },
176 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700177}
178
179// Static library
Colin Cross4b979db2019-09-18 11:20:16 -0700180// This version of libcrypto will not have FIPS self tests enabled, so its
181// usage is protected through visibility to ensure it doesn't end up used
182// somewhere that needs the FIPS version.
Dan Willemsen21986fb2016-07-14 15:23:56 -0700183cc_library_static {
184 name: "libcrypto_static",
Colin Cross4b979db2019-09-18 11:20:16 -0700185 visibility: [
186 "//bootable/recovery/updater",
187 "//external/conscrypt",
188 "//external/python/cpython2",
189 "//frameworks/ml/nn/runtime/test",
190 "//hardware/interfaces/confirmationui/1.0/vts/functional",
191 "//hardware/interfaces/drm/1.0/vts/functional",
192 "//hardware/interfaces/drm/1.2/vts/functional",
193 "//hardware/interfaces/keymaster/3.0/vts/functional",
194 "//hardware/interfaces/keymaster/4.0/vts/functional",
195 "//system/core/adb",
196 "//system/core/init",
197 "//system/core/fs_mgr/liblp",
198 "//system/core/fs_mgr/liblp/vts_core",
199 "//system/core/fs_mgr/libsnapshot",
200 "//system/libvintf/test",
201 "//system/security/keystore/tests",
202 "//test/vts-testcase/security/avb",
203 ],
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100204 defaults: [
Pete Bentley47637342019-08-19 12:22:49 +0100205 "libcrypto_bcm_sources",
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100206 "libcrypto_sources",
207 "libcrypto_defaults",
208 "boringssl_defaults",
209 "boringssl_flags",
210 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700211}
212
Dan Willemsen21986fb2016-07-14 15:23:56 -0700213//// libssl
214
215// Target static library
Dan Willemsen21986fb2016-07-14 15:23:56 -0700216
217// Static and Shared library
218cc_library {
219 name: "libssl",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100220 visibility: ["//visibility:public"],
Dan Willemsenea55e182018-10-23 13:41:19 -0700221 recovery_available: true,
Justin Yun47949c52017-07-24 15:19:43 +0900222 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200223 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900224 vndk: {
225 enabled: true,
226 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700227 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100228 defaults: [
229 "libssl_sources",
230 "boringssl_defaults",
231 "boringssl_flags",
232 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700233 unique_host_soname: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -0700234
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700235 shared_libs: ["libcrypto"],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700236}
237
Dan Willemsen21986fb2016-07-14 15:23:56 -0700238// Tool
239cc_binary {
240 name: "bssl",
241 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100242 defaults: [
243 "bssl_sources",
244 "boringssl_flags",
245 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700246
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700247 shared_libs: [
248 "libcrypto",
249 "libssl",
250 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700251 target: {
Dan Willemsen21986fb2016-07-14 15:23:56 -0700252 darwin: {
253 enabled: false,
254 },
255 },
256}
Dan Willemsen2458a412016-07-15 09:28:31 -0700257
Adam Langley7c167932018-02-02 14:44:53 -0800258cc_binary {
259 name: "cavp",
260 host_supported: true,
261 srcs: [
Pete Bentley0c61efe2019-08-13 09:32:23 +0100262 "src/util/fipstools/cavp/cavp_aes_gcm_test.cc",
263 "src/util/fipstools/cavp/cavp_aes_test.cc",
264 "src/util/fipstools/cavp/cavp_ctr_drbg_test.cc",
265 "src/util/fipstools/cavp/cavp_ecdsa2_keypair_test.cc",
266 "src/util/fipstools/cavp/cavp_ecdsa2_pkv_test.cc",
267 "src/util/fipstools/cavp/cavp_ecdsa2_siggen_test.cc",
268 "src/util/fipstools/cavp/cavp_ecdsa2_sigver_test.cc",
269 "src/util/fipstools/cavp/cavp_hmac_test.cc",
270 "src/util/fipstools/cavp/cavp_kas_test.cc",
271 "src/util/fipstools/cavp/cavp_keywrap_test.cc",
272 "src/util/fipstools/cavp/cavp_main.cc",
273 "src/util/fipstools/cavp/cavp_rsa2_keygen_test.cc",
274 "src/util/fipstools/cavp/cavp_rsa2_siggen_test.cc",
275 "src/util/fipstools/cavp/cavp_rsa2_sigver_test.cc",
276 "src/util/fipstools/cavp/cavp_sha_monte_test.cc",
277 "src/util/fipstools/cavp/cavp_sha_test.cc",
278 "src/util/fipstools/cavp/cavp_tdes_test.cc",
279 "src/util/fipstools/cavp/cavp_test_util.cc",
280 "src/util/fipstools/cavp/cavp_tlskdf_test.cc",
Adam Langley7c167932018-02-02 14:44:53 -0800281 ],
282
283 shared_libs: [
284 "libcrypto",
285 ],
286
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100287 defaults: [
288 "boringssl_test_support_sources",
289 "boringssl_flags",
290 ],
Adam Langley7c167932018-02-02 14:44:53 -0800291}
292
Dan Willemsen2458a412016-07-15 09:28:31 -0700293// Test support library
294cc_library_static {
295 name: "boringssl_test_support",
296 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100297 defaults: [
298 "boringssl_test_support_sources",
299 "boringssl_flags",
300 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700301
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700302 shared_libs: [
303 "libcrypto",
304 "libssl",
305 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700306}
307
308// Tests
309cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100310 name: "boringssl_crypto_test",
311 test_suites: ["device-tests"],
312 host_supported: true,
313 defaults: [
314 "boringssl_crypto_test_sources",
315 "boringssl_flags",
316 ],
317 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500318
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100319 shared_libs: ["libcrypto"],
David Benjaminf31229b2017-01-25 14:08:15 -0500320}
321
322cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100323 name: "boringssl_ssl_test",
324 test_suites: ["device-tests"],
325 host_supported: true,
326 defaults: [
327 "boringssl_ssl_test_sources",
328 "boringssl_flags",
329 ],
330 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500331
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100332 shared_libs: [
333 "libcrypto",
334 "libssl",
335 ],
David Benjaminf31229b2017-01-25 14:08:15 -0500336}
Adam Langleyb6f75152019-10-18 12:20:11 -0700337
338// Utility binary for CMVP on-site testing.
339cc_binary {
Tobias Thierer6204b542019-10-18 21:55:05 +0100340 name: "test_fips",
341 host_supported: false,
342 defaults: [
343 "boringssl_flags",
344 ],
345 shared_libs: [
346 "libcrypto",
347 ],
348 srcs: [
349 "src/util/fipstools/cavp/test_fips.c",
350 ],
Adam Langleyb6f75152019-10-18 12:20:11 -0700351}