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"], |
| 73 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 74 | arch: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 75 | arm64: { |
| 76 | clang_asflags: ["-march=armv8-a+crypto"], |
| 77 | }, |
| 78 | }, |
Pete Bentley | e6a478a | 2019-08-19 22:20:24 +0100 | [diff] [blame^] | 79 | // To allow integrity check to read and checksum the code |
| 80 | xom: false, |
| 81 | } |
| 82 | |
| 83 | cc_object { |
| 84 | name: "bcm_object", |
| 85 | device_supported: true, |
| 86 | recovery_available: true, |
| 87 | native_bridge_supported: true, |
| 88 | defaults: [ |
| 89 | "libcrypto_bcm_sources", |
| 90 | "libcrypto_defaults", |
| 91 | "boringssl_defaults", |
| 92 | "boringssl_flags", |
| 93 | ], |
| 94 | target: { |
| 95 | android: { |
| 96 | cflags: [ |
| 97 | "-DBORINGSSL_FIPS", |
| 98 | "-fPIC", |
| 99 | ], |
| 100 | linker_script: "src/crypto/fipsmodule/fips_shared.lds", |
| 101 | }, |
| 102 | }, |
| 103 | } |
| 104 | |
| 105 | bootstrap_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 | |
| 116 | bootstrap_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 | |
| 124 | blueprint_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 Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | // Target and host library |
| 136 | cc_library { |
| 137 | name: "libcrypto", |
Paul Duffin | cb6fdd2 | 2019-06-04 13:24:44 +0100 | [diff] [blame] | 138 | visibility: ["//visibility:public"], |
Vijay Venkatraman | 3caad95 | 2017-05-16 12:00:57 -0700 | [diff] [blame] | 139 | vendor_available: true, |
dimitry | 09dd3be | 2019-05-09 16:42:01 +0200 | [diff] [blame] | 140 | native_bridge_supported: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 141 | vndk: { |
| 142 | enabled: true, |
| 143 | }, |
Jooyung Han | b6b07c3 | 2019-01-18 15:31:20 +0900 | [diff] [blame] | 144 | double_loadable: true, |
Jiyong Park | c346395 | 2018-04-27 21:44:32 +0900 | [diff] [blame] | 145 | recovery_available: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 146 | defaults: [ |
| 147 | "libcrypto_sources", |
| 148 | "libcrypto_defaults", |
| 149 | "boringssl_defaults", |
| 150 | "boringssl_flags", |
| 151 | ], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 152 | unique_host_soname: true, |
Pete Bentley | e6a478a | 2019-08-19 22:20:24 +0100 | [diff] [blame^] | 153 | srcs: [ |
| 154 | ":bcm_object", |
| 155 | ], |
| 156 | target: { |
| 157 | android: { |
| 158 | cflags: [ |
| 159 | "-DBORINGSSL_FIPS", |
| 160 | ], |
| 161 | inject_bssl_hash: true, |
| 162 | }, |
| 163 | }, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | // Static library |
| 167 | // This should only be used for host modules that will be in a JVM, all other |
| 168 | // modules should use the static variant of libcrypto. |
| 169 | cc_library_static { |
| 170 | name: "libcrypto_static", |
Paul Duffin | cb6fdd2 | 2019-06-04 13:24:44 +0100 | [diff] [blame] | 171 | visibility: ["//visibility:public"], |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 172 | defaults: [ |
Pete Bentley | 4763734 | 2019-08-19 12:22:49 +0100 | [diff] [blame] | 173 | "libcrypto_bcm_sources", |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 174 | "libcrypto_sources", |
| 175 | "libcrypto_defaults", |
| 176 | "boringssl_defaults", |
| 177 | "boringssl_flags", |
| 178 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 179 | |
| 180 | target: { |
| 181 | host: { |
David Benjamin | c0dedc0 | 2017-01-24 17:54:24 -0500 | [diff] [blame] | 182 | // TODO: b/26160319. ASAN breaks use of this library in JVM. |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 183 | // Re-enable sanitization when the issue with making clients of this library |
| 184 | // preload ASAN runtime is resolved. Without that, clients are getting runtime |
David Benjamin | c0dedc0 | 2017-01-24 17:54:24 -0500 | [diff] [blame] | 185 | // errors due to unresolved ASAN symbols, such as |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 186 | // __asan_option_detect_stack_use_after_return. |
| 187 | sanitize: { |
| 188 | never: true, |
| 189 | }, |
| 190 | }, |
| 191 | }, |
| 192 | } |
| 193 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 194 | //// libssl |
| 195 | |
| 196 | // Target static library |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 197 | |
| 198 | // Static and Shared library |
| 199 | cc_library { |
| 200 | name: "libssl", |
Paul Duffin | cb6fdd2 | 2019-06-04 13:24:44 +0100 | [diff] [blame] | 201 | visibility: ["//visibility:public"], |
Dan Willemsen | ea55e18 | 2018-10-23 13:41:19 -0700 | [diff] [blame] | 202 | recovery_available: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 203 | vendor_available: true, |
dimitry | 09dd3be | 2019-05-09 16:42:01 +0200 | [diff] [blame] | 204 | native_bridge_supported: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 205 | vndk: { |
| 206 | enabled: true, |
| 207 | }, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 208 | host_supported: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 209 | defaults: [ |
| 210 | "libssl_sources", |
| 211 | "boringssl_defaults", |
| 212 | "boringssl_flags", |
| 213 | ], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 214 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 215 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 216 | shared_libs: ["libcrypto"], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 217 | } |
| 218 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 219 | // Tool |
| 220 | cc_binary { |
| 221 | name: "bssl", |
| 222 | host_supported: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 223 | defaults: [ |
| 224 | "bssl_sources", |
| 225 | "boringssl_flags", |
| 226 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 227 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 228 | shared_libs: [ |
| 229 | "libcrypto", |
| 230 | "libssl", |
| 231 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 232 | target: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 233 | darwin: { |
| 234 | enabled: false, |
| 235 | }, |
| 236 | }, |
| 237 | } |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 238 | |
Adam Langley | 7c16793 | 2018-02-02 14:44:53 -0800 | [diff] [blame] | 239 | cc_binary { |
| 240 | name: "cavp", |
| 241 | host_supported: true, |
| 242 | srcs: [ |
Pete Bentley | 0c61efe | 2019-08-13 09:32:23 +0100 | [diff] [blame] | 243 | "src/util/fipstools/cavp/cavp_aes_gcm_test.cc", |
| 244 | "src/util/fipstools/cavp/cavp_aes_test.cc", |
| 245 | "src/util/fipstools/cavp/cavp_ctr_drbg_test.cc", |
| 246 | "src/util/fipstools/cavp/cavp_ecdsa2_keypair_test.cc", |
| 247 | "src/util/fipstools/cavp/cavp_ecdsa2_pkv_test.cc", |
| 248 | "src/util/fipstools/cavp/cavp_ecdsa2_siggen_test.cc", |
| 249 | "src/util/fipstools/cavp/cavp_ecdsa2_sigver_test.cc", |
| 250 | "src/util/fipstools/cavp/cavp_hmac_test.cc", |
| 251 | "src/util/fipstools/cavp/cavp_kas_test.cc", |
| 252 | "src/util/fipstools/cavp/cavp_keywrap_test.cc", |
| 253 | "src/util/fipstools/cavp/cavp_main.cc", |
| 254 | "src/util/fipstools/cavp/cavp_rsa2_keygen_test.cc", |
| 255 | "src/util/fipstools/cavp/cavp_rsa2_siggen_test.cc", |
| 256 | "src/util/fipstools/cavp/cavp_rsa2_sigver_test.cc", |
| 257 | "src/util/fipstools/cavp/cavp_sha_monte_test.cc", |
| 258 | "src/util/fipstools/cavp/cavp_sha_test.cc", |
| 259 | "src/util/fipstools/cavp/cavp_tdes_test.cc", |
| 260 | "src/util/fipstools/cavp/cavp_test_util.cc", |
| 261 | "src/util/fipstools/cavp/cavp_tlskdf_test.cc", |
Adam Langley | 7c16793 | 2018-02-02 14:44:53 -0800 | [diff] [blame] | 262 | ], |
| 263 | |
| 264 | shared_libs: [ |
| 265 | "libcrypto", |
| 266 | ], |
| 267 | |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 268 | defaults: [ |
| 269 | "boringssl_test_support_sources", |
| 270 | "boringssl_flags", |
| 271 | ], |
Adam Langley | 7c16793 | 2018-02-02 14:44:53 -0800 | [diff] [blame] | 272 | } |
| 273 | |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 274 | // Test support library |
| 275 | cc_library_static { |
| 276 | name: "boringssl_test_support", |
| 277 | host_supported: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 278 | defaults: [ |
| 279 | "boringssl_test_support_sources", |
| 280 | "boringssl_flags", |
| 281 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 282 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 283 | shared_libs: [ |
| 284 | "libcrypto", |
| 285 | "libssl", |
| 286 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | // Tests |
| 290 | cc_test { |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 291 | name: "boringssl_crypto_test", |
| 292 | test_suites: ["device-tests"], |
| 293 | host_supported: true, |
| 294 | defaults: [ |
| 295 | "boringssl_crypto_test_sources", |
| 296 | "boringssl_flags", |
| 297 | ], |
| 298 | whole_static_libs: ["boringssl_test_support"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 299 | |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 300 | shared_libs: ["libcrypto"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | cc_test { |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 304 | name: "boringssl_ssl_test", |
| 305 | test_suites: ["device-tests"], |
| 306 | host_supported: true, |
| 307 | defaults: [ |
| 308 | "boringssl_ssl_test_sources", |
| 309 | "boringssl_flags", |
| 310 | ], |
| 311 | whole_static_libs: ["boringssl_test_support"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 312 | |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 313 | shared_libs: [ |
| 314 | "libcrypto", |
| 315 | "libssl", |
| 316 | ], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 317 | } |