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 | } |
| 80 | |
| 81 | cc_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 | ], |
| 92 | target: { |
| 93 | android: { |
| 94 | cflags: [ |
| 95 | "-DBORINGSSL_FIPS", |
| 96 | "-fPIC", |
| 97 | ], |
| 98 | linker_script: "src/crypto/fipsmodule/fips_shared.lds", |
| 99 | }, |
| 100 | }, |
| 101 | } |
| 102 | |
| 103 | bootstrap_go_package { |
| 104 | name: "bssl_ar", |
| 105 | pkgPath: "boringssl.googlesource.com/boringssl/util/ar", |
| 106 | srcs: [ |
| 107 | "src/util/ar/ar.go", |
| 108 | ], |
| 109 | testSrcs: [ |
| 110 | "src/util/ar/ar_test.go", |
| 111 | ], |
| 112 | } |
| 113 | |
| 114 | bootstrap_go_package { |
| 115 | name: "bssl_fipscommon", |
| 116 | pkgPath: "boringssl.googlesource.com/boringssl/util/fipstools/fipscommon", |
| 117 | srcs: [ |
| 118 | "src/util/fipstools/fipscommon/const.go", |
| 119 | ], |
| 120 | } |
| 121 | |
| 122 | blueprint_go_binary { |
| 123 | name: "bssl_inject_hash", |
| 124 | srcs: [ |
| 125 | "src/util/fipstools/inject_hash/inject_hash.go", |
| 126 | ], |
| 127 | deps: [ |
| 128 | "bssl_ar", |
| 129 | "bssl_fipscommon", |
| 130 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | // Target and host library |
| 134 | cc_library { |
| 135 | name: "libcrypto", |
Paul Duffin | cb6fdd2 | 2019-06-04 13:24:44 +0100 | [diff] [blame] | 136 | visibility: ["//visibility:public"], |
Vijay Venkatraman | 3caad95 | 2017-05-16 12:00:57 -0700 | [diff] [blame] | 137 | vendor_available: true, |
dimitry | 09dd3be | 2019-05-09 16:42:01 +0200 | [diff] [blame] | 138 | native_bridge_supported: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 139 | vndk: { |
| 140 | enabled: true, |
| 141 | }, |
Jooyung Han | b6b07c3 | 2019-01-18 15:31:20 +0900 | [diff] [blame] | 142 | double_loadable: true, |
Jiyong Park | c346395 | 2018-04-27 21:44:32 +0900 | [diff] [blame] | 143 | recovery_available: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 144 | defaults: [ |
| 145 | "libcrypto_sources", |
| 146 | "libcrypto_defaults", |
| 147 | "boringssl_defaults", |
| 148 | "boringssl_flags", |
| 149 | ], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 150 | unique_host_soname: true, |
Pete Bentley | e6a478a | 2019-08-19 22:20:24 +0100 | [diff] [blame] | 151 | srcs: [ |
| 152 | ":bcm_object", |
| 153 | ], |
| 154 | target: { |
| 155 | android: { |
| 156 | cflags: [ |
| 157 | "-DBORINGSSL_FIPS", |
| 158 | ], |
| 159 | inject_bssl_hash: true, |
Colin Cross | 4b979db | 2019-09-18 11:20:16 -0700 | [diff] [blame] | 160 | static: { |
| 161 | // Disable the static version of libcrypto, as it causes |
| 162 | // problems for FIPS certification. Use libcrypto_static for |
| 163 | // modules that need static libcrypto but do not need FIPS self |
| 164 | // testing, or use dynamic libcrypto. |
| 165 | enabled: false, |
| 166 | }, |
Pete Bentley | e6a478a | 2019-08-19 22:20:24 +0100 | [diff] [blame] | 167 | }, |
| 168 | }, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 169 | } |
| 170 | |
| 171 | // Static library |
Colin Cross | 4b979db | 2019-09-18 11:20:16 -0700 | [diff] [blame] | 172 | // This version of libcrypto will not have FIPS self tests enabled, so its |
| 173 | // usage is protected through visibility to ensure it doesn't end up used |
| 174 | // somewhere that needs the FIPS version. |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 175 | cc_library_static { |
| 176 | name: "libcrypto_static", |
Colin Cross | 4b979db | 2019-09-18 11:20:16 -0700 | [diff] [blame] | 177 | visibility: [ |
| 178 | "//bootable/recovery/updater", |
| 179 | "//external/conscrypt", |
| 180 | "//external/python/cpython2", |
| 181 | "//frameworks/ml/nn/runtime/test", |
| 182 | "//hardware/interfaces/confirmationui/1.0/vts/functional", |
| 183 | "//hardware/interfaces/drm/1.0/vts/functional", |
| 184 | "//hardware/interfaces/drm/1.2/vts/functional", |
| 185 | "//hardware/interfaces/keymaster/3.0/vts/functional", |
| 186 | "//hardware/interfaces/keymaster/4.0/vts/functional", |
| 187 | "//system/core/adb", |
| 188 | "//system/core/init", |
| 189 | "//system/core/fs_mgr/liblp", |
| 190 | "//system/core/fs_mgr/liblp/vts_core", |
| 191 | "//system/core/fs_mgr/libsnapshot", |
| 192 | "//system/libvintf/test", |
| 193 | "//system/security/keystore/tests", |
| 194 | "//test/vts-testcase/security/avb", |
| 195 | ], |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 196 | defaults: [ |
Pete Bentley | 4763734 | 2019-08-19 12:22:49 +0100 | [diff] [blame] | 197 | "libcrypto_bcm_sources", |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 198 | "libcrypto_sources", |
| 199 | "libcrypto_defaults", |
| 200 | "boringssl_defaults", |
| 201 | "boringssl_flags", |
| 202 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 203 | } |
| 204 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 205 | //// libssl |
| 206 | |
| 207 | // Target static library |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 208 | |
| 209 | // Static and Shared library |
| 210 | cc_library { |
| 211 | name: "libssl", |
Paul Duffin | cb6fdd2 | 2019-06-04 13:24:44 +0100 | [diff] [blame] | 212 | visibility: ["//visibility:public"], |
Dan Willemsen | ea55e18 | 2018-10-23 13:41:19 -0700 | [diff] [blame] | 213 | recovery_available: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 214 | vendor_available: true, |
dimitry | 09dd3be | 2019-05-09 16:42:01 +0200 | [diff] [blame] | 215 | native_bridge_supported: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 216 | vndk: { |
| 217 | enabled: true, |
| 218 | }, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 219 | host_supported: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 220 | defaults: [ |
| 221 | "libssl_sources", |
| 222 | "boringssl_defaults", |
| 223 | "boringssl_flags", |
| 224 | ], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 225 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 226 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 227 | shared_libs: ["libcrypto"], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 228 | } |
| 229 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 230 | // Tool |
| 231 | cc_binary { |
| 232 | name: "bssl", |
| 233 | host_supported: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 234 | defaults: [ |
| 235 | "bssl_sources", |
| 236 | "boringssl_flags", |
| 237 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 238 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 239 | shared_libs: [ |
| 240 | "libcrypto", |
| 241 | "libssl", |
| 242 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 243 | target: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 244 | darwin: { |
| 245 | enabled: false, |
| 246 | }, |
| 247 | }, |
| 248 | } |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 249 | |
Adam Langley | 7c16793 | 2018-02-02 14:44:53 -0800 | [diff] [blame] | 250 | cc_binary { |
| 251 | name: "cavp", |
| 252 | host_supported: true, |
| 253 | srcs: [ |
Pete Bentley | 0c61efe | 2019-08-13 09:32:23 +0100 | [diff] [blame] | 254 | "src/util/fipstools/cavp/cavp_aes_gcm_test.cc", |
| 255 | "src/util/fipstools/cavp/cavp_aes_test.cc", |
| 256 | "src/util/fipstools/cavp/cavp_ctr_drbg_test.cc", |
| 257 | "src/util/fipstools/cavp/cavp_ecdsa2_keypair_test.cc", |
| 258 | "src/util/fipstools/cavp/cavp_ecdsa2_pkv_test.cc", |
| 259 | "src/util/fipstools/cavp/cavp_ecdsa2_siggen_test.cc", |
| 260 | "src/util/fipstools/cavp/cavp_ecdsa2_sigver_test.cc", |
| 261 | "src/util/fipstools/cavp/cavp_hmac_test.cc", |
| 262 | "src/util/fipstools/cavp/cavp_kas_test.cc", |
| 263 | "src/util/fipstools/cavp/cavp_keywrap_test.cc", |
| 264 | "src/util/fipstools/cavp/cavp_main.cc", |
| 265 | "src/util/fipstools/cavp/cavp_rsa2_keygen_test.cc", |
| 266 | "src/util/fipstools/cavp/cavp_rsa2_siggen_test.cc", |
| 267 | "src/util/fipstools/cavp/cavp_rsa2_sigver_test.cc", |
| 268 | "src/util/fipstools/cavp/cavp_sha_monte_test.cc", |
| 269 | "src/util/fipstools/cavp/cavp_sha_test.cc", |
| 270 | "src/util/fipstools/cavp/cavp_tdes_test.cc", |
| 271 | "src/util/fipstools/cavp/cavp_test_util.cc", |
| 272 | "src/util/fipstools/cavp/cavp_tlskdf_test.cc", |
Adam Langley | 7c16793 | 2018-02-02 14:44:53 -0800 | [diff] [blame] | 273 | ], |
| 274 | |
| 275 | shared_libs: [ |
| 276 | "libcrypto", |
| 277 | ], |
| 278 | |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 279 | defaults: [ |
| 280 | "boringssl_test_support_sources", |
| 281 | "boringssl_flags", |
| 282 | ], |
Adam Langley | 7c16793 | 2018-02-02 14:44:53 -0800 | [diff] [blame] | 283 | } |
| 284 | |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 285 | // Test support library |
| 286 | cc_library_static { |
| 287 | name: "boringssl_test_support", |
| 288 | host_supported: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 289 | defaults: [ |
| 290 | "boringssl_test_support_sources", |
| 291 | "boringssl_flags", |
| 292 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 293 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 294 | shared_libs: [ |
| 295 | "libcrypto", |
| 296 | "libssl", |
| 297 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 298 | } |
| 299 | |
| 300 | // Tests |
| 301 | cc_test { |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 302 | name: "boringssl_crypto_test", |
| 303 | test_suites: ["device-tests"], |
| 304 | host_supported: true, |
| 305 | defaults: [ |
| 306 | "boringssl_crypto_test_sources", |
| 307 | "boringssl_flags", |
| 308 | ], |
| 309 | whole_static_libs: ["boringssl_test_support"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 310 | |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 311 | shared_libs: ["libcrypto"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 312 | } |
| 313 | |
| 314 | cc_test { |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 315 | name: "boringssl_ssl_test", |
| 316 | test_suites: ["device-tests"], |
| 317 | host_supported: true, |
| 318 | defaults: [ |
| 319 | "boringssl_ssl_test_sources", |
| 320 | "boringssl_flags", |
| 321 | ], |
| 322 | whole_static_libs: ["boringssl_test_support"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 323 | |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 324 | shared_libs: [ |
| 325 | "libcrypto", |
| 326 | "libssl", |
| 327 | ], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 328 | } |