Janis Danisevskis | 43c8971 | 2020-08-03 23:42:42 +0000 | [diff] [blame] | 1 | // 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 Badour | 4c7858c | 2021-02-12 15:40:29 -0800 | [diff] [blame] | 15 | package { |
| 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 Crowley | 7c57bf1 | 2021-02-02 16:26:57 -0800 | [diff] [blame] | 24 | rust_defaults { |
| 25 | name: "libkeystore2_defaults", |
Janis Danisevskis | 43c8971 | 2020-08-03 23:42:42 +0000 | [diff] [blame] | 26 | crate_name: "keystore2", |
| 27 | srcs: ["src/lib.rs"], |
David Drysdale | bdb232d | 2021-11-22 14:41:18 +0000 | [diff] [blame] | 28 | defaults: [ |
| 29 | "keymint_use_latest_hal_aidl_rust", |
Tri Vo | 735f9cb | 2022-09-06 14:30:45 -0700 | [diff] [blame] | 30 | "keystore2_use_latest_aidl_rust", |
David Drysdale | bdb232d | 2021-11-22 14:41:18 +0000 | [diff] [blame] | 31 | ], |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 32 | |
| 33 | rustlibs: [ |
Seth Moore | cd6e918 | 2022-11-04 17:39:05 +0000 | [diff] [blame] | 34 | "android.hardware.security.rkp-V3-rust", |
Jeongik Cha | 9f632c6 | 2021-01-23 09:33:35 +0900 | [diff] [blame] | 35 | "android.hardware.security.secureclock-V1-rust", |
Janis Danisevskis | 84a83e4 | 2021-03-21 21:46:54 -0700 | [diff] [blame] | 36 | "android.hardware.security.sharedsecret-V1-rust", |
Bram Bonné | 5d6c510 | 2021-02-24 15:09:18 +0100 | [diff] [blame] | 37 | "android.os.permissions_aidl-rust", |
Janis Danisevskis | 7a1cf38 | 2020-11-20 11:22:14 -0800 | [diff] [blame] | 38 | "android.security.apc-rust", |
Janis Danisevskis | 9f10a6a | 2021-01-18 16:45:21 +0000 | [diff] [blame] | 39 | "android.security.authorization-rust", |
Joel Galenson | de386b4 | 2020-09-30 10:53:05 -0700 | [diff] [blame] | 40 | "android.security.compat-rust", |
Janis Danisevskis | 34a0cf2 | 2021-03-08 09:19:03 -0800 | [diff] [blame] | 41 | "android.security.maintenance-rust", |
Hasini Gunasinghe | 15891e6 | 2021-06-10 16:23:27 +0000 | [diff] [blame] | 42 | "android.security.metrics-rust", |
Max Bires | 148c08e | 2020-10-13 13:41:41 -0700 | [diff] [blame] | 43 | "android.security.remoteprovisioning-rust", |
Tri Vo | e8f0444 | 2022-12-21 08:53:56 -0800 | [diff] [blame] | 44 | "android.security.rkp_aidl-rust", |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 45 | "libanyhow", |
Janis Danisevskis | e24f347 | 2020-08-12 17:58:49 -0700 | [diff] [blame] | 46 | "libbinder_rs", |
Janis Danisevskis | 212c68b | 2021-01-14 22:29:28 -0800 | [diff] [blame] | 47 | "libkeystore2_aaid-rust", |
Janis Danisevskis | 7a1cf38 | 2020-11-20 11:22:14 -0800 | [diff] [blame] | 48 | "libkeystore2_apc_compat-rust", |
Janis Danisevskis | b42fc18 | 2020-12-15 08:41:27 -0800 | [diff] [blame] | 49 | "libkeystore2_crypto_rust", |
Joel Galenson | de386b4 | 2020-09-30 10:53:05 -0700 | [diff] [blame] | 50 | "libkeystore2_km_compat", |
Janis Danisevskis | ce99543 | 2020-07-21 12:22:34 -0700 | [diff] [blame] | 51 | "libkeystore2_selinux", |
Janis Danisevskis | ef14e1a | 2021-02-23 23:16:55 -0800 | [diff] [blame] | 52 | "libkeystore2_vintf_rust", |
Janis Danisevskis | 4ad056f | 2020-08-05 19:46:46 +0000 | [diff] [blame] | 53 | "liblazy_static", |
Hasini Gunasinghe | 557b103 | 2020-11-10 01:35:30 +0000 | [diff] [blame] | 54 | "liblibc", |
Pavel Grafov | 94243c2 | 2021-04-21 18:03:11 +0100 | [diff] [blame] | 55 | "liblog_event_list", |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 56 | "liblog_rust", |
Joel Galenson | 0891bc1 | 2020-07-20 10:37:03 -0700 | [diff] [blame] | 57 | "librand", |
Joel Galenson | 7ead3a2 | 2021-07-29 15:27:34 -0700 | [diff] [blame] | 58 | "librustutils", |
Max Bires | 48fc2e5 | 2021-11-17 10:13:04 -0800 | [diff] [blame] | 59 | "libserde", |
| 60 | "libserde_cbor", |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 61 | "libthiserror", |
Tri Vo | 437d014 | 2023-01-18 16:43:49 -0800 | [diff] [blame^] | 62 | "libtokio", |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 63 | ], |
Joel Galenson | ba41ca3 | 2020-12-28 14:14:07 -0800 | [diff] [blame] | 64 | shared_libs: [ |
| 65 | "libcutils", |
| 66 | ], |
Janis Danisevskis | 3d5a214 | 2021-05-05 07:31:24 -0700 | [diff] [blame] | 67 | features: [ |
| 68 | "watchdog", |
| 69 | ], |
Janis Danisevskis | 43c8971 | 2020-08-03 23:42:42 +0000 | [diff] [blame] | 70 | } |
| 71 | |
Janis Danisevskis | 2a8330a | 2021-01-20 15:34:26 -0800 | [diff] [blame] | 72 | rust_library { |
Paul Crowley | 7c57bf1 | 2021-02-02 16:26:57 -0800 | [diff] [blame] | 73 | name: "libkeystore2", |
| 74 | defaults: ["libkeystore2_defaults"], |
Jiyong Park | 975906d | 2021-09-30 14:58:39 +0900 | [diff] [blame] | 75 | rustlibs: [ |
| 76 | "liblibsqlite3_sys", |
| 77 | "librusqlite", |
| 78 | ], |
| 79 | } |
| 80 | |
| 81 | rust_library { |
Janis Danisevskis | 2a8330a | 2021-01-20 15:34:26 -0800 | [diff] [blame] | 82 | name: "libkeystore2_test_utils", |
| 83 | crate_name: "keystore2_test_utils", |
| 84 | srcs: ["test_utils/lib.rs"], |
Tri Vo | 735f9cb | 2022-09-06 14:30:45 -0700 | [diff] [blame] | 85 | defaults: [ |
| 86 | "keymint_use_latest_hal_aidl_rust", |
| 87 | "keystore2_use_latest_aidl_rust", |
| 88 | ], |
Janis Danisevskis | 2a8330a | 2021-01-20 15:34:26 -0800 | [diff] [blame] | 89 | rustlibs: [ |
Seth Moore | cd6e918 | 2022-11-04 17:39:05 +0000 | [diff] [blame] | 90 | "android.hardware.security.rkp-V3-rust", |
Rajesh Nyamagoud | 901386c | 2022-03-21 20:35:18 +0000 | [diff] [blame] | 91 | "libbinder_rs", |
Janis Danisevskis | a578d39 | 2021-09-20 15:44:06 -0700 | [diff] [blame] | 92 | "libkeystore2_selinux", |
Janis Danisevskis | 2a8330a | 2021-01-20 15:34:26 -0800 | [diff] [blame] | 93 | "liblog_rust", |
Janis Danisevskis | a578d39 | 2021-09-20 15:44:06 -0700 | [diff] [blame] | 94 | "libnix", |
Janis Danisevskis | 2a8330a | 2021-01-20 15:34:26 -0800 | [diff] [blame] | 95 | "librand", |
Janis Danisevskis | a578d39 | 2021-09-20 15:44:06 -0700 | [diff] [blame] | 96 | "libserde", |
| 97 | "libserde_cbor", |
Tri Vo | 735f9cb | 2022-09-06 14:30:45 -0700 | [diff] [blame] | 98 | "libthiserror", |
| 99 | "libanyhow", |
Janis Danisevskis | a578d39 | 2021-09-20 15:44:06 -0700 | [diff] [blame] | 100 | ], |
| 101 | } |
| 102 | |
Rajesh Nyamagoud | 69a8505 | 2022-02-17 16:47:55 +0000 | [diff] [blame] | 103 | rust_library { |
| 104 | name: "libkeystore2_with_test_utils", |
| 105 | defaults: ["libkeystore2_defaults"], |
| 106 | features: [ |
| 107 | "keystore2_blob_test_utils", |
| 108 | ], |
| 109 | rustlibs: [ |
| 110 | "liblibsqlite3_sys", |
| 111 | "librusqlite", |
| 112 | "libkeystore2_test_utils", |
| 113 | ], |
| 114 | } |
| 115 | |
Janis Danisevskis | a578d39 | 2021-09-20 15:44:06 -0700 | [diff] [blame] | 116 | rust_test { |
| 117 | name: "keystore2_test_utils_test", |
| 118 | srcs: ["test_utils/lib.rs"], |
Tri Vo | 735f9cb | 2022-09-06 14:30:45 -0700 | [diff] [blame] | 119 | defaults: [ |
| 120 | "keymint_use_latest_hal_aidl_rust", |
| 121 | "keystore2_use_latest_aidl_rust", |
| 122 | ], |
Janis Danisevskis | a578d39 | 2021-09-20 15:44:06 -0700 | [diff] [blame] | 123 | test_suites: ["general-tests"], |
Joel Galenson | 1edfbea | 2021-10-26 13:41:07 -0700 | [diff] [blame] | 124 | require_root: true, |
| 125 | auto_gen_config: true, |
Janis Danisevskis | a578d39 | 2021-09-20 15:44:06 -0700 | [diff] [blame] | 126 | compile_multilib: "first", |
| 127 | rustlibs: [ |
Seth Moore | cd6e918 | 2022-11-04 17:39:05 +0000 | [diff] [blame] | 128 | "android.hardware.security.rkp-V3-rust", |
Rajesh Nyamagoud | 901386c | 2022-03-21 20:35:18 +0000 | [diff] [blame] | 129 | "libbinder_rs", |
Janis Danisevskis | a578d39 | 2021-09-20 15:44:06 -0700 | [diff] [blame] | 130 | "libkeystore2_selinux", |
| 131 | "liblog_rust", |
| 132 | "libnix", |
| 133 | "librand", |
| 134 | "libserde", |
| 135 | "libserde_cbor", |
Tri Vo | 735f9cb | 2022-09-06 14:30:45 -0700 | [diff] [blame] | 136 | "libthiserror", |
| 137 | "libanyhow", |
Matthew Maurer | 3ca82bc | 2021-04-29 13:08:40 -0700 | [diff] [blame] | 138 | ], |
Janis Danisevskis | 2a8330a | 2021-01-20 15:34:26 -0800 | [diff] [blame] | 139 | } |
| 140 | |
Janis Danisevskis | 43c8971 | 2020-08-03 23:42:42 +0000 | [diff] [blame] | 141 | rust_test { |
| 142 | name: "keystore2_test", |
Joel Galenson | 26f4d01 | 2020-07-17 14:57:21 -0700 | [diff] [blame] | 143 | crate_name: "keystore2", |
Joel Galenson | 3f78dd8 | 2021-01-20 16:21:30 -0800 | [diff] [blame] | 144 | test_suites: ["general-tests"], |
| 145 | auto_gen_config: true, |
Janis Danisevskis | 66784c4 | 2021-01-27 08:40:25 -0800 | [diff] [blame] | 146 | compile_multilib: "first", |
Paul Crowley | 7c57bf1 | 2021-02-02 16:26:57 -0800 | [diff] [blame] | 147 | defaults: ["libkeystore2_defaults"], |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 148 | rustlibs: [ |
| 149 | "libandroid_logger", |
Janis Danisevskis | 2a8330a | 2021-01-20 15:34:26 -0800 | [diff] [blame] | 150 | "libkeystore2_test_utils", |
Jiyong Park | 975906d | 2021-09-30 14:58:39 +0900 | [diff] [blame] | 151 | "liblibsqlite3_sys", |
Janis Danisevskis | 5cb52dc | 2021-04-07 16:31:18 -0700 | [diff] [blame] | 152 | "libnix", |
Jiyong Park | 975906d | 2021-09-30 14:58:39 +0900 | [diff] [blame] | 153 | "librusqlite", |
Rajesh Nyamagoud | 69a8505 | 2022-02-17 16:47:55 +0000 | [diff] [blame] | 154 | "libkeystore2_with_test_utils", |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 155 | ], |
Janis Danisevskis | 3d5a214 | 2021-05-05 07:31:24 -0700 | [diff] [blame] | 156 | // The test should always include watchdog. |
| 157 | features: [ |
| 158 | "watchdog", |
Rajesh Nyamagoud | 69a8505 | 2022-02-17 16:47:55 +0000 | [diff] [blame] | 159 | "keystore2_blob_test_utils", |
Janis Danisevskis | 3d5a214 | 2021-05-05 07:31:24 -0700 | [diff] [blame] | 160 | ], |
Janis Danisevskis | 43c8971 | 2020-08-03 23:42:42 +0000 | [diff] [blame] | 161 | } |
Janis Danisevskis | 652f381 | 2020-08-04 00:01:12 +0000 | [diff] [blame] | 162 | |
Jiyong Park | 975906d | 2021-09-30 14:58:39 +0900 | [diff] [blame] | 163 | rust_defaults { |
| 164 | name: "keystore2_defaults", |
Janis Danisevskis | 1af9126 | 2020-08-10 14:58:08 -0700 | [diff] [blame] | 165 | srcs: ["src/keystore2_main.rs"], |
| 166 | rustlibs: [ |
| 167 | "libandroid_logger", |
| 168 | "libbinder_rs", |
Janis Danisevskis | 1af9126 | 2020-08-10 14:58:08 -0700 | [diff] [blame] | 169 | "liblog_rust", |
| 170 | ], |
| 171 | init_rc: ["keystore2.rc"], |
Stephen Crane | 56936e8 | 2021-03-10 17:48:26 -0800 | [diff] [blame] | 172 | |
Matthew Maurer | 3ca82bc | 2021-04-29 13:08:40 -0700 | [diff] [blame] | 173 | // In S, keystore2 is the only process using dynamically linked Rust from |
| 174 | // /system. As a result, the usual savings from sharing libraries don't |
| 175 | // apply. |
| 176 | // Remove `prefer_rlib: true` once we have several processes, once a space |
| 177 | // calculation shows net RAM savings, or once we have automatic variant |
| 178 | // selection available in the build system. |
| 179 | prefer_rlib: true, |
| 180 | |
Stephen Crane | 56936e8 | 2021-03-10 17:48:26 -0800 | [diff] [blame] | 181 | vintf_fragments: ["android.system.keystore2-service.xml"], |
Janis Danisevskis | 2cb4f09 | 2021-05-17 13:25:07 -0700 | [diff] [blame] | 182 | |
| 183 | required: ["keystore_cli_v2"], |
Janis Danisevskis | 1af9126 | 2020-08-10 14:58:08 -0700 | [diff] [blame] | 184 | } |
Jiyong Park | 975906d | 2021-09-30 14:58:39 +0900 | [diff] [blame] | 185 | |
| 186 | rust_binary { |
| 187 | name: "keystore2", |
| 188 | defaults: ["keystore2_defaults"], |
| 189 | rustlibs: [ |
| 190 | "libkeystore2", |
| 191 | "liblegacykeystore-rust", |
| 192 | "librusqlite", |
| 193 | ], |
Yi Kong | 3270141 | 2022-01-22 02:53:12 +0800 | [diff] [blame] | 194 | afdo: true, |
Jiyong Park | 975906d | 2021-09-30 14:58:39 +0900 | [diff] [blame] | 195 | } |