blob: ef5111fdaa44671d1acab0a6bf613a6f64f12615 [file] [log] [blame]
Janis Danisevskis43c89712020-08-03 23:42:42 +00001// Copyright 2020, The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Bob Badour4c7858c2021-02-12 15:40:29 -080015package {
Vikram Gaur743f1782024-09-06 05:45:08 +000016 default_team: "trendy_team_android_hardware_backed_security",
Bob Badour4c7858c2021-02-12 15:40:29 -080017 // See: http://go/android-license-faq
18 // A large-scale-change added 'default_applicable_licenses' to import
19 // all of the 'license_kinds' from "system_security_license"
20 // to get the below license kinds:
21 // SPDX-license-identifier-Apache-2.0
22 default_applicable_licenses: ["system_security_license"],
23}
24
Paul Crowley7c57bf12021-02-02 16:26:57 -080025rust_defaults {
26 name: "libkeystore2_defaults",
Janis Danisevskis43c89712020-08-03 23:42:42 +000027 crate_name: "keystore2",
28 srcs: ["src/lib.rs"],
David Drysdalebdb232d2021-11-22 14:41:18 +000029 defaults: [
30 "keymint_use_latest_hal_aidl_rust",
Tri Vo735f9cb2022-09-06 14:30:45 -070031 "keystore2_use_latest_aidl_rust",
Markus Villfdf43172024-01-31 15:57:04 +010032 "structured_log_rust_defaults",
David Drysdalebdb232d2021-11-22 14:41:18 +000033 ],
Alice Wang81dbef72024-07-31 15:13:14 +000034 cfgs: select(release_flag("RELEASE_AVF_ENABLE_EARLY_VM"), {
35 true: ["early_vm"],
36 default: [],
37 }),
Janis Danisevskis7d77a762020-07-20 13:03:31 -070038 rustlibs: [
Shaquille Johnsondf83fb72023-03-24 12:26:52 +000039 "android.hardware.security.rkp-V3-rust",
Jeongik Cha9f632c62021-01-23 09:33:35 +090040 "android.hardware.security.secureclock-V1-rust",
Janis Danisevskis84a83e42021-03-21 21:46:54 -070041 "android.hardware.security.sharedsecret-V1-rust",
Bram Bonné5d6c5102021-02-24 15:09:18 +010042 "android.os.permissions_aidl-rust",
Janis Danisevskis7a1cf382020-11-20 11:22:14 -080043 "android.security.apc-rust",
Janis Danisevskis9f10a6a2021-01-18 16:45:21 +000044 "android.security.authorization-rust",
Joel Galensonde386b42020-09-30 10:53:05 -070045 "android.security.compat-rust",
Janis Danisevskis34a0cf22021-03-08 09:19:03 -080046 "android.security.maintenance-rust",
Hasini Gunasinghe15891e62021-06-10 16:23:27 +000047 "android.security.metrics-rust",
Tri Voe8f04442022-12-21 08:53:56 -080048 "android.security.rkp_aidl-rust",
James Willcoxd215da82023-10-03 21:31:31 +000049 "libaconfig_android_hardware_biometrics_rust",
Eric Biggers698922b2023-11-02 21:19:42 +000050 "libandroid_security_flags_rust",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070051 "libanyhow",
Janis Danisevskise24f3472020-08-12 17:58:49 -070052 "libbinder_rs",
Karuna Wadheraca704492024-11-20 06:50:29 +000053 "libbssl_crypto",
54 "libder",
Janis Danisevskis212c68b2021-01-14 22:29:28 -080055 "libkeystore2_aaid-rust",
Janis Danisevskis7a1cf382020-11-20 11:22:14 -080056 "libkeystore2_apc_compat-rust",
Janis Danisevskisb42fc182020-12-15 08:41:27 -080057 "libkeystore2_crypto_rust",
Shaquille Johnson7f5a8152023-09-27 18:46:27 +010058 "libkeystore2_flags_rust",
Luca Stefani481b5d62024-01-17 11:42:06 +010059 "libkeystore2_hal_names_rust",
Joel Galensonde386b42020-09-30 10:53:05 -070060 "libkeystore2_km_compat",
Janis Danisevskisce995432020-07-21 12:22:34 -070061 "libkeystore2_selinux",
Hasini Gunasinghe557b1032020-11-10 01:35:30 +000062 "liblibc",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070063 "liblog_rust",
Alice Wange66c3312023-11-07 12:41:42 +000064 "libmessage_macro",
Vikram Gaur743f1782024-09-06 05:45:08 +000065 "libpostprocessor_client",
Joel Galenson0891bc12020-07-20 10:37:03 -070066 "librand",
Alice Wang01c16b62023-11-07 14:27:49 +000067 "librkpd_client",
Joel Galenson7ead3a22021-07-29 15:27:34 -070068 "librustutils",
Max Bires48fc2e52021-11-17 10:13:04 -080069 "libserde",
70 "libserde_cbor",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070071 "libthiserror",
Tri Vo437d0142023-01-18 16:43:49 -080072 "libtokio",
Alice Wang83c6aef2023-11-03 17:17:34 +000073 "libwatchdog_rs",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070074 ],
Joel Galensonba41ca32020-12-28 14:14:07 -080075 shared_libs: [
76 "libcutils",
77 ],
Janis Danisevskis3d5a2142021-05-05 07:31:24 -070078 features: [
79 "watchdog",
80 ],
Janis Danisevskis43c89712020-08-03 23:42:42 +000081}
82
Janis Danisevskis2a8330a2021-01-20 15:34:26 -080083rust_library {
Paul Crowley7c57bf12021-02-02 16:26:57 -080084 name: "libkeystore2",
85 defaults: ["libkeystore2_defaults"],
Jiyong Park975906d2021-09-30 14:58:39 +090086 rustlibs: [
87 "liblibsqlite3_sys",
88 "librusqlite",
89 ],
90}
91
92rust_library {
Rajesh Nyamagoud69a85052022-02-17 16:47:55 +000093 name: "libkeystore2_with_test_utils",
94 defaults: ["libkeystore2_defaults"],
95 features: [
96 "keystore2_blob_test_utils",
97 ],
98 rustlibs: [
Luca Stefani481b5d62024-01-17 11:42:06 +010099 "libkeystore2_test_utils",
Rajesh Nyamagoud69a85052022-02-17 16:47:55 +0000100 "liblibsqlite3_sys",
101 "librusqlite",
Rajesh Nyamagoud69a85052022-02-17 16:47:55 +0000102 ],
103}
104
Janis Danisevskisa578d392021-09-20 15:44:06 -0700105rust_test {
Janis Danisevskis43c89712020-08-03 23:42:42 +0000106 name: "keystore2_test",
Joel Galenson26f4d012020-07-17 14:57:21 -0700107 crate_name: "keystore2",
Joel Galenson3f78dd82021-01-20 16:21:30 -0800108 test_suites: ["general-tests"],
109 auto_gen_config: true,
Janis Danisevskis66784c42021-01-27 08:40:25 -0800110 compile_multilib: "first",
Paul Crowley7c57bf12021-02-02 16:26:57 -0800111 defaults: ["libkeystore2_defaults"],
Janis Danisevskis7d77a762020-07-20 13:03:31 -0700112 rustlibs: [
113 "libandroid_logger",
David Drysdalec0ed9862023-07-05 07:11:39 +0100114 "libhex",
Janis Danisevskis2a8330a2021-01-20 15:34:26 -0800115 "libkeystore2_test_utils",
Luca Stefani481b5d62024-01-17 11:42:06 +0100116 "libkeystore2_with_test_utils",
Jiyong Park975906d2021-09-30 14:58:39 +0900117 "liblibsqlite3_sys",
Janis Danisevskis5cb52dc2021-04-07 16:31:18 -0700118 "libnix",
Jiyong Park975906d2021-09-30 14:58:39 +0900119 "librusqlite",
David Drysdaleda897432024-06-24 15:57:35 +0100120 "libtempfile",
Janis Danisevskis7d77a762020-07-20 13:03:31 -0700121 ],
Janis Danisevskis3d5a2142021-05-05 07:31:24 -0700122 // The test should always include watchdog.
123 features: [
Rajesh Nyamagoud69a85052022-02-17 16:47:55 +0000124 "keystore2_blob_test_utils",
Luca Stefani481b5d62024-01-17 11:42:06 +0100125 "watchdog",
Janis Danisevskis3d5a2142021-05-05 07:31:24 -0700126 ],
Tri Vo30268da2023-01-24 15:35:45 -0800127 require_root: true,
Janis Danisevskis43c89712020-08-03 23:42:42 +0000128}
Janis Danisevskis652f3812020-08-04 00:01:12 +0000129
Kiyoung Kim32034c72024-10-11 17:08:57 +0900130vintf_fragment {
131 name: "android.system.keystore2-service.xml",
132 src: "android.system.keystore2-service.xml",
133}
134
Jiyong Park975906d2021-09-30 14:58:39 +0900135rust_defaults {
136 name: "keystore2_defaults",
Janis Danisevskis1af91262020-08-10 14:58:08 -0700137 srcs: ["src/keystore2_main.rs"],
138 rustlibs: [
139 "libandroid_logger",
140 "libbinder_rs",
Janis Danisevskis1af91262020-08-10 14:58:08 -0700141 "liblog_rust",
142 ],
143 init_rc: ["keystore2.rc"],
Stephen Crane56936e82021-03-10 17:48:26 -0800144
Matthew Maurer3ca82bc2021-04-29 13:08:40 -0700145 // In S, keystore2 is the only process using dynamically linked Rust from
146 // /system. As a result, the usual savings from sharing libraries don't
147 // apply.
148 // Remove `prefer_rlib: true` once we have several processes, once a space
149 // calculation shows net RAM savings, or once we have automatic variant
150 // selection available in the build system.
151 prefer_rlib: true,
152
Kiyoung Kim32034c72024-10-11 17:08:57 +0900153 vintf_fragment_modules: ["android.system.keystore2-service.xml"],
Janis Danisevskis2cb4f092021-05-17 13:25:07 -0700154
155 required: ["keystore_cli_v2"],
Janis Danisevskis1af91262020-08-10 14:58:08 -0700156}
Jiyong Park975906d2021-09-30 14:58:39 +0900157
158rust_binary {
159 name: "keystore2",
160 defaults: ["keystore2_defaults"],
161 rustlibs: [
162 "libkeystore2",
163 "liblegacykeystore-rust",
164 "librusqlite",
165 ],
Yi Kong32701412022-01-22 02:53:12 +0800166 afdo: true,
Jiyong Park975906d2021-09-30 14:58:39 +0900167}
Shaquille Johnson6a751992023-09-27 17:08:01 +0100168
169// Keystore Flag definitions
170aconfig_declarations {
171 name: "keystore2_flags",
172 package: "android.security.keystore2",
Oriol Prieto Gasco85d84ff2024-02-03 02:39:40 +0000173 container: "system",
Shaquille Johnson6a751992023-09-27 17:08:01 +0100174 srcs: ["aconfig/flags.aconfig"],
175}
176
Shaquille Johnsona3f10492024-06-20 09:53:36 +0000177java_aconfig_library {
178 name: "keystore2_flags_java",
179 aconfig_declarations: "keystore2_flags",
180}
181
Victor Hsiehb01202d2024-10-17 12:05:32 -0700182java_aconfig_library {
183 name: "keystore2_flags_java-host",
184 aconfig_declarations: "keystore2_flags",
185 host_supported: true,
186}
187
Karuna Wadhera0a17cbb2024-11-11 20:30:00 +0000188java_aconfig_library {
189 name: "keystore2_flags_java-framework",
190 aconfig_declarations: "keystore2_flags",
191 defaults: ["framework-minus-apex-aconfig-java-defaults"],
192}
193
Shaquille Johnson6a751992023-09-27 17:08:01 +0100194rust_aconfig_library {
195 name: "libkeystore2_flags_rust",
196 crate_name: "keystore2_flags",
197 aconfig_declarations: "keystore2_flags",
198}
James Willcoxd215da82023-10-03 21:31:31 +0000199
200rust_aconfig_library {
201 name: "libaconfig_android_hardware_biometrics_rust",
202 crate_name: "aconfig_android_hardware_biometrics_rust",
203 aconfig_declarations: "android.hardware.biometrics.flags-aconfig",
204}