blob: de21251802b35382f93bba312d7ce0c00aec0232 [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 Danisevskis85d47932020-10-23 16:12:59 -070022 "android.hardware.keymint-rust",
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"],
Joel Galenson82a4ecf2020-11-20 14:19:40 -080039 test_suites: ["device-tests"],
40 auto_gen_config: false,
41 test_config: "AndroidTest.xml",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070042 rustlibs: [
Janis Danisevskis71dc30d2020-09-11 14:30:34 -070043 "android.system.keystore2-rust",
Janis Danisevskis85d47932020-10-23 16:12:59 -070044 "android.hardware.keymint-rust",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070045 "libandroid_logger",
46 "libanyhow",
Janis Danisevskise24f3472020-08-12 17:58:49 -070047 "libbinder_rs",
Joel Galensonca0efb12020-10-01 14:32:30 -070048 "libkeystore2_crypto_bindgen",
Janis Danisevskisce995432020-07-21 12:22:34 -070049 "libkeystore2_selinux",
Janis Danisevskis4ad056f2020-08-05 19:46:46 +000050 "liblazy_static",
Joel Galenson0891bc12020-07-20 10:37:03 -070051 "liblibsqlite3_sys",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070052 "liblog_rust",
Joel Galenson26f4d012020-07-17 14:57:21 -070053 "librusqlite",
Janis Danisevskis7d77a762020-07-20 13:03:31 -070054 "libthiserror",
55 ],
Joel Galensonca0efb12020-10-01 14:32:30 -070056 shared_libs: ["libkeystore2_crypto"],
57}
58
59cc_library {
60 name: "libkeystore2_crypto",
Janis Danisevskisa7c72db2020-11-05 12:02:22 -080061 srcs: [
62 "src/crypto.cpp",
63 "src/certificate_utils.cpp",
64 ],
65 export_include_dirs: ["include",],
Joel Galensonca0efb12020-10-01 14:32:30 -070066 shared_libs: [
67 "libcrypto",
68 "liblog",
69 ],
70}
71
72rust_bindgen {
73 name: "libkeystore2_crypto_bindgen",
74 wrapper_src: "src/crypto.hpp",
75 crate_name: "keystore2_crypto_bindgen",
76 source_stem: "bindings",
77 host_supported: true,
Janis Danisevskis43c89712020-08-03 23:42:42 +000078}
Janis Danisevskis652f3812020-08-04 00:01:12 +000079
Janis Danisevskis1af91262020-08-10 14:58:08 -070080rust_binary {
81 name: "keystore2",
82 srcs: ["src/keystore2_main.rs"],
83 rustlibs: [
84 "libandroid_logger",
85 "libbinder_rs",
86 "libkeystore2",
87 "liblog_rust",
88 ],
89 init_rc: ["keystore2.rc"],
90}
91
Janis Danisevskisa7c72db2020-11-05 12:02:22 -080092cc_test {
93 cflags: [
94 "-Wall",
95 "-Werror",
96 "-Wextra",
97 ],
98 srcs: [
99 "src/tests/certificate_utils_test.cpp",
100 "src/tests/gtest_main.cpp",
101 ],
102 static_libs: [
103 "libkeystore2_crypto",
104 ],
105 shared_libs: [
106 "libcrypto",
107 ],
108 name: "keystore2_crypto_test",
109}