Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 1 | // 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 Duffin | cb6fdd2 | 2019-06-04 13:24:44 +0100 | [diff] [blame] | 5 | package { |
| 6 | default_visibility: ["//visibility:private"], |
| 7 | } |
| 8 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 9 | // Pull in the autogenerated sources modules |
| 10 | build = ["sources.bp"] |
| 11 | |
| 12 | // Used by libcrypto, libssl, bssl tool, and native tests |
| 13 | cc_defaults { |
| 14 | name: "boringssl_flags", |
Steven Moreland | f593be8 | 2017-04-14 04:51:23 -0700 | [diff] [blame] | 15 | vendor_available: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 16 | |
| 17 | cflags: [ |
| 18 | "-fvisibility=hidden", |
| 19 | "-DBORINGSSL_SHARED_LIBRARY", |
David Benjamin | fc8a786 | 2018-06-25 19:02:46 -0400 | [diff] [blame] | 20 | "-DBORINGSSL_ANDROID_SYSTEM", |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 21 | "-DOPENSSL_SMALL", |
| 22 | "-D_XOPEN_SOURCE=700", |
Chih-Hung Hsieh | 9146d99 | 2017-09-27 10:26:03 -0700 | [diff] [blame] | 23 | "-Werror", |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 24 | "-Wno-unused-parameter", |
| 25 | ], |
| 26 | |
| 27 | cppflags: [ |
| 28 | "-Wall", |
| 29 | "-Werror", |
| 30 | ], |
| 31 | |
| 32 | conlyflags: ["-std=c99"], |
David Benjamin | fc8a786 | 2018-06-25 19:02:46 -0400 | [diff] [blame] | 33 | |
| 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 Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | // Used by libcrypto + libssl |
| 44 | cc_defaults { |
| 45 | name: "boringssl_defaults", |
| 46 | |
| 47 | local_include_dirs: ["src/include"], |
| 48 | export_include_dirs: ["src/include"], |
David Benjamin | fc8a786 | 2018-06-25 19:02:46 -0400 | [diff] [blame] | 49 | cflags: ["-DBORINGSSL_IMPLEMENTATION"], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | //// libcrypto |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 53 | cc_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 Root | 7b550be | 2016-09-20 15:25:24 -0700 | [diff] [blame] | 67 | host: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 68 | host_ldlibs: ["-lpthread"], |
| 69 | }, |
| 70 | }, |
| 71 | |
| 72 | local_include_dirs: ["src/crypto"], |
Pete Bentley | e6a478a | 2019-08-19 22:20:24 +0100 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | cc_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 Collingbourne | 22f5f87 | 2019-09-27 15:32:38 -0700 | [diff] [blame] | 86 | sanitize: { |
| 87 | address: false, |
Tobias Thierer | 6204b54 | 2019-10-18 21:55:05 +0100 | [diff] [blame] | 88 | hwaddress: false, |
Mitch Phillips | f5a6078 | 2019-12-10 08:47:30 -0800 | [diff] [blame] | 89 | fuzzer: false, |
Peter Collingbourne | 22f5f87 | 2019-09-27 15:32:38 -0700 | [diff] [blame] | 90 | }, |
Pete Bentley | e6a478a | 2019-08-19 22:20:24 +0100 | [diff] [blame] | 91 | target: { |
| 92 | android: { |
| 93 | cflags: [ |
| 94 | "-DBORINGSSL_FIPS", |
| 95 | "-fPIC", |
Pete Bentley | 1d07cf8 | 2019-10-18 12:49:31 +0100 | [diff] [blame] | 96 | // -fno[data|text]-sections required to ensure a |
| 97 | // single text and data section for FIPS integrity check |
| 98 | "-fno-data-sections", |
| 99 | "-fno-function-sections", |
Pete Bentley | e6a478a | 2019-08-19 22:20:24 +0100 | [diff] [blame] | 100 | ], |
| 101 | linker_script: "src/crypto/fipsmodule/fips_shared.lds", |
| 102 | }, |
Peter Collingbourne | 0560ada | 2019-11-22 13:50:29 -0800 | [diff] [blame] | 103 | // Temporary hack to let BoringSSL build with a new compiler. |
| 104 | // This doesn't enable HWASAN unconditionally, it just causes |
| 105 | // BoringSSL's asm code to unconditionally use a HWASAN-compatible |
| 106 | // global variable reference so that the non-HWASANified (because of |
| 107 | // sanitize: { hwaddress: false } above) code in the BCM can |
| 108 | // successfully link against the HWASANified code in the rest of |
| 109 | // BoringSSL in HWASAN builds. |
| 110 | android_arm64: { |
| 111 | asflags: [ |
| 112 | "-fsanitize=hwaddress", |
| 113 | ], |
| 114 | }, |
Pete Bentley | e6a478a | 2019-08-19 22:20:24 +0100 | [diff] [blame] | 115 | }, |
| 116 | } |
| 117 | |
| 118 | bootstrap_go_package { |
| 119 | name: "bssl_ar", |
| 120 | pkgPath: "boringssl.googlesource.com/boringssl/util/ar", |
| 121 | srcs: [ |
| 122 | "src/util/ar/ar.go", |
| 123 | ], |
| 124 | testSrcs: [ |
| 125 | "src/util/ar/ar_test.go", |
| 126 | ], |
| 127 | } |
| 128 | |
| 129 | bootstrap_go_package { |
| 130 | name: "bssl_fipscommon", |
| 131 | pkgPath: "boringssl.googlesource.com/boringssl/util/fipstools/fipscommon", |
| 132 | srcs: [ |
| 133 | "src/util/fipstools/fipscommon/const.go", |
| 134 | ], |
| 135 | } |
| 136 | |
| 137 | blueprint_go_binary { |
| 138 | name: "bssl_inject_hash", |
| 139 | srcs: [ |
| 140 | "src/util/fipstools/inject_hash/inject_hash.go", |
| 141 | ], |
| 142 | deps: [ |
| 143 | "bssl_ar", |
| 144 | "bssl_fipscommon", |
| 145 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | // Target and host library |
| 149 | cc_library { |
| 150 | name: "libcrypto", |
Paul Duffin | cb6fdd2 | 2019-06-04 13:24:44 +0100 | [diff] [blame] | 151 | visibility: ["//visibility:public"], |
Vijay Venkatraman | 3caad95 | 2017-05-16 12:00:57 -0700 | [diff] [blame] | 152 | vendor_available: true, |
dimitry | 09dd3be | 2019-05-09 16:42:01 +0200 | [diff] [blame] | 153 | native_bridge_supported: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 154 | vndk: { |
| 155 | enabled: true, |
| 156 | }, |
Jooyung Han | b6b07c3 | 2019-01-18 15:31:20 +0900 | [diff] [blame] | 157 | double_loadable: true, |
Jiyong Park | c346395 | 2018-04-27 21:44:32 +0900 | [diff] [blame] | 158 | recovery_available: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 159 | defaults: [ |
| 160 | "libcrypto_sources", |
| 161 | "libcrypto_defaults", |
| 162 | "boringssl_defaults", |
| 163 | "boringssl_flags", |
| 164 | ], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 165 | unique_host_soname: true, |
Pete Bentley | e6a478a | 2019-08-19 22:20:24 +0100 | [diff] [blame] | 166 | srcs: [ |
| 167 | ":bcm_object", |
| 168 | ], |
| 169 | target: { |
| 170 | android: { |
| 171 | cflags: [ |
| 172 | "-DBORINGSSL_FIPS", |
| 173 | ], |
| 174 | inject_bssl_hash: true, |
Colin Cross | 4b979db | 2019-09-18 11:20:16 -0700 | [diff] [blame] | 175 | static: { |
| 176 | // Disable the static version of libcrypto, as it causes |
| 177 | // problems for FIPS certification. Use libcrypto_static for |
| 178 | // modules that need static libcrypto but do not need FIPS self |
| 179 | // testing, or use dynamic libcrypto. |
| 180 | enabled: false, |
| 181 | }, |
Pete Bentley | e6a478a | 2019-08-19 22:20:24 +0100 | [diff] [blame] | 182 | }, |
| 183 | }, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | // Static library |
Colin Cross | 4b979db | 2019-09-18 11:20:16 -0700 | [diff] [blame] | 187 | // This version of libcrypto will not have FIPS self tests enabled, so its |
| 188 | // usage is protected through visibility to ensure it doesn't end up used |
| 189 | // somewhere that needs the FIPS version. |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 190 | cc_library_static { |
| 191 | name: "libcrypto_static", |
Colin Cross | 4b979db | 2019-09-18 11:20:16 -0700 | [diff] [blame] | 192 | visibility: [ |
| 193 | "//bootable/recovery/updater", |
| 194 | "//external/conscrypt", |
| 195 | "//external/python/cpython2", |
Przemyslaw Szczepaniak | 0f2e90f | 2019-10-31 13:41:16 +0000 | [diff] [blame] | 196 | "//frameworks/ml/nn/runtime:__subpackages__", |
Colin Cross | 4b979db | 2019-09-18 11:20:16 -0700 | [diff] [blame] | 197 | "//hardware/interfaces/confirmationui/1.0/vts/functional", |
| 198 | "//hardware/interfaces/drm/1.0/vts/functional", |
| 199 | "//hardware/interfaces/drm/1.2/vts/functional", |
Robert Shih | 6526b5c | 2020-01-21 11:03:32 -0800 | [diff] [blame^] | 200 | "//hardware/interfaces/drm/1.3/vts/functional", |
Colin Cross | 4b979db | 2019-09-18 11:20:16 -0700 | [diff] [blame] | 201 | "//hardware/interfaces/keymaster/3.0/vts/functional", |
| 202 | "//hardware/interfaces/keymaster/4.0/vts/functional", |
Shawn Willden | 1ff77d0 | 2020-01-16 23:52:56 -0700 | [diff] [blame] | 203 | "//hardware/interfaces/keymaster/4.1/vts/functional", |
Luke Huang | 16a30fc | 2019-11-22 11:44:50 +0800 | [diff] [blame] | 204 | "//packages/modules/DnsResolver/tests:__subpackages__", |
Colin Cross | 4b979db | 2019-09-18 11:20:16 -0700 | [diff] [blame] | 205 | "//system/core/adb", |
| 206 | "//system/core/init", |
| 207 | "//system/core/fs_mgr/liblp", |
| 208 | "//system/core/fs_mgr/liblp/vts_core", |
| 209 | "//system/core/fs_mgr/libsnapshot", |
| 210 | "//system/libvintf/test", |
| 211 | "//system/security/keystore/tests", |
| 212 | "//test/vts-testcase/security/avb", |
| 213 | ], |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 214 | defaults: [ |
Pete Bentley | 4763734 | 2019-08-19 12:22:49 +0100 | [diff] [blame] | 215 | "libcrypto_bcm_sources", |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 216 | "libcrypto_sources", |
| 217 | "libcrypto_defaults", |
| 218 | "boringssl_defaults", |
| 219 | "boringssl_flags", |
| 220 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 221 | } |
| 222 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 223 | //// libssl |
| 224 | |
| 225 | // Target static library |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 226 | |
| 227 | // Static and Shared library |
| 228 | cc_library { |
| 229 | name: "libssl", |
Paul Duffin | cb6fdd2 | 2019-06-04 13:24:44 +0100 | [diff] [blame] | 230 | visibility: ["//visibility:public"], |
Dan Willemsen | ea55e18 | 2018-10-23 13:41:19 -0700 | [diff] [blame] | 231 | recovery_available: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 232 | vendor_available: true, |
dimitry | 09dd3be | 2019-05-09 16:42:01 +0200 | [diff] [blame] | 233 | native_bridge_supported: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 234 | vndk: { |
| 235 | enabled: true, |
| 236 | }, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 237 | host_supported: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 238 | defaults: [ |
| 239 | "libssl_sources", |
| 240 | "boringssl_defaults", |
| 241 | "boringssl_flags", |
| 242 | ], |
Joshua Duong | 81ce7a5 | 2019-10-31 12:44:47 -0700 | [diff] [blame] | 243 | target: { |
| 244 | windows: { |
| 245 | enabled: true, |
| 246 | }, |
| 247 | }, |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 248 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 249 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 250 | shared_libs: ["libcrypto"], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 251 | } |
| 252 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 253 | // Tool |
| 254 | cc_binary { |
| 255 | name: "bssl", |
| 256 | host_supported: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 257 | defaults: [ |
| 258 | "bssl_sources", |
| 259 | "boringssl_flags", |
| 260 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 261 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 262 | shared_libs: [ |
| 263 | "libcrypto", |
| 264 | "libssl", |
| 265 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 266 | target: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 267 | darwin: { |
| 268 | enabled: false, |
| 269 | }, |
| 270 | }, |
| 271 | } |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 272 | |
Adam Langley | 7c16793 | 2018-02-02 14:44:53 -0800 | [diff] [blame] | 273 | cc_binary { |
| 274 | name: "cavp", |
| 275 | host_supported: true, |
| 276 | srcs: [ |
Pete Bentley | 0c61efe | 2019-08-13 09:32:23 +0100 | [diff] [blame] | 277 | "src/util/fipstools/cavp/cavp_aes_gcm_test.cc", |
| 278 | "src/util/fipstools/cavp/cavp_aes_test.cc", |
| 279 | "src/util/fipstools/cavp/cavp_ctr_drbg_test.cc", |
| 280 | "src/util/fipstools/cavp/cavp_ecdsa2_keypair_test.cc", |
| 281 | "src/util/fipstools/cavp/cavp_ecdsa2_pkv_test.cc", |
| 282 | "src/util/fipstools/cavp/cavp_ecdsa2_siggen_test.cc", |
| 283 | "src/util/fipstools/cavp/cavp_ecdsa2_sigver_test.cc", |
| 284 | "src/util/fipstools/cavp/cavp_hmac_test.cc", |
| 285 | "src/util/fipstools/cavp/cavp_kas_test.cc", |
| 286 | "src/util/fipstools/cavp/cavp_keywrap_test.cc", |
| 287 | "src/util/fipstools/cavp/cavp_main.cc", |
| 288 | "src/util/fipstools/cavp/cavp_rsa2_keygen_test.cc", |
| 289 | "src/util/fipstools/cavp/cavp_rsa2_siggen_test.cc", |
| 290 | "src/util/fipstools/cavp/cavp_rsa2_sigver_test.cc", |
| 291 | "src/util/fipstools/cavp/cavp_sha_monte_test.cc", |
| 292 | "src/util/fipstools/cavp/cavp_sha_test.cc", |
| 293 | "src/util/fipstools/cavp/cavp_tdes_test.cc", |
| 294 | "src/util/fipstools/cavp/cavp_test_util.cc", |
| 295 | "src/util/fipstools/cavp/cavp_tlskdf_test.cc", |
Adam Langley | 7c16793 | 2018-02-02 14:44:53 -0800 | [diff] [blame] | 296 | ], |
| 297 | |
| 298 | shared_libs: [ |
| 299 | "libcrypto", |
| 300 | ], |
| 301 | |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 302 | defaults: [ |
| 303 | "boringssl_test_support_sources", |
| 304 | "boringssl_flags", |
| 305 | ], |
Adam Langley | 7c16793 | 2018-02-02 14:44:53 -0800 | [diff] [blame] | 306 | } |
| 307 | |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 308 | // Test support library |
| 309 | cc_library_static { |
| 310 | name: "boringssl_test_support", |
| 311 | host_supported: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 312 | defaults: [ |
| 313 | "boringssl_test_support_sources", |
| 314 | "boringssl_flags", |
| 315 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 316 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 317 | shared_libs: [ |
| 318 | "libcrypto", |
| 319 | "libssl", |
| 320 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | // Tests |
| 324 | cc_test { |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 325 | name: "boringssl_crypto_test", |
| 326 | test_suites: ["device-tests"], |
| 327 | host_supported: true, |
| 328 | defaults: [ |
| 329 | "boringssl_crypto_test_sources", |
| 330 | "boringssl_flags", |
| 331 | ], |
| 332 | whole_static_libs: ["boringssl_test_support"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 333 | |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 334 | shared_libs: ["libcrypto"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 335 | } |
| 336 | |
| 337 | cc_test { |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 338 | name: "boringssl_ssl_test", |
| 339 | test_suites: ["device-tests"], |
| 340 | host_supported: true, |
| 341 | defaults: [ |
| 342 | "boringssl_ssl_test_sources", |
| 343 | "boringssl_flags", |
| 344 | ], |
| 345 | whole_static_libs: ["boringssl_test_support"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 346 | |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 347 | shared_libs: [ |
| 348 | "libcrypto", |
| 349 | "libssl", |
| 350 | ], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 351 | } |
Adam Langley | b6f7515 | 2019-10-18 12:20:11 -0700 | [diff] [blame] | 352 | |
| 353 | // Utility binary for CMVP on-site testing. |
| 354 | cc_binary { |
Tobias Thierer | 6204b54 | 2019-10-18 21:55:05 +0100 | [diff] [blame] | 355 | name: "test_fips", |
| 356 | host_supported: false, |
| 357 | defaults: [ |
| 358 | "boringssl_flags", |
| 359 | ], |
| 360 | shared_libs: [ |
| 361 | "libcrypto", |
| 362 | ], |
| 363 | srcs: [ |
| 364 | "src/util/fipstools/cavp/test_fips.c", |
| 365 | ], |
Adam Langley | b6f7515 | 2019-10-18 12:20:11 -0700 | [diff] [blame] | 366 | } |