• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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}
20
21java_defaults {
22    name: "bouncycastle-errorprone-defaults",
23    errorprone: {
24        javacflags: [
25            "-Xep:MissingOverride:OFF", // Ignore missing @Override.
26        ],
27    },
28}
29
30// These cannot build in the PDK, because the PDK requires all libraries
31// compile against SDK versions.
32java_defaults {
33    name: "bouncycastle-defaults",
34    defaults: [
35        "bouncycastle-errorprone-defaults",
36    ],
37    hostdex: true,
38    target: {
39        android: {
40            product_variables: {
41                pdk: {
42                    enabled: false,
43                },
44            },
45        },
46    },
47}
48
49// The src files for bouncycastle, used to generate core platform / intra-core
50// API stubs.
51filegroup {
52    name: "bouncycastle_java_files",
53    visibility: [
54        "//libcore",
55    ],
56    srcs: ["repackaged/bcprov/src/main/java/**/*.java"],
57}
58
59// A bouncycastle library repackaged in com.android.org.bouncycastle for use
60// in the Android platform where it is important not to conflict with the
61// original org.bouncycastle package.
62java_library {
63    name: "bouncycastle",
64    // Restrict visibility to only those targets that need to access it.
65    visibility: [
66        "//art/build/apex",
67        "//external/wycheproof",
68        "//libcore",
69    ],
70    apex_available: [
71        "com.android.art.release",
72        "com.android.art.debug",
73    ],
74    defaults: ["bouncycastle-defaults"],
75    installable: true,
76
77    srcs: [":bouncycastle_java_files"],
78
79    libs: ["unsupportedappusage"],
80
81    sdk_version: "none",
82    system_modules: "art-module-intra-core-api-stubs-system-modules",
83}
84
85// A guaranteed unstripped version of bouncycastle.
86// The build system may or may not strip the bouncycastle jar, but this one will
87// not be stripped. See b/24535627.
88java_library {
89    name: "bouncycastle-testdex",
90    visibility: [
91        "//art:__subpackages__",
92    ],
93    defaults: ["bouncycastle-defaults"],
94    installable: true,
95
96    srcs: [":bouncycastle_java_files"],
97
98    libs: ["unsupportedappusage"],
99
100    sdk_version: "none",
101    system_modules: "art-module-intra-core-api-stubs-system-modules",
102    dex_preopt: {
103        enabled: false,
104    },
105    java_version: "1.7",
106}
107
108unbundled_visibility = [
109    "//build/make/tools/signapk",
110    "//build/make/tools/signtos",
111    "//cts/hostsidetests/devicepolicy/app/DeviceOwner",
112    "//cts/tests/libcore/okhttp",
113    "//cts/tests/security",
114    "//cts/tests/tests/keystore",
115    "//external/conscrypt",
116    "//external/okhttp",
117    "//external/robolectric-shadows",
118    "//external/robolectric-shadows/robolectric",
119    "//external/robolectric-shadows/shadows/supportv4",
120    "//external/robolectric-shadows/shadows/httpclient",
121    "//frameworks/opt/net/wifi/service",
122    "//frameworks/opt/net/wifi/tests/wifitests",
123    "//libcore",
124    "//system/extras/verity",
125]
126
127// A bouncycastle library in the original org.bouncycastle package for use
128// outside of the platform. e.g. for host or in unbundled apps.
129java_library {
130    name: "bouncycastle-unbundled",
131    visibility: unbundled_visibility,
132    defaults: ["bouncycastle-defaults"],
133    host_supported: true,
134
135    srcs: ["bcprov/src/main/java/**/*.java"],
136    exclude_srcs: [
137        "bcprov/src/main/java/org/bouncycastle/asn1/ocsp/**/*.java",
138    ],
139
140    sdk_version: "core_current",
141    java_version: "1.7",
142}
143
144// Bouncycastle PKIX classes in the original org.bouncycastle package for use
145// outside of the platform. e.g. for host or in unbundled apps / CTS tests.
146java_library {
147    name: "bouncycastle-bcpkix-unbundled",
148    visibility: unbundled_visibility,
149    defaults: ["bouncycastle-defaults"],
150    host_supported: true,
151
152    srcs: ["bcpkix/src/main/java/**/*.java"],
153    exclude_srcs: ["bcpkix/src/main/java/org/bouncycastle/cert/ocsp/**/*.java"],
154    libs: ["bouncycastle-unbundled"],
155
156    sdk_version: "core_current",
157}
158
159// Bouncycastle OCSP classes in the original org.bouncycastle package for use
160// outside of the platform. e.g. for host or in unbundled apps / CTS tests.
161java_library_static {
162    name: "bouncycastle-ocsp-unbundled",
163    visibility: unbundled_visibility,
164    defaults: ["bouncycastle-defaults"],
165    host_supported: true,
166
167    srcs: [
168        "bcpkix/src/main/java/org/bouncycastle/cert/ocsp/**/*.java",
169        "bcprov/src/main/java/org/bouncycastle/asn1/ocsp/**/*.java",
170    ],
171    libs: [
172        "bouncycastle-unbundled",
173        "bouncycastle-bcpkix-unbundled",
174    ],
175
176    sdk_version: "core_current",
177}
178
179// For compatibility with old bouncycastle-host name.
180//
181// When converting .mk files to .bp files do not change the visibility of this
182// module, instead replace usages of this with bouncycastle-unbundled.
183java_library_host {
184    name: "bouncycastle-host",
185    static_libs: ["bouncycastle-unbundled"],
186}
187
188// Bouncycastle subset for use by platform/packages/modules/IPsec project.
189//
190// Avoids including the whole of bouncycastle_unbundled in IPsec.
191//
192// Specifically, SHA1Digest and MD4Digest (and their dependencies) must be used by IKEv2 to support
193// legacy authentication methods.
194java_library {
195    name: "bouncycastle_ike_digests",
196    visibility: ["//packages/modules/IPsec"],
197    apex_available: [
198        "com.android.ipsec",
199        "test_com.android.ipsec",
200    ],
201    srcs: [
202        "bcprov/src/main/java/org/bouncycastle/crypto/Digest.java",
203        "bcprov/src/main/java/org/bouncycastle/crypto/ExtendedDigest.java",
204        "bcprov/src/main/java/org/bouncycastle/crypto/digests/EncodableDigest.java",
205        "bcprov/src/main/java/org/bouncycastle/crypto/digests/GeneralDigest.java",
206        "bcprov/src/main/java/org/bouncycastle/crypto/digests/MD4Digest.java",
207        "bcprov/src/main/java/org/bouncycastle/crypto/digests/SHA1Digest.java",
208        "bcprov/src/main/java/org/bouncycastle/util/Memoable.java",
209        "bcprov/src/main/java/org/bouncycastle/util/Pack.java",
210    ],
211    sdk_version: "core_current",
212}
213