blob: 5939adf615564e0dbe75e8244262efc418e4d45a [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
15rust_library {
16 name: "libkeystore2",
17 crate_name: "keystore2",
18 srcs: ["src/lib.rs"],
Janis Danisevskis7d77a762020-07-20 13:03:31 -070019
20 rustlibs: [
Janis Danisevskis71dc30d2020-09-11 14:30:34 -070021 "android.system.keystore2-rust",
Janis Danisevskise24f3472020-08-12 17:58:49 -070022 "libandroid_hardware_keymint",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070023 "libanyhow",
Janis Danisevskise24f3472020-08-12 17:58:49 -070024 "libbinder_rs",
Janis Danisevskisce995432020-07-21 12:22:34 -070025 "libkeystore2_selinux",
Janis Danisevskis4ad056f2020-08-05 19:46:46 +000026 "liblazy_static",
Joel Galenson0891bc12020-07-20 10:37:03 -070027 "liblibsqlite3_sys",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070028 "liblog_rust",
Joel Galenson0891bc12020-07-20 10:37:03 -070029 "librand",
Joel Galenson26f4d012020-07-17 14:57:21 -070030 "librusqlite",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070031 "libthiserror",
32 ],
Janis Danisevskis43c89712020-08-03 23:42:42 +000033}
34
35rust_test {
36 name: "keystore2_test",
Joel Galenson26f4d012020-07-17 14:57:21 -070037 crate_name: "keystore2",
Janis Danisevskis43c89712020-08-03 23:42:42 +000038 srcs: ["src/lib.rs"],
39 test_suites: ["general-tests"],
40 auto_gen_config: true,
Janis Danisevskis7d77a762020-07-20 13:03:31 -070041 rustlibs: [
Janis Danisevskis71dc30d2020-09-11 14:30:34 -070042 "android.system.keystore2-rust",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070043 "libandroid_logger",
Janis Danisevskise24f3472020-08-12 17:58:49 -070044 "libandroid_hardware_keymint",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070045 "libanyhow",
Janis Danisevskise24f3472020-08-12 17:58:49 -070046 "libbinder_rs",
Joel Galensonca0efb12020-10-01 14:32:30 -070047 "libkeystore2_crypto_bindgen",
Janis Danisevskisce995432020-07-21 12:22:34 -070048 "libkeystore2_selinux",
Janis Danisevskis4ad056f2020-08-05 19:46:46 +000049 "liblazy_static",
Joel Galenson0891bc12020-07-20 10:37:03 -070050 "liblibsqlite3_sys",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070051 "liblog_rust",
Joel Galenson26f4d012020-07-17 14:57:21 -070052 "librusqlite",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070053 "libthiserror",
54 ],
Joel Galensonca0efb12020-10-01 14:32:30 -070055 shared_libs: ["libkeystore2_crypto"],
56}
57
58cc_library {
59 name: "libkeystore2_crypto",
Janis Danisevskisa7c72db2020-11-05 12:02:22 -080060 srcs: [
61 "src/crypto.cpp",
62 "src/certificate_utils.cpp",
63 ],
64 export_include_dirs: ["include",],
Joel Galensonca0efb12020-10-01 14:32:30 -070065 shared_libs: [
66 "libcrypto",
67 "liblog",
68 ],
69}
70
71rust_bindgen {
72 name: "libkeystore2_crypto_bindgen",
73 wrapper_src: "src/crypto.hpp",
74 crate_name: "keystore2_crypto_bindgen",
75 source_stem: "bindings",
76 host_supported: true,
Janis Danisevskis43c89712020-08-03 23:42:42 +000077}
Janis Danisevskis652f3812020-08-04 00:01:12 +000078
Janis Danisevskis1af91262020-08-10 14:58:08 -070079rust_binary {
80 name: "keystore2",
81 srcs: ["src/keystore2_main.rs"],
82 rustlibs: [
83 "libandroid_logger",
84 "libbinder_rs",
85 "libkeystore2",
86 "liblog_rust",
87 ],
88 init_rc: ["keystore2.rc"],
89}
90
Janis Danisevskisa7c72db2020-11-05 12:02:22 -080091cc_test {
92 cflags: [
93 "-Wall",
94 "-Werror",
95 "-Wextra",
96 ],
97 srcs: [
98 "src/tests/certificate_utils_test.cpp",
99 "src/tests/gtest_main.cpp",
100 ],
101 static_libs: [
102 "libkeystore2_crypto",
103 ],
104 shared_libs: [
105 "libcrypto",
106 ],
107 name: "keystore2_crypto_test",
108}
109
Janis Danisevskis652f3812020-08-04 00:01:12 +0000110// This is a placeholder for the libraries that will be generated from the AIDL specs
111// eventually.
112rust_library {
Janis Danisevskis1fe11322020-08-07 08:44:08 -0700113 name: "libandroid_hardware_keymint",
114 crate_name: "android_hardware_keymint",
115
116 srcs: ["src/android_hardware_keymint.rs"],
117
118 rustlibs: [
119 "libbinder_rs",
120 "liblazy_static",
121 ],
122}
Janis Danisevskisa7c72db2020-11-05 12:02:22 -0800123