blob: f53d4d5f5ff910939f39ba36811c0c4d5a7e795f [file] [log] [blame]
Colin Crossc1e892e2017-10-17 15:30:56 -07001//
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
Paul Duffineb463f32019-06-03 12:59:39 +010017package {
18 default_visibility: ["//visibility:private"],
Bob Badour901998a2021-02-12 20:49:26 -080019 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 ],
Paul Duffineb463f32019-06-03 12:59:39 +010047}
48
Andreas Gampe5408b222018-02-19 11:15:28 -080049java_defaults {
50 name: "bouncycastle-errorprone-defaults",
51 errorprone: {
52 javacflags: [
Paul Duffin5d5c19b2019-03-28 14:25:52 +000053 "-Xep:MissingOverride:OFF", // Ignore missing @Override.
Andreas Gampe5408b222018-02-19 11:15:28 -080054 ],
55 },
56}
57
Colin Crossc1e892e2017-10-17 15:30:56 -070058// These cannot build in the PDK, because the PDK requires all libraries
59// compile against SDK versions.
60java_defaults {
61 name: "bouncycastle-defaults",
Andreas Gampe5408b222018-02-19 11:15:28 -080062 defaults: [
63 "bouncycastle-errorprone-defaults",
64 ],
Colin Crossc1e892e2017-10-17 15:30:56 -070065 hostdex: true,
66 target: {
67 android: {
68 product_variables: {
69 pdk: {
70 enabled: false,
71 },
72 },
73 },
74 },
75}
76
Neil Fullere48f4a82018-09-21 19:00:43 +010077// The src files for bouncycastle, used to generate core platform / intra-core
78// API stubs.
79filegroup {
80 name: "bouncycastle_java_files",
Paul Duffineb463f32019-06-03 12:59:39 +010081 visibility: [
82 "//libcore",
83 ],
Paul Duffin6eec96b2018-11-21 10:29:50 +000084 srcs: ["repackaged/bcprov/src/main/java/**/*.java"],
Neil Fullere48f4a82018-09-21 19:00:43 +010085}
86
Neil Fulleref76c732018-07-23 09:52:12 +010087// A bouncycastle library repackaged in com.android.org.bouncycastle for use
Daulet Zhanguzinb67ced02021-01-22 16:25:49 +000088// in the ART module. Repackaging is needed to avoid conflict with the
Neil Fulleref76c732018-07-23 09:52:12 +010089// original org.bouncycastle package.
Colin Crossc1e892e2017-10-17 15:30:56 -070090java_library {
91 name: "bouncycastle",
Paul Duffin5d5c19b2019-03-28 14:25:52 +000092 // Restrict visibility to only those targets that need to access it.
93 visibility: [
94 "//art/build/apex",
Paul Duffinef1ae612019-12-13 09:58:15 +000095 "//art/build/sdk",
Paul Duffin5d5c19b2019-03-28 14:25:52 +000096 "//external/wycheproof",
97 "//libcore",
Martin Stjernholm83f4bd12020-12-17 17:58:34 +000098 "//packages/modules/ArtPrebuilt",
Paul Duffin5d5c19b2019-03-28 14:25:52 +000099 ],
Jiyong Park39c17152019-12-19 02:11:18 +0000100 apex_available: [
Martin Stjernholmce58a722020-10-12 15:10:40 +0100101 "com.android.art",
Jiyong Park39c17152019-12-19 02:11:18 +0000102 "com.android.art.debug",
103 ],
Nicolas Geoffrayc764b422021-03-03 22:03:30 +0000104 min_sdk_version: "31",
Colin Crossc1e892e2017-10-17 15:30:56 -0700105 defaults: ["bouncycastle-defaults"],
Colin Crossba42b692018-06-27 11:00:07 -0700106 installable: true,
Colin Crossc1e892e2017-10-17 15:30:56 -0700107
Neil Fullere48f4a82018-09-21 19:00:43 +0100108 srcs: [":bouncycastle_java_files"],
Neil Fulleref76c732018-07-23 09:52:12 +0100109
Artur Satayev7dae0d72019-12-10 12:04:59 +0000110 libs: ["unsupportedappusage"],
111
Paul Duffin322ebdf2019-06-12 11:04:16 +0100112 sdk_version: "none",
Paul Duffin36aa6ba2019-10-02 14:18:37 +0100113 system_modules: "art-module-intra-core-api-stubs-system-modules",
Colin Crossc1e892e2017-10-17 15:30:56 -0700114}
115
Daulet Zhanguzinb67ced02021-01-22 16:25:49 +0000116// A bouncycastle library repackaged in com.android.internal.org.bouncycastle
117// for use in the Android platform where it is important not to conflict with
118// the original org.bouncycastle package or the one in the ART module.
119java_library {
120 name: "bouncycastle-repackaged-unbundled",
121 visibility: [
Remi NGUYEN VANf8a74622021-05-11 15:11:53 +0000122 "//cts/tests/libcore/wycheproof-bc",
Daulet Zhanguzinb67ced02021-01-22 16:25:49 +0000123 "//external/sl4a/Common",
Daulet Zhanguzin820970a2021-02-03 12:08:50 +0000124 "//external/wycheproof",
Daulet Zhanguzinb67ced02021-01-22 16:25:49 +0000125 "//frameworks/base",
Remi NGUYEN VANf8a74622021-05-11 15:11:53 +0000126 "//frameworks/base/packages/Connectivity/tests/unit",
Daulet Zhanguzinb67ced02021-01-22 16:25:49 +0000127 "//frameworks/base/tests/net",
Remi NGUYEN VANf8a74622021-05-11 15:11:53 +0000128 "//packages/modules/Connectivity/tests/unit",
Daulet Zhanguzinb67ced02021-01-22 16:25:49 +0000129 ],
130 defaults: ["bouncycastle-defaults"],
131 installable: true,
132 sdk_version: "core_current",
133 srcs: ["repackaged_platform/bcprov/src/main/java/**/*.java"],
134}
135
Paul Duffineb463f32019-06-03 12:59:39 +0100136unbundled_visibility = [
Paul Duffinef1ae612019-12-13 09:58:15 +0000137 "//art/build/sdk",
Paul Duffineb463f32019-06-03 12:59:39 +0100138 "//build/make/tools/signapk",
139 "//build/make/tools/signtos",
140 "//cts/hostsidetests/devicepolicy/app/DeviceOwner",
141 "//cts/tests/libcore/okhttp",
142 "//cts/tests/security",
143 "//cts/tests/tests/keystore",
144 "//external/conscrypt",
145 "//external/okhttp",
146 "//external/robolectric-shadows",
147 "//external/robolectric-shadows/robolectric",
148 "//external/robolectric-shadows/shadows/supportv4",
149 "//external/robolectric-shadows/shadows/httpclient",
Rex Hoffmand586d8f2022-08-25 22:15:35 +0000150 "//external/robolectric",
151 "//external/robolectric/robolectric",
152 "//external/robolectric/shadows/supportv4",
153 "//external/robolectric/shadows/httpclient",
Prashant Patil8394a042022-03-08 18:17:50 +0000154 "//external/wycheproof",
Roshan Pius843f97e2019-10-18 09:12:40 -0700155 "//frameworks/opt/net/wifi/service",
Roshan Pius89920d62019-11-22 16:42:34 -0800156 "//frameworks/opt/net/wifi/tests/wifitests",
Daulet Zhanguzin76524bc2021-01-25 20:37:02 +0000157 "//packages/apps/CertInstaller",
158 "//packages/apps/KeyChain",
Max Bires2e1a7162021-03-02 20:09:50 -0800159 "//packages/apps/RemoteProvisioner/tests/unittests",
Daulet Zhanguzin1f5d5322021-02-24 13:05:45 +0000160 "//packages/modules/Connectivity/tests/cts/net",
Baligh Uddinbff76442020-12-24 06:03:34 +0000161 "//packages/modules/Wifi/service",
162 "//packages/modules/Wifi/service/tests/wifitests",
Paul Duffineb463f32019-06-03 12:59:39 +0100163 "//libcore",
164 "//system/extras/verity",
Seth Moore42fcb852021-09-20 13:13:18 -0700165 "//system/security/identity/util",
Max Bires16ee0932020-06-24 02:21:54 -0700166 "//tools/security/remote_provisioning/attestation_testing",
Dan Willemsen6e7338f2020-06-09 17:20:55 -0700167 "//vendor:__subpackages__",
Paul Duffineb463f32019-06-03 12:59:39 +0100168]
169
170// A bouncycastle library in the original org.bouncycastle package for use
171// outside of the platform. e.g. for host or in unbundled apps.
172java_library {
173 name: "bouncycastle-unbundled",
174 visibility: unbundled_visibility,
175 defaults: ["bouncycastle-defaults"],
176 host_supported: true,
177
178 srcs: ["bcprov/src/main/java/**/*.java"],
179 exclude_srcs: [
180 "bcprov/src/main/java/org/bouncycastle/asn1/ocsp/**/*.java",
181 ],
182
183 sdk_version: "core_current",
David Subd55bc32021-01-28 16:58:49 -0800184 min_sdk_version: "30",
Paul Duffineb463f32019-06-03 12:59:39 +0100185 java_version: "1.7",
186}
187
Neil Fulleref76c732018-07-23 09:52:12 +0100188// Bouncycastle PKIX classes in the original org.bouncycastle package for use
Neil Fuller34d38ba2018-10-15 15:35:52 +0100189// outside of the platform. e.g. for host or in unbundled apps / CTS tests.
Paul Duffineb463f32019-06-03 12:59:39 +0100190java_library {
Narayan Kamath4e376662018-02-27 15:26:02 +0000191 name: "bouncycastle-bcpkix-unbundled",
Paul Duffineb463f32019-06-03 12:59:39 +0100192 visibility: unbundled_visibility,
Neil Fulleref76c732018-07-23 09:52:12 +0100193 defaults: ["bouncycastle-defaults"],
Neil Fuller38f359e2018-09-21 13:26:11 +0100194 host_supported: true,
Neil Fulleref76c732018-07-23 09:52:12 +0100195
Narayan Kamath4e376662018-02-27 15:26:02 +0000196 srcs: ["bcpkix/src/main/java/**/*.java"],
197 exclude_srcs: ["bcpkix/src/main/java/org/bouncycastle/cert/ocsp/**/*.java"],
Neil Fulleref76c732018-07-23 09:52:12 +0100198 libs: ["bouncycastle-unbundled"],
199
Neil Fuller4e02b7e2018-10-09 17:22:48 +0100200 sdk_version: "core_current",
Adam Vartanian9cb090f2018-01-04 13:51:00 +0000201}
202
Neil Fulleref76c732018-07-23 09:52:12 +0100203// Bouncycastle OCSP classes in the original org.bouncycastle package for use
Neil Fuller34d38ba2018-10-15 15:35:52 +0100204// outside of the platform. e.g. for host or in unbundled apps / CTS tests.
Narayan Kamath4e376662018-02-27 15:26:02 +0000205java_library_static {
206 name: "bouncycastle-ocsp-unbundled",
Paul Duffineb463f32019-06-03 12:59:39 +0100207 visibility: unbundled_visibility,
Neil Fulleref76c732018-07-23 09:52:12 +0100208 defaults: ["bouncycastle-defaults"],
Neil Fuller38f359e2018-09-21 13:26:11 +0100209 host_supported: true,
Neil Fulleref76c732018-07-23 09:52:12 +0100210
Narayan Kamath4e376662018-02-27 15:26:02 +0000211 srcs: [
212 "bcpkix/src/main/java/org/bouncycastle/cert/ocsp/**/*.java",
213 "bcprov/src/main/java/org/bouncycastle/asn1/ocsp/**/*.java",
214 ],
Paul Duffin5d5c19b2019-03-28 14:25:52 +0000215 libs: [
216 "bouncycastle-unbundled",
217 "bouncycastle-bcpkix-unbundled",
Neil Fulleref76c732018-07-23 09:52:12 +0100218 ],
219
Neil Fuller4e02b7e2018-10-09 17:22:48 +0100220 sdk_version: "core_current",
Narayan Kamath4e376662018-02-27 15:26:02 +0000221}
222
Neil Fulleref76c732018-07-23 09:52:12 +0100223// For compatibility with old bouncycastle-host name.
Paul Duffineb463f32019-06-03 12:59:39 +0100224//
225// When converting .mk files to .bp files do not change the visibility of this
226// module, instead replace usages of this with bouncycastle-unbundled.
Colin Crossc1e892e2017-10-17 15:30:56 -0700227java_library_host {
228 name: "bouncycastle-host",
Neil Fulleref76c732018-07-23 09:52:12 +0100229 static_libs: ["bouncycastle-unbundled"],
Colin Crossc1e892e2017-10-17 15:30:56 -0700230}
Cody Kesting68272c32019-12-05 15:08:43 -0800231
Paul Duffincbd83092020-03-26 08:37:40 +0000232// Bouncycastle subset for use by frameworks/opt/net/ike project.
Paul Duffin84397192020-03-25 10:45:33 +0000233//
234// Avoids including the whole of bouncycastle_unbundled in ike.
Cody Kesting68272c32019-12-05 15:08:43 -0800235//
236// Specifically, SHA1Digest and MD4Digest (and their dependencies) must be used by IKEv2 to support
237// legacy authentication methods.
Paul Duffin84397192020-03-25 10:45:33 +0000238java_library {
Cody Kesting68272c32019-12-05 15:08:43 -0800239 name: "bouncycastle_ike_digests",
Paul Duffincbd83092020-03-26 08:37:40 +0000240 visibility: [
241 "//art/build/sdk",
242 "//packages/modules/IPsec",
243 ],
Paul Duffin84397192020-03-25 10:45:33 +0000244 apex_available: [
245 "com.android.ipsec",
246 "test_com.android.ipsec",
247 ],
Cody Kesting68272c32019-12-05 15:08:43 -0800248 srcs: [
249 "bcprov/src/main/java/org/bouncycastle/crypto/Digest.java",
250 "bcprov/src/main/java/org/bouncycastle/crypto/ExtendedDigest.java",
251 "bcprov/src/main/java/org/bouncycastle/crypto/digests/EncodableDigest.java",
252 "bcprov/src/main/java/org/bouncycastle/crypto/digests/GeneralDigest.java",
253 "bcprov/src/main/java/org/bouncycastle/crypto/digests/MD4Digest.java",
254 "bcprov/src/main/java/org/bouncycastle/crypto/digests/SHA1Digest.java",
255 "bcprov/src/main/java/org/bouncycastle/util/Memoable.java",
256 "bcprov/src/main/java/org/bouncycastle/util/Pack.java",
257 ],
Paul Duffin84397192020-03-25 10:45:33 +0000258 sdk_version: "core_current",
Cody Kesting68272c32019-12-05 15:08:43 -0800259}
Justin McClain229ffad2022-01-12 21:53:36 +0000260
261// Bouncycastle for use by packages/modules/ExtServices project.
262//
263// Excludes directories not needed for ASN1*.java and X509* sources.
264//
265java_library {
266 name: "bouncycastle-extservices-asn",
267 visibility: [
268 "//packages/modules/ExtServices",
269 ],
270 apex_available: [
271 "com.android.extservices",
272 "test_com.android.extservices",
273 ],
274 srcs: [
275 "bcprov/src/main/java/org/bouncycastle/**/*.java",
276 ],
277 exclude_srcs: [
278 "bcprov/src/main/java/org/bouncycastle/asn1/ocsp/**/*.java",
279 "bcprov/src/main/java/org/bouncycastle/iana/**/*.java",
280 ],
281 sdk_version: "core_current",
282}