• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package {
2    default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
5rust_defaults {
6    name: "libpvmfw_avb_nostd_defaults",
7    crate_name: "pvmfw_avb",
8    srcs: ["src/lib.rs"],
9    prefer_rlib: true,
10    // Require unsafe blocks for inside unsafe functions.
11    flags: ["-Dunsafe_op_in_unsafe_fn"],
12    rustlibs: [
13        "libavb_bindgen_nostd",
14        "libtinyvec_nostd",
15    ],
16    whole_static_libs: [
17        "libavb_baremetal",
18    ],
19}
20
21rust_library_rlib {
22    name: "libpvmfw_avb_nostd",
23    defaults: ["libpvmfw_avb_nostd_defaults"],
24    no_stdlibs: true,
25    stdlibs: [
26        "libcore.rust_sysroot",
27    ],
28}
29
30rust_test {
31    name: "libpvmfw_avb.integration_test",
32    crate_name: "pvmfw_avb_test",
33    srcs: ["tests/*.rs"],
34    test_suites: ["general-tests"],
35    data: [
36        ":avb_testkey_rsa2048_pub_bin",
37        ":avb_testkey_rsa4096_pub_bin",
38        ":microdroid_kernel_signed",
39        ":microdroid_initrd_normal",
40        ":microdroid_initrd_debuggable",
41        ":test_image_with_one_hashdesc",
42        ":test_image_with_non_initrd_hashdesc",
43        ":test_image_with_initrd_and_non_initrd_desc",
44        ":test_image_with_prop_desc",
45        ":unsigned_test_image",
46    ],
47    prefer_rlib: true,
48    rustlibs: [
49        "libanyhow",
50        "libavb_bindgen",
51        "libhex",
52        "libpvmfw_avb_nostd",
53        "libopenssl",
54    ],
55    enabled: false,
56    arch: {
57        // Microdroid kernel is only available in these architectures.
58        arm64: {
59            enabled: true,
60        },
61        x86_64: {
62            enabled: true,
63        },
64    },
65}
66
67// Generates a 16KB unsigned image for testing.
68genrule {
69    name: "unsigned_test_image",
70    tools: ["avbtool"],
71    out: ["unsigned_test.img"],
72    cmd: "$(location avbtool) generate_test_image --image_size 16384 --output $(out)",
73}
74
75avb_gen_vbmeta_image {
76    name: "test_non_initrd_hashdesc",
77    src: ":unsigned_test_image",
78    partition_name: "non_initrd11",
79    salt: "2222",
80}
81
82avb_add_hash_footer {
83    name: "test_image_with_non_initrd_hashdesc",
84    src: ":unsigned_test_image",
85    partition_name: "boot",
86    private_key: ":pvmfw_sign_key",
87    salt: "3322",
88    include_descriptors_from_images: [
89        ":test_non_initrd_hashdesc",
90    ],
91}
92
93avb_add_hash_footer {
94    name: "test_image_with_initrd_and_non_initrd_desc",
95    src: ":unsigned_test_image",
96    partition_name: "boot",
97    private_key: ":pvmfw_sign_key",
98    salt: "3241",
99    include_descriptors_from_images: [
100        ":microdroid_initrd_normal_hashdesc",
101        ":test_non_initrd_hashdesc",
102    ],
103    enabled: false,
104    arch: {
105        // microdroid_initrd_normal_hashdesc is only available in these architectures.
106        arm64: {
107            enabled: true,
108        },
109        x86_64: {
110            enabled: true,
111        },
112    },
113}
114
115avb_add_hash_footer {
116    name: "test_image_with_prop_desc",
117    src: ":unsigned_test_image",
118    partition_name: "boot",
119    private_key: ":pvmfw_sign_key",
120    salt: "2134",
121    props: [
122        {
123            name: "mock_prop",
124            value: "3333",
125        },
126    ],
127}
128
129avb_add_hash_footer {
130    name: "test_image_with_one_hashdesc",
131    src: ":unsigned_test_image",
132    partition_name: "boot",
133    private_key: ":pvmfw_sign_key",
134    salt: "1111",
135}
136