blob: 19b8f540b265c428e3d340c919d4411f4be41880 [file] [log] [blame]
David Drysdale0b3938d2022-09-28 16:49:16 +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_library {
20 name: "libkmr_wire",
21 crate_name: "kmr_wire",
22 srcs: ["src/lib.rs"],
23 host_supported: true,
24 vendor_available: true,
25 edition: "2021",
David Drysdale63e6ad62023-05-05 17:41:08 +010026 lints: "android",
David Drysdale1aa56372023-10-06 10:21:30 +010027 // Default target includes support for all versions of the KeyMint HAL.
28 features: [
29 "hal_v2",
30 "hal_v3",
31 ],
32 rustlibs: [
33 "libciborium",
34 "libciborium_io",
35 "libcoset",
36 "liblog_rust",
37 "libzeroize",
38 ],
39 proc_macros: [
40 "libenumn",
41 "libkmr_derive",
42 ],
43}
44
45// Variant of the library that only includes support for the KeyMint v2 HAL types.
46rust_library {
47 name: "libkmr_wire_hal_v2",
48 crate_name: "kmr_wire",
49 srcs: ["src/lib.rs"],
50 host_supported: true,
51 vendor_available: true,
52 edition: "2021",
53 lints: "android",
54 // Default target includes support for all versions of the KeyMint HAL.
55 features: [
56 "hal_v2",
57 ],
58 rustlibs: [
59 "libciborium",
60 "libciborium_io",
61 "libcoset",
62 "liblog_rust",
63 "libzeroize",
64 ],
65 proc_macros: [
66 "libenumn",
67 "libkmr_derive",
68 ],
69}
70
71// Variant of the library that only includes support for the KeyMint v1 HAL types.
72rust_library {
73 name: "libkmr_wire_hal_v1",
74 crate_name: "kmr_wire",
75 srcs: ["src/lib.rs"],
76 host_supported: true,
77 vendor_available: true,
78 edition: "2021",
79 lints: "android",
David Drysdale0b3938d2022-09-28 16:49:16 +010080 rustlibs: [
81 "libciborium",
82 "libciborium_io",
83 "libcoset",
84 "liblog_rust",
David Drysdale124c8fe2022-12-01 10:36:57 +000085 "libzeroize",
David Drysdale0b3938d2022-09-28 16:49:16 +010086 ],
87 proc_macros: [
88 "libenumn",
89 "libkmr_derive",
90 ],
91}
92
David Drysdale362244b2023-10-04 16:47:50 +010093rust_library_rlib {
94 name: "libkmr_wire_nostd",
95 crate_name: "kmr_wire",
96 srcs: ["src/lib.rs"],
97 vendor_available: true,
98 edition: "2021",
99 lints: "android",
David Drysdale1aa56372023-10-06 10:21:30 +0100100 features: [
101 "hal_v2",
102 "hal_v3",
103 ],
David Drysdale362244b2023-10-04 16:47:50 +0100104 rustlibs: [
105 "libciborium_nostd",
106 "libciborium_io_nostd",
107 "libcoset_nostd",
108 "liblog_rust_nostd",
109 "libzeroize_nostd",
110 ],
111 proc_macros: [
112 "libenumn",
113 "libkmr_derive",
114 ],
115 prefer_rlib: true,
116 no_stdlibs: true,
117 stdlibs: [
118 "libcompiler_builtins.rust_sysroot",
119 "libcore.rust_sysroot",
120 ],
121}
122
David Drysdale124c8fe2022-12-01 10:36:57 +0000123rust_test_host {
124 name: "libkmr_wire_test",
125 crate_name: "kmr_wire_test",
126 srcs: ["src/lib.rs"],
127 rustlibs: [
128 "libciborium",
129 "libciborium_io",
130 "libcoset",
131 "libhex",
132 "liblog_rust",
133 "libzeroize",
134 ],
135 proc_macros: [
136 "libenumn",
137 "libkmr_derive",
138 ],
139 test_suites: ["general-tests"],
140}
141
David Drysdale0b3938d2022-09-28 16:49:16 +0100142rust_fuzz {
143 name: "libkmr_wire_fuzz_message",
144 srcs: ["fuzz/fuzz_targets/message.rs"],
145 rustlibs: ["libkmr_wire"],
Ivan Lozanof5d64a52024-02-13 18:02:11 +0000146 host_supported: true,
Ivan Lozano1a91ffe2023-08-29 18:32:14 +0000147 fuzz_config: {
148 cc: ["drysdale@google.com", "hasinitg@google.com"],
149 componentid: 1084733,
150 hotlists: ["4271696"],
151 fuzz_on_haiku_device: true,
152 fuzz_on_haiku_host: true,
153 },
David Drysdale0b3938d2022-09-28 16:49:16 +0100154}