blob: 462f12fe545a77acadca434f08769dfed986247b [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 {
16 // See: http://go/android-license-faq
17 // A large-scale-change added 'default_applicable_licenses' to import
18 // all of the 'license_kinds' from "system_security_license"
19 // to get the below license kinds:
20 // SPDX-license-identifier-Apache-2.0
21 default_applicable_licenses: ["system_security_license"],
22}
23
Paul Crowley7c57bf12021-02-02 16:26:57 -080024rust_defaults {
25 name: "libkeystore2_defaults",
Janis Danisevskis43c89712020-08-03 23:42:42 +000026 crate_name: "keystore2",
27 srcs: ["src/lib.rs"],
David Drysdalebdb232d2021-11-22 14:41:18 +000028 defaults: [
29 "keymint_use_latest_hal_aidl_rust",
Tri Vo735f9cb2022-09-06 14:30:45 -070030 "keystore2_use_latest_aidl_rust",
David Drysdalebdb232d2021-11-22 14:41:18 +000031 ],
Janis Danisevskis7d77a762020-07-20 13:03:31 -070032
33 rustlibs: [
Shaquille Johnsondf83fb72023-03-24 12:26:52 +000034 "android.hardware.security.rkp-V3-rust",
Jeongik Cha9f632c62021-01-23 09:33:35 +090035 "android.hardware.security.secureclock-V1-rust",
Janis Danisevskis84a83e42021-03-21 21:46:54 -070036 "android.hardware.security.sharedsecret-V1-rust",
Bram Bonné5d6c5102021-02-24 15:09:18 +010037 "android.os.permissions_aidl-rust",
Janis Danisevskis7a1cf382020-11-20 11:22:14 -080038 "android.security.apc-rust",
Janis Danisevskis9f10a6a2021-01-18 16:45:21 +000039 "android.security.authorization-rust",
Joel Galensonde386b42020-09-30 10:53:05 -070040 "android.security.compat-rust",
Janis Danisevskis34a0cf22021-03-08 09:19:03 -080041 "android.security.maintenance-rust",
Hasini Gunasinghe15891e62021-06-10 16:23:27 +000042 "android.security.metrics-rust",
Tri Voe8f04442022-12-21 08:53:56 -080043 "android.security.rkp_aidl-rust",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070044 "libanyhow",
Janis Danisevskise24f3472020-08-12 17:58:49 -070045 "libbinder_rs",
Janis Danisevskis212c68b2021-01-14 22:29:28 -080046 "libkeystore2_aaid-rust",
Janis Danisevskis7a1cf382020-11-20 11:22:14 -080047 "libkeystore2_apc_compat-rust",
Janis Danisevskisb42fc182020-12-15 08:41:27 -080048 "libkeystore2_crypto_rust",
Joel Galensonde386b42020-09-30 10:53:05 -070049 "libkeystore2_km_compat",
Janis Danisevskisce995432020-07-21 12:22:34 -070050 "libkeystore2_selinux",
Janis Danisevskisef14e1a2021-02-23 23:16:55 -080051 "libkeystore2_vintf_rust",
Janis Danisevskis4ad056f2020-08-05 19:46:46 +000052 "liblazy_static",
Hasini Gunasinghe557b1032020-11-10 01:35:30 +000053 "liblibc",
Pavel Grafov94243c22021-04-21 18:03:11 +010054 "liblog_event_list",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070055 "liblog_rust",
Joel Galenson0891bc12020-07-20 10:37:03 -070056 "librand",
Joel Galenson7ead3a22021-07-29 15:27:34 -070057 "librustutils",
Max Bires48fc2e52021-11-17 10:13:04 -080058 "libserde",
59 "libserde_cbor",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070060 "libthiserror",
Tri Vo437d0142023-01-18 16:43:49 -080061 "libtokio",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070062 ],
Joel Galensonba41ca32020-12-28 14:14:07 -080063 shared_libs: [
64 "libcutils",
65 ],
Janis Danisevskis3d5a2142021-05-05 07:31:24 -070066 features: [
67 "watchdog",
68 ],
Janis Danisevskis43c89712020-08-03 23:42:42 +000069}
70
Janis Danisevskis2a8330a2021-01-20 15:34:26 -080071rust_library {
Paul Crowley7c57bf12021-02-02 16:26:57 -080072 name: "libkeystore2",
73 defaults: ["libkeystore2_defaults"],
Jiyong Park975906d2021-09-30 14:58:39 +090074 rustlibs: [
75 "liblibsqlite3_sys",
76 "librusqlite",
77 ],
78}
79
80rust_library {
Janis Danisevskis2a8330a2021-01-20 15:34:26 -080081 name: "libkeystore2_test_utils",
82 crate_name: "keystore2_test_utils",
83 srcs: ["test_utils/lib.rs"],
Tri Vo735f9cb2022-09-06 14:30:45 -070084 defaults: [
85 "keymint_use_latest_hal_aidl_rust",
86 "keystore2_use_latest_aidl_rust",
87 ],
Janis Danisevskis2a8330a2021-01-20 15:34:26 -080088 rustlibs: [
Rajesh Nyamagoud901386c2022-03-21 20:35:18 +000089 "libbinder_rs",
Janis Danisevskisa578d392021-09-20 15:44:06 -070090 "libkeystore2_selinux",
Janis Danisevskis2a8330a2021-01-20 15:34:26 -080091 "liblog_rust",
Janis Danisevskisa578d392021-09-20 15:44:06 -070092 "libnix",
Janis Danisevskis2a8330a2021-01-20 15:34:26 -080093 "librand",
Janis Danisevskisa578d392021-09-20 15:44:06 -070094 "libserde",
95 "libserde_cbor",
Tri Vo735f9cb2022-09-06 14:30:45 -070096 "libthiserror",
97 "libanyhow",
Janis Danisevskisa578d392021-09-20 15:44:06 -070098 ],
99}
100
Rajesh Nyamagoud69a85052022-02-17 16:47:55 +0000101rust_library {
102 name: "libkeystore2_with_test_utils",
103 defaults: ["libkeystore2_defaults"],
104 features: [
105 "keystore2_blob_test_utils",
106 ],
107 rustlibs: [
108 "liblibsqlite3_sys",
109 "librusqlite",
110 "libkeystore2_test_utils",
111 ],
112}
113
Janis Danisevskisa578d392021-09-20 15:44:06 -0700114rust_test {
115 name: "keystore2_test_utils_test",
116 srcs: ["test_utils/lib.rs"],
Tri Vo735f9cb2022-09-06 14:30:45 -0700117 defaults: [
118 "keymint_use_latest_hal_aidl_rust",
119 "keystore2_use_latest_aidl_rust",
120 ],
Janis Danisevskisa578d392021-09-20 15:44:06 -0700121 test_suites: ["general-tests"],
Joel Galenson1edfbea2021-10-26 13:41:07 -0700122 require_root: true,
123 auto_gen_config: true,
Janis Danisevskisa578d392021-09-20 15:44:06 -0700124 compile_multilib: "first",
125 rustlibs: [
Rajesh Nyamagoud901386c2022-03-21 20:35:18 +0000126 "libbinder_rs",
Janis Danisevskisa578d392021-09-20 15:44:06 -0700127 "libkeystore2_selinux",
128 "liblog_rust",
129 "libnix",
130 "librand",
131 "libserde",
132 "libserde_cbor",
Tri Vo735f9cb2022-09-06 14:30:45 -0700133 "libthiserror",
134 "libanyhow",
Matthew Maurer3ca82bc2021-04-29 13:08:40 -0700135 ],
Janis Danisevskis2a8330a2021-01-20 15:34:26 -0800136}
137
Janis Danisevskis43c89712020-08-03 23:42:42 +0000138rust_test {
139 name: "keystore2_test",
Joel Galenson26f4d012020-07-17 14:57:21 -0700140 crate_name: "keystore2",
Joel Galenson3f78dd82021-01-20 16:21:30 -0800141 test_suites: ["general-tests"],
142 auto_gen_config: true,
Janis Danisevskis66784c42021-01-27 08:40:25 -0800143 compile_multilib: "first",
Paul Crowley7c57bf12021-02-02 16:26:57 -0800144 defaults: ["libkeystore2_defaults"],
Janis Danisevskis7d77a762020-07-20 13:03:31 -0700145 rustlibs: [
146 "libandroid_logger",
Janis Danisevskis2a8330a2021-01-20 15:34:26 -0800147 "libkeystore2_test_utils",
Jiyong Park975906d2021-09-30 14:58:39 +0900148 "liblibsqlite3_sys",
Janis Danisevskis5cb52dc2021-04-07 16:31:18 -0700149 "libnix",
Jiyong Park975906d2021-09-30 14:58:39 +0900150 "librusqlite",
Rajesh Nyamagoud69a85052022-02-17 16:47:55 +0000151 "libkeystore2_with_test_utils",
Janis Danisevskis7d77a762020-07-20 13:03:31 -0700152 ],
Janis Danisevskis3d5a2142021-05-05 07:31:24 -0700153 // The test should always include watchdog.
154 features: [
155 "watchdog",
Rajesh Nyamagoud69a85052022-02-17 16:47:55 +0000156 "keystore2_blob_test_utils",
Janis Danisevskis3d5a2142021-05-05 07:31:24 -0700157 ],
Tri Vo30268da2023-01-24 15:35:45 -0800158 require_root: true,
Janis Danisevskis43c89712020-08-03 23:42:42 +0000159}
Janis Danisevskis652f3812020-08-04 00:01:12 +0000160
Jiyong Park975906d2021-09-30 14:58:39 +0900161rust_defaults {
162 name: "keystore2_defaults",
Janis Danisevskis1af91262020-08-10 14:58:08 -0700163 srcs: ["src/keystore2_main.rs"],
164 rustlibs: [
165 "libandroid_logger",
166 "libbinder_rs",
Janis Danisevskis1af91262020-08-10 14:58:08 -0700167 "liblog_rust",
168 ],
169 init_rc: ["keystore2.rc"],
Stephen Crane56936e82021-03-10 17:48:26 -0800170
Matthew Maurer3ca82bc2021-04-29 13:08:40 -0700171 // In S, keystore2 is the only process using dynamically linked Rust from
172 // /system. As a result, the usual savings from sharing libraries don't
173 // apply.
174 // Remove `prefer_rlib: true` once we have several processes, once a space
175 // calculation shows net RAM savings, or once we have automatic variant
176 // selection available in the build system.
177 prefer_rlib: true,
178
Stephen Crane56936e82021-03-10 17:48:26 -0800179 vintf_fragments: ["android.system.keystore2-service.xml"],
Janis Danisevskis2cb4f092021-05-17 13:25:07 -0700180
181 required: ["keystore_cli_v2"],
Janis Danisevskis1af91262020-08-10 14:58:08 -0700182}
Jiyong Park975906d2021-09-30 14:58:39 +0900183
184rust_binary {
185 name: "keystore2",
186 defaults: ["keystore2_defaults"],
187 rustlibs: [
188 "libkeystore2",
189 "liblegacykeystore-rust",
190 "librusqlite",
191 ],
Yi Kong32701412022-01-22 02:53:12 +0800192 afdo: true,
Jiyong Park975906d2021-09-30 14:58:39 +0900193}