xref: /aosp_15_r20/system/keymint/common/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_common_defaults",
21    edition: "2021",
22    lints: "android",
23    rustlibs: [
24        "libciborium",
25        "libciborium_io",
26        "libcoset",
27        "libder",
28        "libkmr_wire",
29        "liblog_rust",
30        "libpkcs1",
31        "libpkcs8",
32        "libsec1",
33        "libspki",
34        "libzeroize",
35    ],
36    proc_macros: [
37        "libenumn",
38        "libkmr_derive",
39    ],
40}
41
42rust_library {
43    name: "libkmr_common",
44    crate_name: "kmr_common",
45    srcs: ["src/lib.rs"],
46    host_supported: true,
47    vendor_available: true,
48    defaults: [
49        "kmr_common_defaults",
50    ],
51}
52
53rust_library_rlib {
54    name: "libkmr_common_nostd",
55    crate_name: "kmr_common",
56    srcs: ["src/lib.rs"],
57    edition: "2021",
58    lints: "android",
59    vendor_available: true,
60    prefer_rlib: true,
61    no_stdlibs: true,
62    rustlibs: [
63        "libciborium_nostd",
64        "libciborium_io_nostd",
65        "libcoset_nostd",
66        "libder_nostd",
67        "libkmr_wire_nostd",
68        "liblog_rust_nostd",
69        "libpkcs1_nostd",
70        "libpkcs8_nostd",
71        "libsec1_nostd",
72        "libspki_nostd",
73        "libzeroize_nostd",
74    ],
75    proc_macros: [
76        "libenumn",
77        "libkmr_derive",
78    ],
79    stdlibs: [
80        "liballoc.rust_sysroot",
81        "libcompiler_builtins.rust_sysroot",
82        "libcore.rust_sysroot",
83    ],
84}
85
86rust_test_host {
87    name: "libkmr_common_test",
88    crate_name: "kmr_common_test",
89    srcs: ["src/lib.rs"],
90    defaults: [
91        "kmr_common_defaults",
92    ],
93    rustlibs: [
94        "libhex",
95    ],
96    test_suites: ["general-tests"],
97}
98
99rust_binary_host {
100    name: "kmr_cddl_dump",
101    crate_name: "kmr_cddl_dump",
102    srcs: ["src/bin/cddl-dump.rs"],
103    rustlibs: [
104        "libkmr_common",
105        "libkmr_wire",
106    ],
107}
108
109rust_fuzz {
110    name: "libkmr_common_fuzz_keyblob",
111    srcs: ["fuzz/fuzz_targets/keyblob.rs"],
112    rustlibs: ["libkmr_common"],
113    host_supported: true,
114    fuzz_config: {
115        cc: [
116            "[email protected]",
117            "[email protected]",
118        ],
119        componentid: 1084733,
120        hotlists: ["4271696"],
121        fuzz_on_haiku_device: true,
122        fuzz_on_haiku_host: true,
123    },
124}
125