• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1cc_defaults {
2    name: "keystore_defaults",
3
4    cflags: [
5        "-Wall",
6        "-Werror",
7        "-Wextra",
8        "-Wunused",
9    ],
10
11    sanitize: {
12        misc_undefined: [
13             "signed-integer-overflow",
14             "unsigned-integer-overflow",
15             "shift",
16             "integer-divide-by-zero",
17             "implicit-unsigned-integer-truncation",
18             // BUG: 123630767
19             //"implicit-signed-integer-truncation",
20             "implicit-integer-sign-change",
21        ],
22    },
23
24    clang: true,
25}
26
27cc_binary {
28    name: "keystore",
29    defaults: ["keystore_defaults"],
30
31    srcs: [
32        "KeyStore.cpp",
33        "auth_token_table.cpp",
34        "blob.cpp",
35        "confirmation_manager.cpp",
36        "grant_store.cpp",
37        "key_creation_log_handler.cpp",
38        "key_operation_log_handler.cpp",
39        "key_attestation_log_handler.cpp",
40        "key_store_service.cpp",
41        "keyblob_utils.cpp",
42        "keymaster_enforcement.cpp",
43        "keymaster_worker.cpp",
44        "keystore_main.cpp",
45        "keystore_utils.cpp",
46        "legacy_keymaster_device_wrapper.cpp",
47        "operation.cpp",
48        "permissions.cpp",
49        "user_state.cpp",
50    ],
51    shared_libs: [
52        "android.hardware.confirmationui@1.0",
53        "android.hardware.keymaster@3.0",
54        "android.hardware.keymaster@4.0",
55        "android.hardware.keymaster@4.1",
56        "libbase",
57        "libbinder",
58        "libcrypto",
59        "libcutils",
60        "libhardware",
61        "libhidlbase",
62        "libkeymaster4support",
63        "libkeymaster4_1support",
64        "libkeymaster_messages",
65        "libkeymaster_portable",
66        "libkeystore-attestation-application-id",
67        "libkeystore_aidl",
68        "libkeystore_binder",
69        "libkeystore_parcelables",
70        "liblog",
71        "libprotobuf-cpp-lite",
72        "libselinux",
73        "libservices",
74        "libsoftkeymasterdevice",
75        "libutils",
76        "libstatslog",
77    ],
78    init_rc: ["keystore.rc"],
79    aidl: {
80        include_dirs: ["frameworks/base/core/java/"],
81    },
82
83    product_variables: {
84        pdk: {
85            enabled: false,
86        },
87	debuggable: {
88            cflags: [
89                // Allow VTS tests running as root to have
90                // additional permissions.
91                "-DGRANT_ROOT_ALL_PERMISSIONS",
92            ],
93        },
94    },
95
96    required: ["keystore_cli_v2"],
97}
98
99cc_binary {
100    name: "keystore_cli",
101    defaults: ["keystore_defaults"],
102
103    srcs: ["keystore_cli.cpp"],
104    shared_libs: [
105        "android.hardware.keymaster@4.0",
106        "libbinder",
107        "libcrypto",
108        "libcutils",
109        "libhidlbase",
110        "libkeystore_aidl", // for IKeyStoreService.asInterface()
111        "libkeystore_binder",
112        "libkeystore_parcelables",
113        "liblog",
114        "libutils",
115    ],
116}
117
118cc_binary {
119    name: "keystore_cli_v2",
120    defaults: ["keystore_defaults"],
121
122    cflags: [
123        "-DKEYMASTER_NAME_TAGS",
124        "-Wno-unused-parameter",
125    ],
126    srcs: ["keystore_cli_v2.cpp"],
127    shared_libs: [
128        "android.hardware.confirmationui@1.0",
129        "libbinder",
130        "android.hardware.keymaster@4.0",
131        "libchrome",
132        "libutils",
133        "libhidlbase",
134        "libkeymaster4support",
135        "libkeystore_aidl",
136        "libkeystore_binder",
137        "libkeystore_parcelables",
138    ],
139
140    local_include_dirs: ["include"],
141}
142
143cc_library_shared {
144    name: "libkeystore_parcelables",
145    defaults: ["keystore_defaults"],
146    export_include_dirs: ["include"],
147    srcs: [
148        "KeymasterArguments.cpp",
149        "keystore_aidl_hidl_marshalling_utils.cpp",
150        "KeystoreResponse.cpp",
151        "OperationResult.cpp",
152    ],
153    shared_libs: [
154        "android.hardware.keymaster@4.0",
155        "android.hardware.keymaster@4.1",
156        "libbinder",
157        "libhardware",
158        "libhidlbase",
159        "libkeymaster4support",
160        "libkeymaster4_1support",
161        "liblog",
162        "libprotobuf-cpp-lite",
163        "libutils",
164        "libkeystore-attestation-application-id",
165    ],
166    export_shared_lib_headers: [
167        "android.hardware.keymaster@4.0",
168        "android.hardware.keymaster@4.1",
169        "libbinder",
170        "libhidlbase",
171        "libkeymaster4_1support",
172    ],
173}
174// Library for keystore clients
175cc_library_shared {
176    name: "libkeystore_binder",
177    defaults: ["keystore_defaults"],
178
179    srcs: [
180        "keyblob_utils.cpp",
181        "keystore_client.proto",
182        "keystore_client_impl.cpp",
183        "keystore_get.cpp",
184    ],
185    shared_libs: [
186        "android.hardware.keymaster@4.0",
187        "libbinder",
188        "libhidlbase",
189        "libkeymaster4support",
190        "libkeystore_aidl",
191        "libkeystore_parcelables",
192        "liblog",
193        "libprotobuf-cpp-lite",
194        "libutils",
195    ],
196
197    proto: {
198        type: "lite",
199        export_proto_headers: true,
200    },
201    aidl: {
202        export_aidl_headers: true,
203        include_dirs: ["frameworks/base/core/java/"],
204    },
205    export_include_dirs: ["include"],
206    export_shared_lib_headers: [
207        "android.hardware.keymaster@4.0",
208        "libbinder",
209        "libhidlbase",
210        "libkeystore_aidl",
211        "libkeystore_parcelables",
212    ],
213}
214
215// Library used by both keystore and credstore for generating the ASN.1 stored
216// in Tag::ATTESTATION_APPLICATION_ID
217cc_library_shared {
218    name: "libkeystore-attestation-application-id",
219    defaults: ["keystore_defaults"],
220
221    srcs: [
222        ":IKeyAttestationApplicationIdProvider.aidl",
223        "keystore_attestation_id.cpp",
224        "KeyAttestationApplicationId.cpp",
225        "KeyAttestationPackageInfo.cpp",
226        "Signature.cpp",
227    ],
228    shared_libs: [
229        "libbase",
230        "libbinder",
231        "libhidlbase",
232        "liblog",
233        "libutils",
234        "libcrypto",
235    ],
236
237    export_include_dirs: ["include"],
238}
239
240// Library for keystore clients using the WiFi HIDL interface
241cc_library_shared {
242    name: "libkeystore-wifi-hidl",
243    defaults: ["keystore_defaults"],
244
245    srcs: ["keystore_get_wifi_hidl.cpp"],
246    shared_libs: [
247        "android.system.wifi.keystore@1.0",
248        "libbase",
249        "libhidlbase",
250        "liblog",
251        "libutils",
252    ],
253
254    export_include_dirs: ["include"],
255
256    vendor: true,
257}
258
259// Library for unit tests
260cc_library_static {
261    name: "libkeystore_test",
262    defaults: ["keystore_defaults"],
263
264    srcs: [
265        "auth_token_table.cpp",
266        "blob.cpp",
267    ],
268    cflags: [ "-O0", ],
269    static_libs: ["libgtest_main"],
270    shared_libs: [
271        "android.hardware.keymaster@4.0",
272        "libbinder",
273        "libcrypto",
274        "libhidlbase",
275        "libkeymaster4support",
276        "libkeystore-attestation-application-id",
277        "libutils",
278        "libkeystore_aidl",
279        "libkeystore_parcelables",
280    ],
281    export_shared_lib_headers: [
282        "android.hardware.keymaster@4.0",
283        "libhidlbase",
284        "libkeymaster4support",
285    ],
286
287    aidl: {
288        include_dirs: ["frameworks/base/core/java/"],
289    },
290    export_include_dirs: ["include"],
291}
292
293filegroup {
294    name: "keystore_aidl",
295    srcs: [
296        "binder/android/security/IConfirmationPromptCallback.aidl",
297        "binder/android/security/keystore/ICredstoreTokenCallback.aidl",
298        "binder/android/security/keystore/IKeystoreCertificateChainCallback.aidl",
299        "binder/android/security/keystore/IKeystoreExportKeyCallback.aidl",
300        "binder/android/security/keystore/IKeystoreKeyCharacteristicsCallback.aidl",
301        "binder/android/security/keystore/IKeystoreOperationResultCallback.aidl",
302        "binder/android/security/keystore/IKeystoreResponseCallback.aidl",
303        "binder/android/security/keystore/IKeystoreService.aidl",
304    ],
305    path: "binder",
306}
307
308cc_library_shared {
309    name: "libkeystore_aidl",
310    srcs: [":keystore_aidl"],
311    aidl: {
312        export_aidl_headers: true,
313        include_dirs: [
314            "system/security/keystore/binder",
315        ],
316    },
317    shared_libs: [
318        "libbinder",
319        "libcutils",
320        "libhardware",
321        "libhidlbase",
322        "libkeystore_parcelables",
323        "liblog",
324        "libselinux",
325        "libutils",
326    ],
327    export_shared_lib_headers: [
328        "libbinder",
329        "libkeystore_parcelables",
330    ],
331}
332