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