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 | |
| 15 | rust_library { |
| 16 | name: "libkeystore2", |
| 17 | crate_name: "keystore2", |
| 18 | srcs: ["src/lib.rs"], |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 19 | |
| 20 | rustlibs: [ |
Janis Danisevskis | 71dc30d | 2020-09-11 14:30:34 -0700 | [diff] [blame] | 21 | "android.system.keystore2-rust", |
Janis Danisevskis | 85d4793 | 2020-10-23 16:12:59 -0700 | [diff] [blame] | 22 | "android.hardware.keymint-rust", |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 23 | "libanyhow", |
Janis Danisevskis | e24f347 | 2020-08-12 17:58:49 -0700 | [diff] [blame] | 24 | "libbinder_rs", |
Janis Danisevskis | ce99543 | 2020-07-21 12:22:34 -0700 | [diff] [blame] | 25 | "libkeystore2_selinux", |
Janis Danisevskis | 4ad056f | 2020-08-05 19:46:46 +0000 | [diff] [blame] | 26 | "liblazy_static", |
Joel Galenson | 0891bc1 | 2020-07-20 10:37:03 -0700 | [diff] [blame] | 27 | "liblibsqlite3_sys", |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 28 | "liblog_rust", |
Joel Galenson | 0891bc1 | 2020-07-20 10:37:03 -0700 | [diff] [blame] | 29 | "librand", |
Joel Galenson | 26f4d01 | 2020-07-17 14:57:21 -0700 | [diff] [blame] | 30 | "librusqlite", |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 31 | "libthiserror", |
| 32 | ], |
Janis Danisevskis | 43c8971 | 2020-08-03 23:42:42 +0000 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | rust_test { |
| 36 | name: "keystore2_test", |
Joel Galenson | 26f4d01 | 2020-07-17 14:57:21 -0700 | [diff] [blame] | 37 | crate_name: "keystore2", |
Janis Danisevskis | 43c8971 | 2020-08-03 23:42:42 +0000 | [diff] [blame] | 38 | srcs: ["src/lib.rs"], |
Joel Galenson | 82a4ecf | 2020-11-20 14:19:40 -0800 | [diff] [blame^] | 39 | test_suites: ["device-tests"], |
| 40 | auto_gen_config: false, |
| 41 | test_config: "AndroidTest.xml", |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 42 | rustlibs: [ |
Janis Danisevskis | 71dc30d | 2020-09-11 14:30:34 -0700 | [diff] [blame] | 43 | "android.system.keystore2-rust", |
Janis Danisevskis | 85d4793 | 2020-10-23 16:12:59 -0700 | [diff] [blame] | 44 | "android.hardware.keymint-rust", |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 45 | "libandroid_logger", |
| 46 | "libanyhow", |
Janis Danisevskis | e24f347 | 2020-08-12 17:58:49 -0700 | [diff] [blame] | 47 | "libbinder_rs", |
Joel Galenson | ca0efb1 | 2020-10-01 14:32:30 -0700 | [diff] [blame] | 48 | "libkeystore2_crypto_bindgen", |
Janis Danisevskis | ce99543 | 2020-07-21 12:22:34 -0700 | [diff] [blame] | 49 | "libkeystore2_selinux", |
Janis Danisevskis | 4ad056f | 2020-08-05 19:46:46 +0000 | [diff] [blame] | 50 | "liblazy_static", |
Joel Galenson | 0891bc1 | 2020-07-20 10:37:03 -0700 | [diff] [blame] | 51 | "liblibsqlite3_sys", |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 52 | "liblog_rust", |
Joel Galenson | 26f4d01 | 2020-07-17 14:57:21 -0700 | [diff] [blame] | 53 | "librusqlite", |
Janis Danisevskis | 7d77a76 | 2020-07-20 13:03:31 -0700 | [diff] [blame] | 54 | "libthiserror", |
| 55 | ], |
Joel Galenson | ca0efb1 | 2020-10-01 14:32:30 -0700 | [diff] [blame] | 56 | shared_libs: ["libkeystore2_crypto"], |
| 57 | } |
| 58 | |
| 59 | cc_library { |
| 60 | name: "libkeystore2_crypto", |
Janis Danisevskis | a7c72db | 2020-11-05 12:02:22 -0800 | [diff] [blame] | 61 | srcs: [ |
| 62 | "src/crypto.cpp", |
| 63 | "src/certificate_utils.cpp", |
| 64 | ], |
| 65 | export_include_dirs: ["include",], |
Joel Galenson | ca0efb1 | 2020-10-01 14:32:30 -0700 | [diff] [blame] | 66 | shared_libs: [ |
| 67 | "libcrypto", |
| 68 | "liblog", |
| 69 | ], |
| 70 | } |
| 71 | |
| 72 | rust_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 Danisevskis | 43c8971 | 2020-08-03 23:42:42 +0000 | [diff] [blame] | 78 | } |
Janis Danisevskis | 652f381 | 2020-08-04 00:01:12 +0000 | [diff] [blame] | 79 | |
Janis Danisevskis | 1af9126 | 2020-08-10 14:58:08 -0700 | [diff] [blame] | 80 | rust_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 Danisevskis | a7c72db | 2020-11-05 12:02:22 -0800 | [diff] [blame] | 92 | cc_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 | } |