1package {
2    default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
5rust_defaults {
6    name: "virtualizationservice_defaults",
7    crate_name: "virtualizationservice",
8    defaults: [
9        "avf_build_flags_rust",
10        "secretkeeper_use_latest_hal_aidl_rust",
11    ],
12    edition: "2021",
13    srcs: ["src/main.rs"],
14    // Only build on targets which crosvm builds on.
15    enabled: false,
16    target: {
17        android64: {
18            compile_multilib: "64",
19            enabled: true,
20        },
21        linux_bionic_arm64: {
22            enabled: true,
23        },
24    },
25    prefer_rlib: true,
26    rustlibs: [
27        "android.hardware.security.rkp-V3-rust",
28        "android.system.virtualizationcommon-rust",
29        "android.system.virtualizationmaintenance-rust",
30        "android.system.virtualizationservice-rust",
31        "android.system.virtualizationservice_internal-rust",
32        "android.system.virtualmachineservice-rust",
33        "android.os.permissions_aidl-rust",
34        "libandroid_logger",
35        "libanyhow",
36        "libavflog",
37        "libbinder_rs",
38        "libhex",
39        "libhypervisor_props",
40        "liblazy_static",
41        "liblibc",
42        "liblibsqlite3_sys",
43        "liblog_rust",
44        "libnix",
45        "libopenssl",
46        "librand",
47        "librkpd_client",
48        "librusqlite",
49        "librustutils",
50        "libstatslog_virtualization_rust",
51        "libtombstoned_client_rust",
52        "libvsock",
53        "libserde",
54        "libserde_xml_rs",
55        "libservice_vm_comm",
56        "libservice_vm_manager",
57    ],
58    apex_available: ["com.android.virt"],
59}
60
61rust_binary {
62    name: "virtualizationservice",
63    defaults: ["virtualizationservice_defaults"],
64}
65
66xsd_config {
67    name: "assignable_devices",
68    srcs: ["assignable_devices.xsd"],
69    api_dir: "schema",
70    package_name: "android.system.virtualizationservice",
71}
72
73rust_test {
74    name: "virtualizationservice_test",
75    defaults: [
76        "authgraph_use_latest_hal_aidl_rust",
77        "virtualizationservice_defaults",
78    ],
79    test_suites: ["general-tests"],
80    rustlibs: [
81        "libtempfile",
82    ],
83    data: [
84        ":test_rkp_cert_chain",
85    ],
86}
87
88// The chain originates from a CTS test for Keymint, with the Keymint certificate
89// (leaf certificate) truncated.
90//
91// The certificate chain begins with a leaf certificate obtained from RKP and ends
92// with a root certificate. Each certificate in the chain possesses a signature that
93// is signed by the private key of the subsequent certificate in the chain.
94filegroup {
95    name: "test_rkp_cert_chain",
96    srcs: ["testdata/rkp_cert_chain.der"],
97}
98