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