blob: a799db4a008d75f2de2077040d4c18ba63d93403 [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,
94 },
Pete Bentleye6a478a2019-08-19 22:20:24 +010095 target: {
96 android: {
97 cflags: [
98 "-DBORINGSSL_FIPS",
99 "-fPIC",
100 ],
101 linker_script: "src/crypto/fipsmodule/fips_shared.lds",
102 },
103 },
104}
105
106bootstrap_go_package {
107 name: "bssl_ar",
108 pkgPath: "boringssl.googlesource.com/boringssl/util/ar",
109 srcs: [
110 "src/util/ar/ar.go",
111 ],
112 testSrcs: [
113 "src/util/ar/ar_test.go",
114 ],
115}
116
117bootstrap_go_package {
118 name: "bssl_fipscommon",
119 pkgPath: "boringssl.googlesource.com/boringssl/util/fipstools/fipscommon",
120 srcs: [
121 "src/util/fipstools/fipscommon/const.go",
122 ],
123}
124
125blueprint_go_binary {
126 name: "bssl_inject_hash",
127 srcs: [
128 "src/util/fipstools/inject_hash/inject_hash.go",
129 ],
130 deps: [
131 "bssl_ar",
132 "bssl_fipscommon",
133 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700134}
135
136// Target and host library
137cc_library {
138 name: "libcrypto",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100139 visibility: ["//visibility:public"],
Vijay Venkatraman3caad952017-05-16 12:00:57 -0700140 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200141 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900142 vndk: {
143 enabled: true,
144 },
Jooyung Hanb6b07c32019-01-18 15:31:20 +0900145 double_loadable: true,
Jiyong Parkc3463952018-04-27 21:44:32 +0900146 recovery_available: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100147 defaults: [
148 "libcrypto_sources",
149 "libcrypto_defaults",
150 "boringssl_defaults",
151 "boringssl_flags",
152 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700153 unique_host_soname: true,
Pete Bentleye6a478a2019-08-19 22:20:24 +0100154 srcs: [
155 ":bcm_object",
156 ],
157 target: {
158 android: {
159 cflags: [
160 "-DBORINGSSL_FIPS",
161 ],
162 inject_bssl_hash: true,
Colin Cross4b979db2019-09-18 11:20:16 -0700163 static: {
164 // Disable the static version of libcrypto, as it causes
165 // problems for FIPS certification. Use libcrypto_static for
166 // modules that need static libcrypto but do not need FIPS self
167 // testing, or use dynamic libcrypto.
168 enabled: false,
169 },
Pete Bentleye6a478a2019-08-19 22:20:24 +0100170 },
171 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700172}
173
174// Static library
Colin Cross4b979db2019-09-18 11:20:16 -0700175// This version of libcrypto will not have FIPS self tests enabled, so its
176// usage is protected through visibility to ensure it doesn't end up used
177// somewhere that needs the FIPS version.
Dan Willemsen21986fb2016-07-14 15:23:56 -0700178cc_library_static {
179 name: "libcrypto_static",
Colin Cross4b979db2019-09-18 11:20:16 -0700180 visibility: [
181 "//bootable/recovery/updater",
182 "//external/conscrypt",
183 "//external/python/cpython2",
184 "//frameworks/ml/nn/runtime/test",
185 "//hardware/interfaces/confirmationui/1.0/vts/functional",
186 "//hardware/interfaces/drm/1.0/vts/functional",
187 "//hardware/interfaces/drm/1.2/vts/functional",
188 "//hardware/interfaces/keymaster/3.0/vts/functional",
189 "//hardware/interfaces/keymaster/4.0/vts/functional",
190 "//system/core/adb",
191 "//system/core/init",
192 "//system/core/fs_mgr/liblp",
193 "//system/core/fs_mgr/liblp/vts_core",
194 "//system/core/fs_mgr/libsnapshot",
195 "//system/libvintf/test",
196 "//system/security/keystore/tests",
197 "//test/vts-testcase/security/avb",
198 ],
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100199 defaults: [
Pete Bentley47637342019-08-19 12:22:49 +0100200 "libcrypto_bcm_sources",
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100201 "libcrypto_sources",
202 "libcrypto_defaults",
203 "boringssl_defaults",
204 "boringssl_flags",
205 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700206}
207
Dan Willemsen21986fb2016-07-14 15:23:56 -0700208//// libssl
209
210// Target static library
Dan Willemsen21986fb2016-07-14 15:23:56 -0700211
212// Static and Shared library
213cc_library {
214 name: "libssl",
Paul Duffincb6fdd22019-06-04 13:24:44 +0100215 visibility: ["//visibility:public"],
Dan Willemsenea55e182018-10-23 13:41:19 -0700216 recovery_available: true,
Justin Yun47949c52017-07-24 15:19:43 +0900217 vendor_available: true,
dimitry09dd3be2019-05-09 16:42:01 +0200218 native_bridge_supported: true,
Justin Yun47949c52017-07-24 15:19:43 +0900219 vndk: {
220 enabled: true,
221 },
Dan Willemsen21986fb2016-07-14 15:23:56 -0700222 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100223 defaults: [
224 "libssl_sources",
225 "boringssl_defaults",
226 "boringssl_flags",
227 ],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700228 unique_host_soname: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -0700229
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700230 shared_libs: ["libcrypto"],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700231}
232
Dan Willemsen21986fb2016-07-14 15:23:56 -0700233// Tool
234cc_binary {
235 name: "bssl",
236 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100237 defaults: [
238 "bssl_sources",
239 "boringssl_flags",
240 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700241
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700242 shared_libs: [
243 "libcrypto",
244 "libssl",
245 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700246 target: {
Dan Willemsen21986fb2016-07-14 15:23:56 -0700247 darwin: {
248 enabled: false,
249 },
250 },
251}
Dan Willemsen2458a412016-07-15 09:28:31 -0700252
Adam Langley7c167932018-02-02 14:44:53 -0800253cc_binary {
254 name: "cavp",
255 host_supported: true,
256 srcs: [
Pete Bentley0c61efe2019-08-13 09:32:23 +0100257 "src/util/fipstools/cavp/cavp_aes_gcm_test.cc",
258 "src/util/fipstools/cavp/cavp_aes_test.cc",
259 "src/util/fipstools/cavp/cavp_ctr_drbg_test.cc",
260 "src/util/fipstools/cavp/cavp_ecdsa2_keypair_test.cc",
261 "src/util/fipstools/cavp/cavp_ecdsa2_pkv_test.cc",
262 "src/util/fipstools/cavp/cavp_ecdsa2_siggen_test.cc",
263 "src/util/fipstools/cavp/cavp_ecdsa2_sigver_test.cc",
264 "src/util/fipstools/cavp/cavp_hmac_test.cc",
265 "src/util/fipstools/cavp/cavp_kas_test.cc",
266 "src/util/fipstools/cavp/cavp_keywrap_test.cc",
267 "src/util/fipstools/cavp/cavp_main.cc",
268 "src/util/fipstools/cavp/cavp_rsa2_keygen_test.cc",
269 "src/util/fipstools/cavp/cavp_rsa2_siggen_test.cc",
270 "src/util/fipstools/cavp/cavp_rsa2_sigver_test.cc",
271 "src/util/fipstools/cavp/cavp_sha_monte_test.cc",
272 "src/util/fipstools/cavp/cavp_sha_test.cc",
273 "src/util/fipstools/cavp/cavp_tdes_test.cc",
274 "src/util/fipstools/cavp/cavp_test_util.cc",
275 "src/util/fipstools/cavp/cavp_tlskdf_test.cc",
Adam Langley7c167932018-02-02 14:44:53 -0800276 ],
277
278 shared_libs: [
279 "libcrypto",
280 ],
281
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100282 defaults: [
283 "boringssl_test_support_sources",
284 "boringssl_flags",
285 ],
Adam Langley7c167932018-02-02 14:44:53 -0800286}
287
Dan Willemsen2458a412016-07-15 09:28:31 -0700288// Test support library
289cc_library_static {
290 name: "boringssl_test_support",
291 host_supported: true,
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100292 defaults: [
293 "boringssl_test_support_sources",
294 "boringssl_flags",
295 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700296
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700297 shared_libs: [
298 "libcrypto",
299 "libssl",
300 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700301}
302
303// Tests
304cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100305 name: "boringssl_crypto_test",
306 test_suites: ["device-tests"],
307 host_supported: true,
308 defaults: [
309 "boringssl_crypto_test_sources",
310 "boringssl_flags",
311 ],
312 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500313
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100314 shared_libs: ["libcrypto"],
David Benjaminf31229b2017-01-25 14:08:15 -0500315}
316
317cc_test {
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100318 name: "boringssl_ssl_test",
319 test_suites: ["device-tests"],
320 host_supported: true,
321 defaults: [
322 "boringssl_ssl_test_sources",
323 "boringssl_flags",
324 ],
325 whole_static_libs: ["boringssl_test_support"],
David Benjaminf31229b2017-01-25 14:08:15 -0500326
Paul Duffinf6a61fd2019-06-25 12:06:25 +0100327 shared_libs: [
328 "libcrypto",
329 "libssl",
330 ],
David Benjaminf31229b2017-01-25 14:08:15 -0500331}
Adam Langleyb6f75152019-10-18 12:20:11 -0700332
333// Utility binary for CMVP on-site testing.
334cc_binary {
335 name: "test_fips",
336 host_supported: false,
337 defaults: [
338 "boringssl_flags",
339 ],
340 shared_libs: [
341 "libcrypto",
342 ],
343 srcs: [
344 "src/util/fipstools/cavp/test_fips.c",
345 ],
346}