xref: /aosp_15_r20/system/keymint/hal/Android.bp (revision 9860b7637a5f185913c70aa0caabe3ecb78441e4)
1// 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",
22    lints: "android",
23    rustlibs: [
24        "android.hardware.security.rkp-V3-rust",
25        "android.hardware.security.secureclock-V1-rust",
26        "android.hardware.security.sharedsecret-V1-rust",
27        "libbinder_rs",
28        "libciborium",
29        "libciborium_io",
30        "libhex",
31        "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,
45    // Default target includes support for all versions of the KeyMint HAL.
46    features: [
47        "hal_v2",
48        "hal_v3",
49        "hal_v4",
50    ],
51    defaults: [
52        "keymint_use_latest_hal_aidl_rust",
53        "kmr_hal_defaults",
54    ],
55    rustlibs: [
56        "libkmr_wire",
57    ],
58}
59
60rust_library {
61    name: "libkmr_hal_v3",
62    crate_name: "kmr_hal",
63    srcs: ["src/lib.rs"],
64    vendor_available: true,
65    features: [
66        "hal_v3",
67        "hal_v2",
68    ],
69    defaults: [
70        "kmr_hal_defaults",
71    ],
72    rustlibs: [
73        "android.hardware.security.keymint-V3-rust",
74        "libkmr_wire_hal_v3",
75    ],
76}
77
78rust_library {
79    name: "libkmr_hal_v2",
80    crate_name: "kmr_hal",
81    srcs: ["src/lib.rs"],
82    vendor_available: true,
83    features: [
84        "hal_v2",
85    ],
86    defaults: [
87        "kmr_hal_defaults",
88    ],
89    rustlibs: [
90        "android.hardware.security.keymint-V2-rust",
91        "libkmr_wire_hal_v2",
92    ],
93}
94
95rust_library {
96    name: "libkmr_hal_v1",
97    crate_name: "kmr_hal",
98    srcs: ["src/lib.rs"],
99    vendor_available: true,
100    defaults: [
101        "kmr_hal_defaults",
102    ],
103    rustlibs: [
104        "android.hardware.security.keymint-V1-rust",
105        "libkmr_wire_hal_v1",
106    ],
107}
108
109rust_test {
110    name: "libkmr_hal_test",
111    crate_name: "libkeymint_rust_test",
112    srcs: ["src/lib.rs"],
113    features: [
114        "hal_v2",
115        "hal_v3",
116        "hal_v4",
117    ],
118    defaults: [
119        "keymint_use_latest_hal_aidl_rust",
120        "kmr_hal_defaults",
121    ],
122    rustlibs: [
123        "libkmr_wire",
124    ],
125    test_suites: ["general-tests"],
126}
127