blob: 8afa34006e4e9860f72a87ac144ff665ae135df1 [file] [log] [blame]
David Drysdalea1ec5f92022-08-30 18:53:32 +01001// Copyright 2022, 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
15package {
16 default_applicable_licenses: ["system_keymint_license"],
17}
18
19rust_defaults {
20 name: "kmr_hal_defaults",
21 edition: "2021",
David Drysdale63e6ad62023-05-05 17:41:08 +010022 lints: "android",
David Drysdalea1ec5f92022-08-30 18:53:32 +010023 rustlibs: [
Seth Mooreea8d99b2022-11-04 17:39:05 +000024 "android.hardware.security.rkp-V3-rust",
David Drysdalea1ec5f92022-08-30 18:53:32 +010025 "android.hardware.security.secureclock-V1-rust",
26 "android.hardware.security.sharedsecret-V1-rust",
27 "libbinder_rs",
28 "libciborium",
29 "libciborium_io",
David Drysdale6512c702022-11-01 11:32:14 +000030 "libhex",
David Drysdalea1ec5f92022-08-30 18:53:32 +010031 "liblog_rust",
32 "libregex",
33 "librustutils",
34 ],
35 proc_macros: [
36 "libkmr_derive",
37 ],
38}
39
40rust_library {
41 name: "libkmr_hal",
42 crate_name: "kmr_hal",
43 srcs: ["src/lib.rs"],
44 vendor_available: true,
David Drysdale1aa56372023-10-06 10:21:30 +010045 // Default target includes support for all versions of the KeyMint HAL.
46 features: [
47 "hal_v2",
48 "hal_v3",
49 ],
50 defaults: [
51 "keymint_use_latest_hal_aidl_rust",
52 "kmr_hal_defaults",
53 ],
54 rustlibs: [
55 "libkmr_wire",
56 ],
57}
58
59rust_library {
60 name: "libkmr_hal_v2",
61 crate_name: "kmr_hal",
62 srcs: ["src/lib.rs"],
63 vendor_available: true,
64 features: [
65 "hal_v2",
66 ],
David Drysdalea1ec5f92022-08-30 18:53:32 +010067 defaults: [
68 "kmr_hal_defaults",
69 ],
David Drysdale1aa56372023-10-06 10:21:30 +010070 rustlibs: [
71 "android.hardware.security.keymint-V2-rust",
72 "libkmr_wire_hal_v2",
73 ],
74}
75
76rust_library {
77 name: "libkmr_hal_v1",
78 crate_name: "kmr_hal",
79 srcs: ["src/lib.rs"],
80 vendor_available: true,
81 defaults: [
82 "kmr_hal_defaults",
83 ],
84 rustlibs: [
85 "android.hardware.security.keymint-V1-rust",
86 "libkmr_wire_hal_v1",
87 ],
David Drysdalea1ec5f92022-08-30 18:53:32 +010088}
89
90rust_test {
91 name: "libkmr_hal_test",
92 crate_name: "libkeymint_rust_test",
93 srcs: ["src/lib.rs"],
David Drysdale1aa56372023-10-06 10:21:30 +010094 features: [
95 "hal_v2",
96 "hal_v3",
97 ],
David Drysdalea1ec5f92022-08-30 18:53:32 +010098 defaults: [
David Drysdale1aa56372023-10-06 10:21:30 +010099 "keymint_use_latest_hal_aidl_rust",
David Drysdalea1ec5f92022-08-30 18:53:32 +0100100 "kmr_hal_defaults",
101 ],
David Drysdale1aa56372023-10-06 10:21:30 +0100102 rustlibs: [
103 "libkmr_wire",
104 ],
David Drysdalea1ec5f92022-08-30 18:53:32 +0100105 test_suites: ["general-tests"],
106}