blob: 05f3b32f5fa5794518b48e90b0258dfd4d8a37dd [file] [log] [blame]
David Drysdale64e07e32022-06-10 14:45:45 +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_common_defaults",
21 edition: "2021",
David Drysdale63e6ad62023-05-05 17:41:08 +010022 lints: "android",
David Drysdale64e07e32022-06-10 14:45:45 +010023 rustlibs: [
24 "libciborium",
25 "libciborium_io",
26 "libcoset",
David Drysdale0b3938d2022-09-28 16:49:16 +010027 "libder",
28 "libkmr_wire",
David Drysdale64e07e32022-06-10 14:45:45 +010029 "liblog_rust",
David Drysdale0b3938d2022-09-28 16:49:16 +010030 "libpkcs1",
31 "libpkcs8",
32 "libsec1",
33 "libspki",
34 "libzeroize",
David Drysdale64e07e32022-06-10 14:45:45 +010035 ],
36 proc_macros: [
37 "libenumn",
38 "libkmr_derive",
39 ],
40}
41
David Drysdalebb137d22023-12-03 07:35:09 +000042rust_library {
David Drysdale64e07e32022-06-10 14:45:45 +010043 name: "libkmr_common",
44 crate_name: "kmr_common",
45 srcs: ["src/lib.rs"],
David Drysdalebb137d22023-12-03 07:35:09 +000046 host_supported: true,
David Drysdale64e07e32022-06-10 14:45:45 +010047 vendor_available: true,
48 defaults: [
49 "kmr_common_defaults",
50 ],
51}
52
David Drysdale362244b2023-10-04 16:47:50 +010053
54rust_library_rlib {
55 name: "libkmr_common_nostd",
56 crate_name: "kmr_common",
57 srcs: ["src/lib.rs"],
58 edition: "2021",
59 lints: "android",
60 vendor_available: true,
61 prefer_rlib: true,
62 no_stdlibs: true,
63 rustlibs: [
64 "libciborium_nostd",
65 "libciborium_io_nostd",
66 "libcoset_nostd",
67 "libder_nostd",
68 "libkmr_wire_nostd",
69 "liblog_rust_nostd",
70 "libpkcs1_nostd",
71 "libpkcs8_nostd",
72 "libsec1_nostd",
73 "libspki_nostd",
74 "libzeroize_nostd",
75 ],
76 proc_macros: [
77 "libenumn",
78 "libkmr_derive",
79 ],
80 stdlibs: [
81 "liballoc.rust_sysroot",
82 "libcompiler_builtins.rust_sysroot",
83 "libcore.rust_sysroot",
84 ],
85}
86
David Drysdale0b3938d2022-09-28 16:49:16 +010087rust_test_host {
David Drysdale64e07e32022-06-10 14:45:45 +010088 name: "libkmr_common_test",
89 crate_name: "kmr_common_test",
90 srcs: ["src/lib.rs"],
91 defaults: [
92 "kmr_common_defaults",
93 ],
David Drysdale6512c702022-11-01 11:32:14 +000094 rustlibs: [
95 "libhex",
96 ],
David Drysdale64e07e32022-06-10 14:45:45 +010097 test_suites: ["general-tests"],
98}
99
100rust_binary_host {
101 name: "kmr_cddl_dump",
102 crate_name: "kmr_cddl_dump",
103 srcs: ["src/bin/cddl-dump.rs"],
David Drysdale0b3938d2022-09-28 16:49:16 +0100104 rustlibs: [
105 "libkmr_common",
106 "libkmr_wire",
107 ],
David Drysdale64e07e32022-06-10 14:45:45 +0100108}
David Drysdale0b3938d2022-09-28 16:49:16 +0100109
Ivan Lozano1a91ffe2023-08-29 18:32:14 +0000110// The fuzzer target cannot be built for the device because some
111// of the dependencies have restricted visibility.
112rust_fuzz_host {
113 name: "libkmr_common_fuzz_keyblob",
114 srcs: ["fuzz/fuzz_targets/keyblob.rs"],
115 rustlibs: ["libkmr_common"],
116 fuzz_config: {
117 cc: ["drysdale@google.com", "hasinitg@google.com"],
118 componentid: 1084733,
119 hotlists: ["4271696"],
120 fuzz_on_haiku_device: false,
121 fuzz_on_haiku_host: true,
122 },
123}