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 | }, |
| 79 | } |
| 80 | |
| 81 | // Target and host library |
| 82 | cc_library { |
| 83 | name: "libcrypto", |
Paul Duffin | cb6fdd2 | 2019-06-04 13:24:44 +0100 | [diff] [blame] | 84 | visibility: ["//visibility:public"], |
Vijay Venkatraman | 3caad95 | 2017-05-16 12:00:57 -0700 | [diff] [blame] | 85 | vendor_available: true, |
dimitry | 09dd3be | 2019-05-09 16:42:01 +0200 | [diff] [blame] | 86 | native_bridge_supported: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 87 | vndk: { |
| 88 | enabled: true, |
| 89 | }, |
Jooyung Han | b6b07c3 | 2019-01-18 15:31:20 +0900 | [diff] [blame] | 90 | double_loadable: true, |
Jiyong Park | c346395 | 2018-04-27 21:44:32 +0900 | [diff] [blame] | 91 | recovery_available: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 92 | defaults: [ |
| 93 | "libcrypto_sources", |
| 94 | "libcrypto_defaults", |
| 95 | "boringssl_defaults", |
| 96 | "boringssl_flags", |
| 97 | ], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 98 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | // Static library |
| 102 | // This should only be used for host modules that will be in a JVM, all other |
| 103 | // modules should use the static variant of libcrypto. |
| 104 | cc_library_static { |
| 105 | name: "libcrypto_static", |
Paul Duffin | cb6fdd2 | 2019-06-04 13:24:44 +0100 | [diff] [blame] | 106 | visibility: ["//visibility:public"], |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 107 | defaults: [ |
| 108 | "libcrypto_sources", |
| 109 | "libcrypto_defaults", |
| 110 | "boringssl_defaults", |
| 111 | "boringssl_flags", |
| 112 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 113 | |
| 114 | target: { |
| 115 | host: { |
David Benjamin | c0dedc0 | 2017-01-24 17:54:24 -0500 | [diff] [blame] | 116 | // TODO: b/26160319. ASAN breaks use of this library in JVM. |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 117 | // Re-enable sanitization when the issue with making clients of this library |
| 118 | // preload ASAN runtime is resolved. Without that, clients are getting runtime |
David Benjamin | c0dedc0 | 2017-01-24 17:54:24 -0500 | [diff] [blame] | 119 | // errors due to unresolved ASAN symbols, such as |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 120 | // __asan_option_detect_stack_use_after_return. |
| 121 | sanitize: { |
| 122 | never: true, |
| 123 | }, |
| 124 | }, |
| 125 | }, |
| 126 | } |
| 127 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 128 | //// libssl |
| 129 | |
| 130 | // Target static library |
| 131 | // Deprecated: all users should move to libssl |
| 132 | cc_library_static { |
| 133 | name: "libssl_static", |
Paul Duffin | cb6fdd2 | 2019-06-04 13:24:44 +0100 | [diff] [blame] | 134 | visibility: ["//visibility:public"], |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 135 | defaults: [ |
| 136 | "libssl_sources", |
| 137 | "boringssl_defaults", |
| 138 | "boringssl_flags", |
| 139 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | // Static and Shared library |
| 143 | cc_library { |
| 144 | name: "libssl", |
Paul Duffin | cb6fdd2 | 2019-06-04 13:24:44 +0100 | [diff] [blame] | 145 | visibility: ["//visibility:public"], |
Dan Willemsen | ea55e18 | 2018-10-23 13:41:19 -0700 | [diff] [blame] | 146 | recovery_available: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 147 | vendor_available: true, |
dimitry | 09dd3be | 2019-05-09 16:42:01 +0200 | [diff] [blame] | 148 | native_bridge_supported: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 149 | vndk: { |
| 150 | enabled: true, |
| 151 | }, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 152 | host_supported: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 153 | defaults: [ |
| 154 | "libssl_sources", |
| 155 | "boringssl_defaults", |
| 156 | "boringssl_flags", |
| 157 | ], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 158 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 159 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 160 | shared_libs: ["libcrypto"], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 161 | } |
| 162 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 163 | // Tool |
| 164 | cc_binary { |
| 165 | name: "bssl", |
| 166 | host_supported: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 167 | defaults: [ |
| 168 | "bssl_sources", |
| 169 | "boringssl_flags", |
| 170 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 171 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 172 | shared_libs: [ |
| 173 | "libcrypto", |
| 174 | "libssl", |
| 175 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 176 | target: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 177 | darwin: { |
| 178 | enabled: false, |
| 179 | }, |
| 180 | }, |
| 181 | } |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 182 | |
Adam Langley | 7c16793 | 2018-02-02 14:44:53 -0800 | [diff] [blame] | 183 | cc_binary { |
| 184 | name: "cavp", |
| 185 | host_supported: true, |
| 186 | srcs: [ |
Srinivas Paladugu | dd42a61 | 2019-08-09 19:30:39 +0000 | [diff] [blame^] | 187 | "src/fipstools/cavp_aes_gcm_test.cc", |
| 188 | "src/fipstools/cavp_aes_test.cc", |
| 189 | "src/fipstools/cavp_ctr_drbg_test.cc", |
| 190 | "src/fipstools/cavp_ecdsa2_keypair_test.cc", |
| 191 | "src/fipstools/cavp_ecdsa2_pkv_test.cc", |
| 192 | "src/fipstools/cavp_ecdsa2_siggen_test.cc", |
| 193 | "src/fipstools/cavp_ecdsa2_sigver_test.cc", |
| 194 | "src/fipstools/cavp_hmac_test.cc", |
| 195 | "src/fipstools/cavp_kas_test.cc", |
| 196 | "src/fipstools/cavp_keywrap_test.cc", |
| 197 | "src/fipstools/cavp_main.cc", |
| 198 | "src/fipstools/cavp_rsa2_keygen_test.cc", |
| 199 | "src/fipstools/cavp_rsa2_siggen_test.cc", |
| 200 | "src/fipstools/cavp_rsa2_sigver_test.cc", |
| 201 | "src/fipstools/cavp_sha_monte_test.cc", |
| 202 | "src/fipstools/cavp_sha_test.cc", |
| 203 | "src/fipstools/cavp_tdes_test.cc", |
| 204 | "src/fipstools/cavp_test_util.cc", |
| 205 | "src/fipstools/cavp_tlskdf_test.cc", |
Adam Langley | 7c16793 | 2018-02-02 14:44:53 -0800 | [diff] [blame] | 206 | ], |
| 207 | |
| 208 | shared_libs: [ |
| 209 | "libcrypto", |
| 210 | ], |
| 211 | |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 212 | defaults: [ |
| 213 | "boringssl_test_support_sources", |
| 214 | "boringssl_flags", |
| 215 | ], |
Adam Langley | 7c16793 | 2018-02-02 14:44:53 -0800 | [diff] [blame] | 216 | } |
| 217 | |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 218 | // Test support library |
| 219 | cc_library_static { |
| 220 | name: "boringssl_test_support", |
| 221 | host_supported: true, |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 222 | defaults: [ |
| 223 | "boringssl_test_support_sources", |
| 224 | "boringssl_flags", |
| 225 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 226 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 227 | shared_libs: [ |
| 228 | "libcrypto", |
| 229 | "libssl", |
| 230 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 231 | } |
| 232 | |
| 233 | // Tests |
| 234 | cc_test { |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 235 | name: "boringssl_crypto_test", |
| 236 | test_suites: ["device-tests"], |
| 237 | host_supported: true, |
| 238 | defaults: [ |
| 239 | "boringssl_crypto_test_sources", |
| 240 | "boringssl_flags", |
| 241 | ], |
| 242 | whole_static_libs: ["boringssl_test_support"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 243 | |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 244 | shared_libs: ["libcrypto"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | cc_test { |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 248 | name: "boringssl_ssl_test", |
| 249 | test_suites: ["device-tests"], |
| 250 | host_supported: true, |
| 251 | defaults: [ |
| 252 | "boringssl_ssl_test_sources", |
| 253 | "boringssl_flags", |
| 254 | ], |
| 255 | whole_static_libs: ["boringssl_test_support"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 256 | |
Paul Duffin | f6a61fd | 2019-06-25 12:06:25 +0100 | [diff] [blame] | 257 | shared_libs: [ |
| 258 | "libcrypto", |
| 259 | "libssl", |
| 260 | ], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 261 | } |