1// 2// Copyright (C) 2010 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17package { 18 default_visibility: ["//visibility:private"], 19 default_applicable_licenses: ["external_bouncycastle_license"], 20} 21 22// Added automatically by a large-scale-change that took the approach of 23// 'apply every license found to every target'. While this makes sure we respect 24// every license restriction, it may not be entirely correct. 25// 26// e.g. GPL in an MIT project might only apply to the contrib/ directory. 27// 28// Please consider splitting the single license below into multiple licenses, 29// taking care not to lose any license_kind information, and overriding the 30// default license using the 'licenses: [...]' property on targets as needed. 31// 32// For unused files, consider creating a 'fileGroup' with "//visibility:private" 33// to attach the license to, and including a comment whether the files may be 34// used in the current project. 35// See: http://go/android-license-faq 36license { 37 name: "external_bouncycastle_license", 38 visibility: [":__subpackages__"], 39 license_kinds: [ 40 "SPDX-license-identifier-Apache-2.0", 41 "SPDX-license-identifier-BSD", 42 "SPDX-license-identifier-MIT", 43 ], 44 license_text: [ 45 "NOTICE", 46 ], 47} 48 49java_defaults { 50 name: "bouncycastle-errorprone-defaults", 51 errorprone: { 52 javacflags: [ 53 "-Xep:MissingOverride:OFF", // Ignore missing @Override. 54 "-Xep:BoxedPrimitiveEquality:WARN", 55 "-Xep:DoubleBraceInitialization:WARN", 56 "-Xep:HashtableContains:WARN", 57 ], 58 }, 59} 60 61java_defaults { 62 name: "bouncycastle-defaults", 63 defaults: [ 64 "bouncycastle-errorprone-defaults", 65 ], 66 hostdex: true, 67 68 lint: { 69 warning_checks: ["SuspiciousIndentation"], 70 }, 71} 72 73// The src files for bouncycastle, used to generate core platform / intra-core 74// API stubs. 75filegroup { 76 name: "bouncycastle_java_files", 77 visibility: [ 78 "//libcore", 79 ], 80 srcs: ["repackaged/bcprov/src/main/java/**/*.java"], 81} 82 83// A bouncycastle library repackaged in com.android.org.bouncycastle for use 84// in the ART module. Repackaging is needed to avoid conflict with the 85// original org.bouncycastle package. 86java_library { 87 name: "bouncycastle", 88 // Restrict visibility to only those targets that need to access it. 89 visibility: [ 90 "//art/build/apex", 91 "//art/build/sdk", 92 "//art/tools/ahat", 93 "//art/tools/fuzzer", 94 "//libcore:__subpackages__", 95 "//packages/modules/ArtPrebuilt", 96 ], 97 apex_available: [ 98 "com.android.art", 99 "com.android.art.debug", 100 ], 101 min_sdk_version: "31", 102 defaults: ["bouncycastle-defaults"], 103 installable: true, 104 105 srcs: [":bouncycastle_java_files"], 106 107 libs: ["unsupportedappusage"], 108 109 sdk_version: "none", 110 system_modules: "art-module-intra-core-api-stubs-system-modules", 111} 112 113java_library_static { 114 name: "bouncycastle-test-lib", 115 visibility: [ 116 "//packages/modules/ArtPrebuilt", 117 "//external/bouncycastle/mts", 118 ], 119 srcs: [ 120 "repackaged/bcprov/src/test/java/**/*.java", 121 ], 122 libs: ["bouncycastle"], 123 static_libs: [ 124 "junit", 125 "platform-test-annotations", 126 ], 127 sdk_version: "none", 128 system_modules: "art-module-intra-core-api-stubs-system-modules", 129} 130 131// A bouncycastle library repackaged in com.android.internal.org.bouncycastle 132// for use in the Android platform where it is important not to conflict with 133// the original org.bouncycastle package or the one in the ART module. 134java_library { 135 name: "bouncycastle-repackaged-unbundled", 136 visibility: [ 137 "//cts/tests/libcore/wycheproof-bc", 138 "//external/sl4a/Common", 139 "//external/wycheproof", 140 "//frameworks/base", 141 "//frameworks/base/packages/Connectivity/tests/unit", 142 "//frameworks/base/tests/net", 143 "//packages/modules/Connectivity/tests/unit", 144 ], 145 defaults: ["bouncycastle-defaults"], 146 installable: true, 147 sdk_version: "core_current", 148 srcs: [ 149 "repackaged_platform/bcpkix/src/main/java/**/*.java", 150 "repackaged_platform/bcprov/src/main/java/**/*.java", 151 ], 152} 153 154unbundled_visibility = [ 155 "//art/build/sdk", 156 "//build/make/tools/signapk", 157 "//build/make/tools/signtos", 158 "//cts/hostsidetests/devicepolicy/app/DeviceOwner", 159 "//cts/tests/libcore/okhttp", 160 "//cts/tests/security", 161 "//cts/tests/tests/keystore", 162 "//external/android-key-attestation", 163 "//external/conscrypt", 164 "//external/okhttp", 165 "//external/robolectric-shadows", 166 "//external/robolectric-shadows/robolectric", 167 "//external/robolectric-shadows/shadows/supportv4", 168 "//external/robolectric-shadows/shadows/httpclient", 169 "//external/robolectric", 170 "//external/robolectric/robolectric", 171 "//external/robolectric/shadows/supportv4", 172 "//external/robolectric/shadows/httpclient", 173 "//external/wycheproof", 174 "//frameworks/opt/net/wifi/service", 175 "//frameworks/opt/net/wifi/tests/wifitests", 176 "//packages/apps/CertInstaller", 177 "//packages/apps/KeyChain", 178 "//packages/apps/RemoteProvisioner/tests/unittests", 179 "//packages/modules/Connectivity/tests/cts/net", 180 "//packages/modules/RemoteKeyProvisioning/app/tests/unit", 181 "//packages/modules/Virtualization/tests/vm_attestation", 182 "//packages/modules/Wifi/service", 183 "//packages/modules/Wifi/service/tests/wifitests", 184 "//libcore", 185 "//system/extras/verity", 186 "//system/security/identity/util", 187 "//tools/apksig", 188 "//tools/security/remote_provisioning/attestation_testing", 189 "//vendor:__subpackages__", 190] 191 192// A bouncycastle library in the original org.bouncycastle package for use 193// outside of the platform. e.g. for host or in unbundled apps. 194java_library { 195 name: "bouncycastle-unbundled", 196 visibility: unbundled_visibility, 197 defaults: ["bouncycastle-defaults"], 198 host_supported: true, 199 200 srcs: ["bcprov/src/main/java/**/*.java"], 201 exclude_srcs: [ 202 "bcprov/src/main/java/org/bouncycastle/asn1/ocsp/**/*.java", 203 ], 204 205 sdk_version: "core_current", 206 min_sdk_version: "30", 207 java_version: "1.7", 208 apex_available: ["com.android.wifi"], 209} 210 211// Bouncycastle PKIX classes in the original org.bouncycastle package for use 212// outside of the platform. e.g. for host or in unbundled apps / CTS tests. 213java_library { 214 name: "bouncycastle-bcpkix-unbundled", 215 visibility: unbundled_visibility, 216 defaults: ["bouncycastle-defaults"], 217 host_supported: true, 218 219 srcs: ["bcpkix/src/main/java/**/*.java"], 220 exclude_srcs: ["bcpkix/src/main/java/org/bouncycastle/cert/ocsp/**/*.java"], 221 libs: ["bouncycastle-unbundled"], 222 223 sdk_version: "core_current", 224 // b/267608166: Allow to be used by components targeting Java 11. 225 java_version: "11", 226} 227 228// Bouncycastle OCSP classes in the original org.bouncycastle package for use 229// outside of the platform. e.g. for host or in unbundled apps / CTS tests. 230java_library_static { 231 name: "bouncycastle-ocsp-unbundled", 232 visibility: unbundled_visibility, 233 defaults: ["bouncycastle-defaults"], 234 host_supported: true, 235 236 srcs: [ 237 "bcpkix/src/main/java/org/bouncycastle/cert/ocsp/**/*.java", 238 "bcprov/src/main/java/org/bouncycastle/asn1/ocsp/**/*.java", 239 ], 240 libs: [ 241 "bouncycastle-unbundled", 242 "bouncycastle-bcpkix-unbundled", 243 ], 244 245 sdk_version: "core_current", 246} 247 248// For compatibility with old bouncycastle-host name. 249// 250// When converting .mk files to .bp files do not change the visibility of this 251// module, instead replace usages of this with bouncycastle-unbundled. 252java_library_host { 253 name: "bouncycastle-host", 254 static_libs: ["bouncycastle-unbundled"], 255} 256 257java_test_host { 258 name: "bouncycastle-host-tests", 259 srcs: [ 260 "bcprov/src/test/java/**/*.java", 261 ], 262 static_libs: [ 263 "bouncycastle-unbundled", 264 "junit", 265 "platform-test-annotations", 266 ], 267 test_options: { 268 unit_test: true, 269 }, 270 test_suites: ["general-tests"], 271} 272 273// Bouncycastle subset for use by frameworks/opt/net/ike project. 274// 275// Avoids including the whole of bouncycastle_unbundled in ike. 276// 277// Specifically, SHA1Digest and MD4Digest (and their dependencies) must be used by IKEv2 to support 278// legacy authentication methods. 279java_library { 280 name: "bouncycastle_ike_digests", 281 visibility: [ 282 "//art/build/sdk", 283 "//packages/modules/IPsec", 284 ], 285 apex_available: [ 286 "com.android.ipsec", 287 "test_com.android.ipsec", 288 ], 289 srcs: [ 290 "bcprov/src/main/java/org/bouncycastle/crypto/Digest.java", 291 "bcprov/src/main/java/org/bouncycastle/crypto/ExtendedDigest.java", 292 "bcprov/src/main/java/org/bouncycastle/crypto/digests/EncodableDigest.java", 293 "bcprov/src/main/java/org/bouncycastle/crypto/digests/GeneralDigest.java", 294 "bcprov/src/main/java/org/bouncycastle/crypto/digests/MD4Digest.java", 295 "bcprov/src/main/java/org/bouncycastle/crypto/digests/SHA1Digest.java", 296 "bcprov/src/main/java/org/bouncycastle/util/Memoable.java", 297 "bcprov/src/main/java/org/bouncycastle/util/Pack.java", 298 ], 299 sdk_version: "core_current", 300} 301 302// Bouncycastle for use by packages/modules/ExtServices project. 303// 304// Excludes directories not needed for ASN1*.java and X509* sources. 305// 306java_library { 307 name: "bouncycastle-extservices-asn", 308 visibility: [ 309 "//packages/modules/ExtServices", 310 ], 311 apex_available: [ 312 "com.android.extservices", 313 "test_com.android.extservices", 314 ], 315 srcs: [ 316 "bcprov/src/main/java/org/bouncycastle/**/*.java", 317 ], 318 exclude_srcs: [ 319 "bcprov/src/main/java/org/bouncycastle/asn1/ocsp/**/*.java", 320 "bcprov/src/main/java/org/bouncycastle/iana/**/*.java", 321 ], 322 sdk_version: "core_current", 323 lint: { 324 warning_checks: ["SuspiciousIndentation"], 325 }, 326} 327 328// Bouncycastle for use by packages/modules/Uwb project. 329// 330//Excludes directories not needed. 331java_library { 332 name: "bouncycastle-uwb", 333 defaults: ["bouncycastle-errorprone-defaults"], 334 visibility: [ 335 "//packages/modules/Uwb/service", 336 ], 337 apex_available: [ 338 "com.android.uwb", 339 ], 340 srcs: [ 341 "bcprov/src/main/java/org/bouncycastle/**/*.java", 342 "bcpkix/src/main/java/org/bouncycastle/cert/**/*.java", 343 "bcpkix/src/main/java/org/bouncycastle/cms/**/*.java", 344 "bcpkix/src/main/java/org/bouncycastle/operator/**/*.java", 345 ], 346 347 exclude_srcs: [ 348 "bcprov/src/main/java/org/bouncycastle/iana/**/*.java", 349 "bcprov/src/main/java/org/bouncycastle/its/**/*.java", 350 ], 351 sdk_version: "core_current", 352 lint: { 353 warning_checks: ["SuspiciousIndentation"], 354 }, 355} 356