blob: 74aa4bdeb861f1f7d18824a056817ff6d326153d [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",
30 ],
Janis Danisevskis7d77a762020-07-20 13:03:31 -070031
32 rustlibs: [
Jeongik Cha9f632c62021-01-23 09:33:35 +090033 "android.hardware.security.secureclock-V1-rust",
Janis Danisevskis84a83e42021-03-21 21:46:54 -070034 "android.hardware.security.sharedsecret-V1-rust",
Bram Bonné5d6c5102021-02-24 15:09:18 +010035 "android.os.permissions_aidl-rust",
Janis Danisevskis7a1cf382020-11-20 11:22:14 -080036 "android.security.apc-rust",
Janis Danisevskis9f10a6a2021-01-18 16:45:21 +000037 "android.security.authorization-rust",
Joel Galensonde386b42020-09-30 10:53:05 -070038 "android.security.compat-rust",
Janis Danisevskis34a0cf22021-03-08 09:19:03 -080039 "android.security.maintenance-rust",
Hasini Gunasinghe15891e62021-06-10 16:23:27 +000040 "android.security.metrics-rust",
Max Bires148c08e2020-10-13 13:41:41 -070041 "android.security.remoteprovisioning-rust",
Seth Moore0400d702021-12-13 20:03:33 +000042 "android.system.keystore2-V2-rust",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070043 "libanyhow",
Janis Danisevskise24f3472020-08-12 17:58:49 -070044 "libbinder_rs",
Janis Danisevskis212c68b2021-01-14 22:29:28 -080045 "libkeystore2_aaid-rust",
Janis Danisevskis7a1cf382020-11-20 11:22:14 -080046 "libkeystore2_apc_compat-rust",
Janis Danisevskisb42fc182020-12-15 08:41:27 -080047 "libkeystore2_crypto_rust",
Joel Galensonde386b42020-09-30 10:53:05 -070048 "libkeystore2_km_compat",
Janis Danisevskisce995432020-07-21 12:22:34 -070049 "libkeystore2_selinux",
Janis Danisevskisef14e1a2021-02-23 23:16:55 -080050 "libkeystore2_vintf_rust",
Janis Danisevskis4ad056f2020-08-05 19:46:46 +000051 "liblazy_static",
Hasini Gunasinghe557b1032020-11-10 01:35:30 +000052 "liblibc",
Pavel Grafov94243c22021-04-21 18:03:11 +010053 "liblog_event_list",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070054 "liblog_rust",
Joel Galenson0891bc12020-07-20 10:37:03 -070055 "librand",
Joel Galenson7ead3a22021-07-29 15:27:34 -070056 "librustutils",
Max Bires48fc2e52021-11-17 10:13:04 -080057 "libserde",
58 "libserde_cbor",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070059 "libthiserror",
60 ],
Joel Galensonba41ca32020-12-28 14:14:07 -080061 shared_libs: [
62 "libcutils",
63 ],
Janis Danisevskis3d5a2142021-05-05 07:31:24 -070064 features: [
65 "watchdog",
66 ],
Janis Danisevskis43c89712020-08-03 23:42:42 +000067}
68
Janis Danisevskis2a8330a2021-01-20 15:34:26 -080069rust_library {
Paul Crowley7c57bf12021-02-02 16:26:57 -080070 name: "libkeystore2",
71 defaults: ["libkeystore2_defaults"],
Jiyong Park975906d2021-09-30 14:58:39 +090072 rustlibs: [
73 "liblibsqlite3_sys",
74 "librusqlite",
75 ],
76}
77
78rust_library {
Janis Danisevskis2a8330a2021-01-20 15:34:26 -080079 name: "libkeystore2_test_utils",
80 crate_name: "keystore2_test_utils",
81 srcs: ["test_utils/lib.rs"],
82 rustlibs: [
Janis Danisevskisa578d392021-09-20 15:44:06 -070083 "libkeystore2_selinux",
Janis Danisevskis2a8330a2021-01-20 15:34:26 -080084 "liblog_rust",
Janis Danisevskisa578d392021-09-20 15:44:06 -070085 "libnix",
Janis Danisevskis2a8330a2021-01-20 15:34:26 -080086 "librand",
Janis Danisevskisa578d392021-09-20 15:44:06 -070087 "libserde",
88 "libserde_cbor",
89 ],
90}
91
Rajesh Nyamagoud69a85052022-02-17 16:47:55 +000092rust_library {
93 name: "libkeystore2_with_test_utils",
94 defaults: ["libkeystore2_defaults"],
95 features: [
96 "keystore2_blob_test_utils",
97 ],
98 rustlibs: [
99 "liblibsqlite3_sys",
100 "librusqlite",
101 "libkeystore2_test_utils",
102 ],
103}
104
Janis Danisevskisa578d392021-09-20 15:44:06 -0700105rust_test {
106 name: "keystore2_test_utils_test",
107 srcs: ["test_utils/lib.rs"],
108 test_suites: ["general-tests"],
Joel Galenson1edfbea2021-10-26 13:41:07 -0700109 require_root: true,
110 auto_gen_config: true,
Janis Danisevskisa578d392021-09-20 15:44:06 -0700111 compile_multilib: "first",
112 rustlibs: [
113 "libkeystore2_selinux",
114 "liblog_rust",
115 "libnix",
116 "librand",
117 "libserde",
118 "libserde_cbor",
Matthew Maurer3ca82bc2021-04-29 13:08:40 -0700119 ],
Janis Danisevskis2a8330a2021-01-20 15:34:26 -0800120}
121
Janis Danisevskis43c89712020-08-03 23:42:42 +0000122rust_test {
123 name: "keystore2_test",
Joel Galenson26f4d012020-07-17 14:57:21 -0700124 crate_name: "keystore2",
Joel Galenson3f78dd82021-01-20 16:21:30 -0800125 test_suites: ["general-tests"],
126 auto_gen_config: true,
Janis Danisevskis66784c42021-01-27 08:40:25 -0800127 compile_multilib: "first",
Paul Crowley7c57bf12021-02-02 16:26:57 -0800128 defaults: ["libkeystore2_defaults"],
Janis Danisevskis7d77a762020-07-20 13:03:31 -0700129 rustlibs: [
130 "libandroid_logger",
Janis Danisevskis2a8330a2021-01-20 15:34:26 -0800131 "libkeystore2_test_utils",
Jiyong Park975906d2021-09-30 14:58:39 +0900132 "liblibsqlite3_sys",
Janis Danisevskis5cb52dc2021-04-07 16:31:18 -0700133 "libnix",
Jiyong Park975906d2021-09-30 14:58:39 +0900134 "librusqlite",
Rajesh Nyamagoud69a85052022-02-17 16:47:55 +0000135 "libkeystore2_with_test_utils",
Janis Danisevskis7d77a762020-07-20 13:03:31 -0700136 ],
Janis Danisevskis3d5a2142021-05-05 07:31:24 -0700137 // The test should always include watchdog.
138 features: [
139 "watchdog",
Rajesh Nyamagoud69a85052022-02-17 16:47:55 +0000140 "keystore2_blob_test_utils",
Janis Danisevskis3d5a2142021-05-05 07:31:24 -0700141 ],
Janis Danisevskis43c89712020-08-03 23:42:42 +0000142}
Janis Danisevskis652f3812020-08-04 00:01:12 +0000143
Jiyong Park975906d2021-09-30 14:58:39 +0900144rust_defaults {
145 name: "keystore2_defaults",
Janis Danisevskis1af91262020-08-10 14:58:08 -0700146 srcs: ["src/keystore2_main.rs"],
147 rustlibs: [
148 "libandroid_logger",
149 "libbinder_rs",
Janis Danisevskis1af91262020-08-10 14:58:08 -0700150 "liblog_rust",
151 ],
152 init_rc: ["keystore2.rc"],
Stephen Crane56936e82021-03-10 17:48:26 -0800153
Matthew Maurer3ca82bc2021-04-29 13:08:40 -0700154 // In S, keystore2 is the only process using dynamically linked Rust from
155 // /system. As a result, the usual savings from sharing libraries don't
156 // apply.
157 // Remove `prefer_rlib: true` once we have several processes, once a space
158 // calculation shows net RAM savings, or once we have automatic variant
159 // selection available in the build system.
160 prefer_rlib: true,
161
Stephen Crane56936e82021-03-10 17:48:26 -0800162 vintf_fragments: ["android.system.keystore2-service.xml"],
Janis Danisevskis2cb4f092021-05-17 13:25:07 -0700163
164 required: ["keystore_cli_v2"],
Janis Danisevskis1af91262020-08-10 14:58:08 -0700165}
Jiyong Park975906d2021-09-30 14:58:39 +0900166
167rust_binary {
168 name: "keystore2",
169 defaults: ["keystore2_defaults"],
170 rustlibs: [
171 "libkeystore2",
172 "liblegacykeystore-rust",
173 "librusqlite",
174 ],
175}