Colin Cross | c1e892e | 2017-10-17 15:30:56 -0700 | [diff] [blame] | 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 | |
Paul Duffin | eb463f3 | 2019-06-03 12:59:39 +0100 | [diff] [blame] | 17 | package { |
| 18 | default_visibility: ["//visibility:private"], |
Bob Badour | 901998a | 2021-02-12 20:49:26 -0800 | [diff] [blame] | 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 |
| 36 | license { |
| 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 Duffin | eb463f3 | 2019-06-03 12:59:39 +0100 | [diff] [blame] | 47 | } |
| 48 | |
Andreas Gampe | 5408b22 | 2018-02-19 11:15:28 -0800 | [diff] [blame] | 49 | java_defaults { |
| 50 | name: "bouncycastle-errorprone-defaults", |
| 51 | errorprone: { |
| 52 | javacflags: [ |
Paul Duffin | 5d5c19b | 2019-03-28 14:25:52 +0000 | [diff] [blame] | 53 | "-Xep:MissingOverride:OFF", // Ignore missing @Override. |
Andreas Gampe | 5408b22 | 2018-02-19 11:15:28 -0800 | [diff] [blame] | 54 | ], |
| 55 | }, |
| 56 | } |
| 57 | |
Colin Cross | c1e892e | 2017-10-17 15:30:56 -0700 | [diff] [blame] | 58 | // These cannot build in the PDK, because the PDK requires all libraries |
| 59 | // compile against SDK versions. |
| 60 | java_defaults { |
| 61 | name: "bouncycastle-defaults", |
Andreas Gampe | 5408b22 | 2018-02-19 11:15:28 -0800 | [diff] [blame] | 62 | defaults: [ |
| 63 | "bouncycastle-errorprone-defaults", |
| 64 | ], |
Colin Cross | c1e892e | 2017-10-17 15:30:56 -0700 | [diff] [blame] | 65 | hostdex: true, |
| 66 | target: { |
| 67 | android: { |
| 68 | product_variables: { |
| 69 | pdk: { |
| 70 | enabled: false, |
| 71 | }, |
| 72 | }, |
| 73 | }, |
| 74 | }, |
| 75 | } |
| 76 | |
Neil Fuller | e48f4a8 | 2018-09-21 19:00:43 +0100 | [diff] [blame] | 77 | // The src files for bouncycastle, used to generate core platform / intra-core |
| 78 | // API stubs. |
| 79 | filegroup { |
| 80 | name: "bouncycastle_java_files", |
Paul Duffin | eb463f3 | 2019-06-03 12:59:39 +0100 | [diff] [blame] | 81 | visibility: [ |
| 82 | "//libcore", |
| 83 | ], |
Paul Duffin | 6eec96b | 2018-11-21 10:29:50 +0000 | [diff] [blame] | 84 | srcs: ["repackaged/bcprov/src/main/java/**/*.java"], |
Neil Fuller | e48f4a8 | 2018-09-21 19:00:43 +0100 | [diff] [blame] | 85 | } |
| 86 | |
Neil Fuller | ef76c73 | 2018-07-23 09:52:12 +0100 | [diff] [blame] | 87 | // A bouncycastle library repackaged in com.android.org.bouncycastle for use |
Daulet Zhanguzin | b67ced0 | 2021-01-22 16:25:49 +0000 | [diff] [blame] | 88 | // in the ART module. Repackaging is needed to avoid conflict with the |
Neil Fuller | ef76c73 | 2018-07-23 09:52:12 +0100 | [diff] [blame] | 89 | // original org.bouncycastle package. |
Colin Cross | c1e892e | 2017-10-17 15:30:56 -0700 | [diff] [blame] | 90 | java_library { |
| 91 | name: "bouncycastle", |
Paul Duffin | 5d5c19b | 2019-03-28 14:25:52 +0000 | [diff] [blame] | 92 | // Restrict visibility to only those targets that need to access it. |
| 93 | visibility: [ |
| 94 | "//art/build/apex", |
Paul Duffin | ef1ae61 | 2019-12-13 09:58:15 +0000 | [diff] [blame] | 95 | "//art/build/sdk", |
Paul Duffin | 5d5c19b | 2019-03-28 14:25:52 +0000 | [diff] [blame] | 96 | "//external/wycheproof", |
| 97 | "//libcore", |
Martin Stjernholm | 83f4bd1 | 2020-12-17 17:58:34 +0000 | [diff] [blame] | 98 | "//packages/modules/ArtPrebuilt", |
Paul Duffin | 5d5c19b | 2019-03-28 14:25:52 +0000 | [diff] [blame] | 99 | ], |
Jiyong Park | 39c1715 | 2019-12-19 02:11:18 +0000 | [diff] [blame] | 100 | apex_available: [ |
Martin Stjernholm | ce58a72 | 2020-10-12 15:10:40 +0100 | [diff] [blame] | 101 | "com.android.art", |
Jiyong Park | 39c1715 | 2019-12-19 02:11:18 +0000 | [diff] [blame] | 102 | "com.android.art.debug", |
| 103 | ], |
Nicolas Geoffray | c764b42 | 2021-03-03 22:03:30 +0000 | [diff] [blame] | 104 | min_sdk_version: "31", |
Colin Cross | c1e892e | 2017-10-17 15:30:56 -0700 | [diff] [blame] | 105 | defaults: ["bouncycastle-defaults"], |
Colin Cross | ba42b69 | 2018-06-27 11:00:07 -0700 | [diff] [blame] | 106 | installable: true, |
Colin Cross | c1e892e | 2017-10-17 15:30:56 -0700 | [diff] [blame] | 107 | |
Neil Fuller | e48f4a8 | 2018-09-21 19:00:43 +0100 | [diff] [blame] | 108 | srcs: [":bouncycastle_java_files"], |
Neil Fuller | ef76c73 | 2018-07-23 09:52:12 +0100 | [diff] [blame] | 109 | |
Artur Satayev | 7dae0d7 | 2019-12-10 12:04:59 +0000 | [diff] [blame] | 110 | libs: ["unsupportedappusage"], |
| 111 | |
Paul Duffin | 322ebdf | 2019-06-12 11:04:16 +0100 | [diff] [blame] | 112 | sdk_version: "none", |
Paul Duffin | 36aa6ba | 2019-10-02 14:18:37 +0100 | [diff] [blame] | 113 | system_modules: "art-module-intra-core-api-stubs-system-modules", |
Colin Cross | c1e892e | 2017-10-17 15:30:56 -0700 | [diff] [blame] | 114 | } |
| 115 | |
Daulet Zhanguzin | b67ced0 | 2021-01-22 16:25:49 +0000 | [diff] [blame] | 116 | // 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. |
| 119 | java_library { |
| 120 | name: "bouncycastle-repackaged-unbundled", |
| 121 | visibility: [ |
Remi NGUYEN VAN | f8a7462 | 2021-05-11 15:11:53 +0000 | [diff] [blame] | 122 | "//cts/tests/libcore/wycheproof-bc", |
Daulet Zhanguzin | b67ced0 | 2021-01-22 16:25:49 +0000 | [diff] [blame] | 123 | "//external/sl4a/Common", |
Daulet Zhanguzin | 820970a | 2021-02-03 12:08:50 +0000 | [diff] [blame] | 124 | "//external/wycheproof", |
Daulet Zhanguzin | b67ced0 | 2021-01-22 16:25:49 +0000 | [diff] [blame] | 125 | "//frameworks/base", |
Remi NGUYEN VAN | f8a7462 | 2021-05-11 15:11:53 +0000 | [diff] [blame] | 126 | "//frameworks/base/packages/Connectivity/tests/unit", |
Daulet Zhanguzin | b67ced0 | 2021-01-22 16:25:49 +0000 | [diff] [blame] | 127 | "//frameworks/base/tests/net", |
Remi NGUYEN VAN | f8a7462 | 2021-05-11 15:11:53 +0000 | [diff] [blame] | 128 | "//packages/modules/Connectivity/tests/unit", |
Daulet Zhanguzin | b67ced0 | 2021-01-22 16:25:49 +0000 | [diff] [blame] | 129 | ], |
| 130 | defaults: ["bouncycastle-defaults"], |
| 131 | installable: true, |
| 132 | sdk_version: "core_current", |
| 133 | srcs: ["repackaged_platform/bcprov/src/main/java/**/*.java"], |
| 134 | } |
| 135 | |
Paul Duffin | eb463f3 | 2019-06-03 12:59:39 +0100 | [diff] [blame] | 136 | unbundled_visibility = [ |
Paul Duffin | ef1ae61 | 2019-12-13 09:58:15 +0000 | [diff] [blame] | 137 | "//art/build/sdk", |
Paul Duffin | eb463f3 | 2019-06-03 12:59:39 +0100 | [diff] [blame] | 138 | "//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 Hoffman | d586d8f | 2022-08-25 22:15:35 +0000 | [diff] [blame] | 150 | "//external/robolectric", |
| 151 | "//external/robolectric/robolectric", |
| 152 | "//external/robolectric/shadows/supportv4", |
| 153 | "//external/robolectric/shadows/httpclient", |
Prashant Patil | 8394a04 | 2022-03-08 18:17:50 +0000 | [diff] [blame] | 154 | "//external/wycheproof", |
Roshan Pius | 843f97e | 2019-10-18 09:12:40 -0700 | [diff] [blame] | 155 | "//frameworks/opt/net/wifi/service", |
Roshan Pius | 89920d6 | 2019-11-22 16:42:34 -0800 | [diff] [blame] | 156 | "//frameworks/opt/net/wifi/tests/wifitests", |
Daulet Zhanguzin | 76524bc | 2021-01-25 20:37:02 +0000 | [diff] [blame] | 157 | "//packages/apps/CertInstaller", |
| 158 | "//packages/apps/KeyChain", |
Max Bires | 2e1a716 | 2021-03-02 20:09:50 -0800 | [diff] [blame] | 159 | "//packages/apps/RemoteProvisioner/tests/unittests", |
Daulet Zhanguzin | 1f5d532 | 2021-02-24 13:05:45 +0000 | [diff] [blame] | 160 | "//packages/modules/Connectivity/tests/cts/net", |
Baligh Uddin | bff7644 | 2020-12-24 06:03:34 +0000 | [diff] [blame] | 161 | "//packages/modules/Wifi/service", |
| 162 | "//packages/modules/Wifi/service/tests/wifitests", |
Paul Duffin | eb463f3 | 2019-06-03 12:59:39 +0100 | [diff] [blame] | 163 | "//libcore", |
| 164 | "//system/extras/verity", |
Seth Moore | 42fcb85 | 2021-09-20 13:13:18 -0700 | [diff] [blame] | 165 | "//system/security/identity/util", |
Max Bires | 16ee093 | 2020-06-24 02:21:54 -0700 | [diff] [blame] | 166 | "//tools/security/remote_provisioning/attestation_testing", |
Dan Willemsen | 6e7338f | 2020-06-09 17:20:55 -0700 | [diff] [blame] | 167 | "//vendor:__subpackages__", |
Paul Duffin | eb463f3 | 2019-06-03 12:59:39 +0100 | [diff] [blame] | 168 | ] |
| 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. |
| 172 | java_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 Su | bd55bc3 | 2021-01-28 16:58:49 -0800 | [diff] [blame] | 184 | min_sdk_version: "30", |
Paul Duffin | eb463f3 | 2019-06-03 12:59:39 +0100 | [diff] [blame] | 185 | java_version: "1.7", |
| 186 | } |
| 187 | |
Neil Fuller | ef76c73 | 2018-07-23 09:52:12 +0100 | [diff] [blame] | 188 | // Bouncycastle PKIX classes in the original org.bouncycastle package for use |
Neil Fuller | 34d38ba | 2018-10-15 15:35:52 +0100 | [diff] [blame] | 189 | // outside of the platform. e.g. for host or in unbundled apps / CTS tests. |
Paul Duffin | eb463f3 | 2019-06-03 12:59:39 +0100 | [diff] [blame] | 190 | java_library { |
Narayan Kamath | 4e37666 | 2018-02-27 15:26:02 +0000 | [diff] [blame] | 191 | name: "bouncycastle-bcpkix-unbundled", |
Paul Duffin | eb463f3 | 2019-06-03 12:59:39 +0100 | [diff] [blame] | 192 | visibility: unbundled_visibility, |
Neil Fuller | ef76c73 | 2018-07-23 09:52:12 +0100 | [diff] [blame] | 193 | defaults: ["bouncycastle-defaults"], |
Neil Fuller | 38f359e | 2018-09-21 13:26:11 +0100 | [diff] [blame] | 194 | host_supported: true, |
Neil Fuller | ef76c73 | 2018-07-23 09:52:12 +0100 | [diff] [blame] | 195 | |
Narayan Kamath | 4e37666 | 2018-02-27 15:26:02 +0000 | [diff] [blame] | 196 | srcs: ["bcpkix/src/main/java/**/*.java"], |
| 197 | exclude_srcs: ["bcpkix/src/main/java/org/bouncycastle/cert/ocsp/**/*.java"], |
Neil Fuller | ef76c73 | 2018-07-23 09:52:12 +0100 | [diff] [blame] | 198 | libs: ["bouncycastle-unbundled"], |
| 199 | |
Neil Fuller | 4e02b7e | 2018-10-09 17:22:48 +0100 | [diff] [blame] | 200 | sdk_version: "core_current", |
Adam Vartanian | 9cb090f | 2018-01-04 13:51:00 +0000 | [diff] [blame] | 201 | } |
| 202 | |
Neil Fuller | ef76c73 | 2018-07-23 09:52:12 +0100 | [diff] [blame] | 203 | // Bouncycastle OCSP classes in the original org.bouncycastle package for use |
Neil Fuller | 34d38ba | 2018-10-15 15:35:52 +0100 | [diff] [blame] | 204 | // outside of the platform. e.g. for host or in unbundled apps / CTS tests. |
Narayan Kamath | 4e37666 | 2018-02-27 15:26:02 +0000 | [diff] [blame] | 205 | java_library_static { |
| 206 | name: "bouncycastle-ocsp-unbundled", |
Paul Duffin | eb463f3 | 2019-06-03 12:59:39 +0100 | [diff] [blame] | 207 | visibility: unbundled_visibility, |
Neil Fuller | ef76c73 | 2018-07-23 09:52:12 +0100 | [diff] [blame] | 208 | defaults: ["bouncycastle-defaults"], |
Neil Fuller | 38f359e | 2018-09-21 13:26:11 +0100 | [diff] [blame] | 209 | host_supported: true, |
Neil Fuller | ef76c73 | 2018-07-23 09:52:12 +0100 | [diff] [blame] | 210 | |
Narayan Kamath | 4e37666 | 2018-02-27 15:26:02 +0000 | [diff] [blame] | 211 | srcs: [ |
| 212 | "bcpkix/src/main/java/org/bouncycastle/cert/ocsp/**/*.java", |
| 213 | "bcprov/src/main/java/org/bouncycastle/asn1/ocsp/**/*.java", |
| 214 | ], |
Paul Duffin | 5d5c19b | 2019-03-28 14:25:52 +0000 | [diff] [blame] | 215 | libs: [ |
| 216 | "bouncycastle-unbundled", |
| 217 | "bouncycastle-bcpkix-unbundled", |
Neil Fuller | ef76c73 | 2018-07-23 09:52:12 +0100 | [diff] [blame] | 218 | ], |
| 219 | |
Neil Fuller | 4e02b7e | 2018-10-09 17:22:48 +0100 | [diff] [blame] | 220 | sdk_version: "core_current", |
Narayan Kamath | 4e37666 | 2018-02-27 15:26:02 +0000 | [diff] [blame] | 221 | } |
| 222 | |
Neil Fuller | ef76c73 | 2018-07-23 09:52:12 +0100 | [diff] [blame] | 223 | // For compatibility with old bouncycastle-host name. |
Paul Duffin | eb463f3 | 2019-06-03 12:59:39 +0100 | [diff] [blame] | 224 | // |
| 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 Cross | c1e892e | 2017-10-17 15:30:56 -0700 | [diff] [blame] | 227 | java_library_host { |
| 228 | name: "bouncycastle-host", |
Neil Fuller | ef76c73 | 2018-07-23 09:52:12 +0100 | [diff] [blame] | 229 | static_libs: ["bouncycastle-unbundled"], |
Colin Cross | c1e892e | 2017-10-17 15:30:56 -0700 | [diff] [blame] | 230 | } |
Cody Kesting | 68272c3 | 2019-12-05 15:08:43 -0800 | [diff] [blame] | 231 | |
Paul Duffin | cbd8309 | 2020-03-26 08:37:40 +0000 | [diff] [blame] | 232 | // Bouncycastle subset for use by frameworks/opt/net/ike project. |
Paul Duffin | 8439719 | 2020-03-25 10:45:33 +0000 | [diff] [blame] | 233 | // |
| 234 | // Avoids including the whole of bouncycastle_unbundled in ike. |
Cody Kesting | 68272c3 | 2019-12-05 15:08:43 -0800 | [diff] [blame] | 235 | // |
| 236 | // Specifically, SHA1Digest and MD4Digest (and their dependencies) must be used by IKEv2 to support |
| 237 | // legacy authentication methods. |
Paul Duffin | 8439719 | 2020-03-25 10:45:33 +0000 | [diff] [blame] | 238 | java_library { |
Cody Kesting | 68272c3 | 2019-12-05 15:08:43 -0800 | [diff] [blame] | 239 | name: "bouncycastle_ike_digests", |
Paul Duffin | cbd8309 | 2020-03-26 08:37:40 +0000 | [diff] [blame] | 240 | visibility: [ |
| 241 | "//art/build/sdk", |
| 242 | "//packages/modules/IPsec", |
| 243 | ], |
Paul Duffin | 8439719 | 2020-03-25 10:45:33 +0000 | [diff] [blame] | 244 | apex_available: [ |
| 245 | "com.android.ipsec", |
| 246 | "test_com.android.ipsec", |
| 247 | ], |
Cody Kesting | 68272c3 | 2019-12-05 15:08:43 -0800 | [diff] [blame] | 248 | 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 Duffin | 8439719 | 2020-03-25 10:45:33 +0000 | [diff] [blame] | 258 | sdk_version: "core_current", |
Cody Kesting | 68272c3 | 2019-12-05 15:08:43 -0800 | [diff] [blame] | 259 | } |
Justin McClain | 229ffad | 2022-01-12 21:53:36 +0000 | [diff] [blame] | 260 | |
| 261 | // Bouncycastle for use by packages/modules/ExtServices project. |
| 262 | // |
| 263 | // Excludes directories not needed for ASN1*.java and X509* sources. |
| 264 | // |
| 265 | java_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 | } |