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 | |
| 5 | // Pull in the autogenerated sources modules |
| 6 | build = ["sources.bp"] |
| 7 | |
| 8 | // Used by libcrypto, libssl, bssl tool, and native tests |
| 9 | cc_defaults { |
| 10 | name: "boringssl_flags", |
Steven Moreland | f593be8 | 2017-04-14 04:51:23 -0700 | [diff] [blame] | 11 | vendor_available: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 12 | |
| 13 | cflags: [ |
| 14 | "-fvisibility=hidden", |
| 15 | "-DBORINGSSL_SHARED_LIBRARY", |
David Benjamin | fc8a786 | 2018-06-25 19:02:46 -0400 | [diff] [blame] | 16 | "-DBORINGSSL_ANDROID_SYSTEM", |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 17 | "-DOPENSSL_SMALL", |
| 18 | "-D_XOPEN_SOURCE=700", |
Chih-Hung Hsieh | 9146d99 | 2017-09-27 10:26:03 -0700 | [diff] [blame] | 19 | "-Werror", |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 20 | "-Wno-unused-parameter", |
| 21 | ], |
| 22 | |
| 23 | cppflags: [ |
| 24 | "-Wall", |
| 25 | "-Werror", |
| 26 | ], |
| 27 | |
| 28 | conlyflags: ["-std=c99"], |
David Benjamin | fc8a786 | 2018-06-25 19:02:46 -0400 | [diff] [blame] | 29 | |
| 30 | // Build BoringSSL and its tests against the same STL. |
| 31 | sdk_version: "9", |
| 32 | target: { |
| 33 | android: { |
| 34 | stl: "libc++_static", |
| 35 | }, |
| 36 | }, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | // Used by libcrypto + libssl |
| 40 | cc_defaults { |
| 41 | name: "boringssl_defaults", |
| 42 | |
| 43 | local_include_dirs: ["src/include"], |
| 44 | export_include_dirs: ["src/include"], |
David Benjamin | fc8a786 | 2018-06-25 19:02:46 -0400 | [diff] [blame] | 45 | cflags: ["-DBORINGSSL_IMPLEMENTATION"], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | //// libcrypto |
| 49 | |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame] | 50 | // This should be removed when clang can compile everything. |
| 51 | libcrypto_sources_no_clang = [ |
Robert Sloan | 572a4e2 | 2017-04-17 10:52:19 -0700 | [diff] [blame] | 52 | "linux-arm/crypto/fipsmodule/aes-armv4.S", |
| 53 | "linux-arm/crypto/fipsmodule/bsaes-armv7.S", |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame] | 54 | ] |
| 55 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 56 | cc_defaults { |
| 57 | name: "libcrypto_defaults", |
| 58 | host_supported: true, |
| 59 | |
| 60 | // Windows and Macs both have problems with assembly files |
| 61 | target: { |
| 62 | windows: { |
| 63 | enabled: true, |
| 64 | cflags: ["-DOPENSSL_NO_ASM"], |
| 65 | host_ldlibs: ["-lws2_32"], |
| 66 | }, |
| 67 | darwin: { |
| 68 | cflags: ["-DOPENSSL_NO_ASM"], |
| 69 | }, |
Kenny Root | 7b550be | 2016-09-20 15:25:24 -0700 | [diff] [blame] | 70 | host: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 71 | host_ldlibs: ["-lpthread"], |
| 72 | }, |
| 73 | }, |
| 74 | |
| 75 | local_include_dirs: ["src/crypto"], |
| 76 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 77 | arch: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 78 | arm64: { |
| 79 | clang_asflags: ["-march=armv8-a+crypto"], |
| 80 | }, |
| 81 | }, |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame] | 82 | |
| 83 | // This should be removed when clang can compile everything. |
| 84 | exclude_srcs: libcrypto_sources_no_clang, |
| 85 | whole_static_libs: ["libcrypto_no_clang"], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | // Target and host library |
| 89 | cc_library { |
| 90 | name: "libcrypto", |
Vijay Venkatraman | 3caad95 | 2017-05-16 12:00:57 -0700 | [diff] [blame] | 91 | vendor_available: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 92 | vndk: { |
| 93 | enabled: true, |
| 94 | }, |
Jooyung Han | b6b07c3 | 2019-01-18 15:31:20 +0900 | [diff] [blame] | 95 | double_loadable: true, |
Jiyong Park | c346395 | 2018-04-27 21:44:32 +0900 | [diff] [blame] | 96 | recovery_available: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 97 | defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], |
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 | |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame] | 101 | // Target and host library: files that don't compile with clang. This should |
| 102 | // go away when clang can compile everything with integrated assembler. |
| 103 | cc_library_static { |
| 104 | name: "libcrypto_no_clang", |
| 105 | defaults: ["boringssl_defaults", "boringssl_flags"], |
| 106 | host_supported: true, |
Jiyong Park | c346395 | 2018-04-27 21:44:32 +0900 | [diff] [blame] | 107 | recovery_available: true, |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame] | 108 | |
| 109 | target: { |
| 110 | windows: { |
| 111 | enabled: true, |
| 112 | }, |
| 113 | }, |
| 114 | |
| 115 | local_include_dirs: ["src/crypto"], |
| 116 | |
| 117 | arch: { |
| 118 | arm: { |
| 119 | clang_asflags: ["-no-integrated-as"], |
| 120 | srcs: libcrypto_sources_no_clang, |
| 121 | }, |
| 122 | }, |
| 123 | } |
| 124 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 125 | // Static library |
| 126 | // This should only be used for host modules that will be in a JVM, all other |
| 127 | // modules should use the static variant of libcrypto. |
| 128 | cc_library_static { |
| 129 | name: "libcrypto_static", |
| 130 | defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], |
| 131 | |
| 132 | target: { |
| 133 | host: { |
David Benjamin | c0dedc0 | 2017-01-24 17:54:24 -0500 | [diff] [blame] | 134 | // TODO: b/26160319. ASAN breaks use of this library in JVM. |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 135 | // Re-enable sanitization when the issue with making clients of this library |
| 136 | // preload ASAN runtime is resolved. Without that, clients are getting runtime |
David Benjamin | c0dedc0 | 2017-01-24 17:54:24 -0500 | [diff] [blame] | 137 | // errors due to unresolved ASAN symbols, such as |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 138 | // __asan_option_detect_stack_use_after_return. |
| 139 | sanitize: { |
| 140 | never: true, |
| 141 | }, |
| 142 | }, |
| 143 | }, |
| 144 | } |
| 145 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 146 | //// libssl |
| 147 | |
| 148 | // Target static library |
| 149 | // Deprecated: all users should move to libssl |
| 150 | cc_library_static { |
| 151 | name: "libssl_static", |
| 152 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
| 153 | } |
| 154 | |
| 155 | // Static and Shared library |
| 156 | cc_library { |
| 157 | name: "libssl", |
Dan Willemsen | ea55e18 | 2018-10-23 13:41:19 -0700 | [diff] [blame] | 158 | recovery_available: true, |
Justin Yun | 47949c5 | 2017-07-24 15:19:43 +0900 | [diff] [blame] | 159 | vendor_available: true, |
| 160 | vndk: { |
| 161 | enabled: true, |
| 162 | }, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 163 | host_supported: true, |
| 164 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 165 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 166 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 167 | shared_libs: ["libcrypto"], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 168 | } |
| 169 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 170 | // Tool |
| 171 | cc_binary { |
| 172 | name: "bssl", |
| 173 | host_supported: true, |
| 174 | defaults: ["bssl_sources", "boringssl_flags"], |
| 175 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 176 | shared_libs: [ |
| 177 | "libcrypto", |
| 178 | "libssl", |
| 179 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 180 | target: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 181 | darwin: { |
| 182 | enabled: false, |
| 183 | }, |
| 184 | }, |
| 185 | } |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 186 | |
Adam Langley | 7c16793 | 2018-02-02 14:44:53 -0800 | [diff] [blame] | 187 | cc_binary { |
| 188 | name: "cavp", |
| 189 | host_supported: true, |
| 190 | srcs: [ |
| 191 | "src/fipstools/cavp_aes_gcm_test.cc", |
| 192 | "src/fipstools/cavp_aes_test.cc", |
| 193 | "src/fipstools/cavp_ctr_drbg_test.cc", |
| 194 | "src/fipstools/cavp_ecdsa2_keypair_test.cc", |
| 195 | "src/fipstools/cavp_ecdsa2_pkv_test.cc", |
| 196 | "src/fipstools/cavp_ecdsa2_siggen_test.cc", |
| 197 | "src/fipstools/cavp_ecdsa2_sigver_test.cc", |
| 198 | "src/fipstools/cavp_hmac_test.cc", |
| 199 | "src/fipstools/cavp_kas_test.cc", |
| 200 | "src/fipstools/cavp_keywrap_test.cc", |
| 201 | "src/fipstools/cavp_main.cc", |
| 202 | "src/fipstools/cavp_rsa2_keygen_test.cc", |
| 203 | "src/fipstools/cavp_rsa2_siggen_test.cc", |
| 204 | "src/fipstools/cavp_rsa2_sigver_test.cc", |
| 205 | "src/fipstools/cavp_sha_monte_test.cc", |
| 206 | "src/fipstools/cavp_sha_test.cc", |
| 207 | "src/fipstools/cavp_tdes_test.cc", |
| 208 | "src/fipstools/cavp_test_util.cc", |
| 209 | "src/fipstools/cavp_tlskdf_test.cc", |
| 210 | ], |
| 211 | |
| 212 | shared_libs: [ |
| 213 | "libcrypto", |
| 214 | ], |
| 215 | |
| 216 | defaults: ["boringssl_test_support_sources", "boringssl_flags"], |
| 217 | } |
| 218 | |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 219 | // Test support library |
| 220 | cc_library_static { |
| 221 | name: "boringssl_test_support", |
| 222 | host_supported: true, |
| 223 | defaults: ["boringssl_test_support_sources", "boringssl_flags"], |
| 224 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 225 | shared_libs: [ |
| 226 | "libcrypto", |
| 227 | "libssl", |
| 228 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | // Tests |
| 232 | cc_test { |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 233 | name: "boringssl_crypto_test", |
Dan Shi | 9397df8 | 2017-03-29 23:23:34 -0700 | [diff] [blame] | 234 | test_suites: ["device-tests"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 235 | host_supported: true, |
| 236 | defaults: ["boringssl_crypto_test_sources", "boringssl_flags"], |
| 237 | whole_static_libs: ["boringssl_test_support"], |
| 238 | |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 239 | shared_libs: ["libcrypto"], |
| 240 | } |
| 241 | |
| 242 | cc_test { |
| 243 | name: "boringssl_ssl_test", |
Dan Shi | 9397df8 | 2017-03-29 23:23:34 -0700 | [diff] [blame] | 244 | test_suites: ["device-tests"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 245 | host_supported: true, |
| 246 | defaults: ["boringssl_ssl_test_sources", "boringssl_flags"], |
| 247 | whole_static_libs: ["boringssl_test_support"], |
| 248 | |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 249 | shared_libs: ["libcrypto", "libssl"], |
| 250 | } |