• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    ],
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    ],
67    defaults: [
68        "kmr_hal_defaults",
69    ],
70    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    ],
88}
89
90rust_test {
91    name: "libkmr_hal_test",
92    crate_name: "libkeymint_rust_test",
93    srcs: ["src/lib.rs"],
94    features: [
95        "hal_v2",
96        "hal_v3",
97    ],
98    defaults: [
99        "keymint_use_latest_hal_aidl_rust",
100        "kmr_hal_defaults",
101    ],
102    rustlibs: [
103        "libkmr_wire",
104    ],
105    test_suites: ["general-tests"],
106}
107