1// Copyright (C) 2023 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15// Cronet handles all of its licenses declaration in the top level Android.bp and 16// LICENSE files (//external/cronet/Android.bp and //external/cronet/LICENSE). 17// Boringsll's license can also be found at 18// //external/cronet/third_party/boringssl/src/LICENSE. 19 20package { 21 default_visibility: [ 22 "//external/cronet:__subpackages__", 23 "//packages/modules/Connectivity/Tethering:__subpackages__", 24 ], 25 // See: http://go/android-license-faq 26 // A large-scale-change added 'default_applicable_licenses' to import 27 // all of the 'license_kinds' from "external_cronet_license" 28 // to get the below license kinds: 29 // legacy_unencumbered 30 // SPDX-license-identifier-Apache-2.0 31 // SPDX-license-identifier-BSD 32 // SPDX-license-identifier-BSD-3-Clause 33 // SPDX-license-identifier-ISC 34 // SPDX-license-identifier-MIT 35 // SPDX-license-identifier-OpenSSL 36 default_applicable_licenses: ["external_cronet_license"], 37} 38 39build = ["sources.bp"] 40 41cc_defaults { 42 name: "stable_cronet_cronet_defaults", 43 stl: "none", 44 apex_available: [ 45 "com.android.tethering", 46 ], 47 min_sdk_version: "30", 48 include_dirs: [ 49 "external/cronet/stable/buildtools/third_party/libc++/", 50 "external/cronet/stable/third_party/libc++/src/include", 51 "external/cronet/stable/third_party/libc++abi/src/include", 52 ], 53 static_libs: [ 54 "stable_cronet_buildtools_third_party_libc___libc__", 55 "stable_cronet_buildtools_third_party_libc__abi_libc__abi" 56 ], 57} 58 59cc_defaults { 60 name: "stable_cronet_boringssl_flags", 61 cflags: [ 62 "-fvisibility=hidden", 63 "-DBORINGSSL_SHARED_LIBRARY", 64 "-DBORINGSSL_ANDROID_SYSTEM", 65 // Chromium uses extensive harderning mode, so setting the same for boringssl. 66 "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE", 67 "-DOPENSSL_SMALL", 68 "-Werror", 69 "-Wno-unused-parameter", 70 ], 71 cppflags: [ 72 "-Wall", 73 "-Werror", 74 ], 75} 76 77cc_defaults { 78 name: "stable_cronet_boringssl_defaults", 79 local_include_dirs: ["src/include"], 80 export_include_dirs: ["src/include"], 81 cflags: [ 82 "-DBORINGSSL_IMPLEMENTATION", 83 ], 84} 85 86cc_defaults { 87 name: "stable_cronet_libcrypto_defaults", 88 target: { 89 android: { 90 // On FIPS builds (i.e. Android only) prevent other libraries 91 // from pre-empting symbols in libcrypto which could affect FIPS 92 // compliance and cause integrity checks to fail. See b/160231064. 93 ldflags: ["-Wl,-Bsymbolic"], 94 }, 95 }, 96 local_include_dirs: ["src/crypto"], 97} 98 99cc_object { 100 name: "stable_cronet_bcm_object", 101 defaults: [ 102 "stable_cronet_boringssl_defaults", 103 "stable_cronet_boringssl_flags", 104 "stable_cronet_cronet_defaults", 105 "stable_cronet_libcrypto_bcm_sources", 106 "stable_cronet_libcrypto_defaults", 107 ], 108 sanitize: { 109 address: false, 110 hwaddress: false, 111 // This is a placeholder 112 // to help prevent 113 // merge conflicts. 114 memtag_stack: false, 115 // This is a placeholder 116 // to help prevent 117 // merge conflicts. 118 fuzzer: false, 119 memtag_globals: false, 120 }, 121 target: { 122 android: { 123 cflags: [ 124 "-DBORINGSSL_FIPS", 125 "-fPIC", 126 // -fno[data|text]-sections required to ensure a 127 // single text and data section for FIPS integrity check 128 "-fno-data-sections", 129 "-fno-function-sections", 130 ], 131 linker_script: "src/crypto/fipsmodule/fips_shared.lds", 132 }, 133 // From //external/boringssl: Temporary hack to let BoringSSL build with a new compiler. 134 // This doesn't enable HWASAN unconditionally, it just causes 135 // BoringSSL's asm code to unconditionally use a HWASAN-compatible 136 // global variable reference so that the non-HWASANified (because of 137 // sanitize: { hwaddress: false } above) code in the BCM can 138 // successfully link against the HWASANified code in the rest of 139 // BoringSSL in HWASAN builds. 140 android_arm64: { 141 asflags: [ 142 "-fsanitize=hwaddress", 143 ], 144 }, 145 }, 146} 147 148cc_library_shared { 149 name: "stable_cronet_libcrypto", 150 defaults: [ 151 "stable_cronet_boringssl_defaults", 152 "stable_cronet_boringssl_flags", 153 "stable_cronet_cronet_defaults", 154 "stable_cronet_libcrypto_defaults", 155 "stable_cronet_libcrypto_sources", 156 ], 157 unique_host_soname: true, 158 srcs: [ 159 ":stable_cronet_bcm_object", 160 ], 161 target: { 162 android: { 163 cflags: [ 164 "-DBORINGSSL_FIPS", 165 ], 166 sanitize: { 167 // Disable address sanitizing otherwise libcrypto will not report 168 // itself as being in FIPS mode, which causes boringssl_self_test 169 // to fail. 170 address: false, 171 }, 172 inject_bssl_hash: true, 173 }, 174 }, 175} 176 177cc_library_shared { 178 name: "stable_cronet_libssl", 179 defaults: [ 180 "stable_cronet_boringssl_defaults", 181 "stable_cronet_boringssl_flags", 182 "stable_cronet_cronet_defaults", 183 "stable_cronet_libssl_sources", 184 ], 185 unique_host_soname: true, 186 shared_libs: ["stable_cronet_libcrypto"], 187} 188 189cc_library_shared { 190 name: "stable_cronet_libpki", 191 defaults: [ 192 "stable_cronet_boringssl_defaults", 193 "stable_cronet_boringssl_flags", 194 "stable_cronet_cronet_defaults", 195 "stable_cronet_libpki_sources", 196 ], 197 unique_host_soname: true, 198 cflags: ["-D_BORINGSSL_LIBPKI_"], 199 shared_libs: ["stable_cronet_libcrypto"], 200} 201