blob: 7ed48950bc95670a48d3507cdea15a3cba5d7e5a [file] [log] [blame]
Alice Wangf3d96b12022-12-15 13:10:47 +00001package {
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 rustlibs: [
Pierre-Clément Tosi69467e02023-02-01 13:35:15 +000011 "libavb_bindgen_nostd",
Alice Wangf2752862023-01-18 11:51:25 +000012 "libtinyvec_nostd",
Alice Wangf3d96b12022-12-15 13:10:47 +000013 ],
Alice Wanga78279c2022-12-16 12:41:19 +000014 whole_static_libs: [
Pierre-Clément Tosi69467e02023-02-01 13:35:15 +000015 "libavb_baremetal",
Alice Wanga78279c2022-12-16 12:41:19 +000016 ],
Alice Wangf3d96b12022-12-15 13:10:47 +000017}
18
19rust_library_rlib {
20 name: "libpvmfw_avb_nostd",
21 defaults: ["libpvmfw_avb_nostd_defaults"],
22 no_stdlibs: true,
23 stdlibs: [
24 "libcore.rust_sysroot",
25 ],
26}
27
28rust_test {
Alice Wangbf7fadd2023-01-13 12:18:24 +000029 name: "libpvmfw_avb.integration_test",
30 crate_name: "pvmfw_avb_test",
Alice Wang2925b0a2023-01-19 10:44:24 +000031 srcs: ["tests/*.rs"],
Alice Wangf3d96b12022-12-15 13:10:47 +000032 test_suites: ["general-tests"],
Alice Wanga78279c2022-12-16 12:41:19 +000033 data: [
34 ":avb_testkey_rsa2048_pub_bin",
35 ":avb_testkey_rsa4096_pub_bin",
36 ":microdroid_kernel_signed",
Alice Wang6b486f12023-01-06 13:12:16 +000037 ":microdroid_initrd_normal",
Alice Wang4e55dd92023-01-11 10:17:01 +000038 ":microdroid_initrd_debuggable",
Alice Wang6b486f12023-01-06 13:12:16 +000039 ":test_image_with_one_hashdesc",
Alice Wang86383df2023-01-11 10:03:56 +000040 ":test_image_with_non_initrd_hashdesc",
Alice Wangf2752862023-01-18 11:51:25 +000041 ":test_image_with_initrd_and_non_initrd_desc",
Alice Wang86383df2023-01-11 10:03:56 +000042 ":test_image_with_prop_desc",
Alice Wanga78279c2022-12-16 12:41:19 +000043 ":unsigned_test_image",
44 ],
Alice Wangbf7fadd2023-01-13 12:18:24 +000045 prefer_rlib: true,
Alice Wanga78279c2022-12-16 12:41:19 +000046 rustlibs: [
47 "libanyhow",
Alice Wangbf7fadd2023-01-13 12:18:24 +000048 "libavb_bindgen",
Alice Wang1f0add02023-01-23 16:22:53 +000049 "libhex",
Alice Wangbf7fadd2023-01-13 12:18:24 +000050 "libpvmfw_avb_nostd",
Alice Wang1f0add02023-01-23 16:22:53 +000051 "libopenssl",
Alice Wanga78279c2022-12-16 12:41:19 +000052 ],
53 enabled: false,
54 arch: {
55 // Microdroid kernel is only available in these architectures.
56 arm64: {
57 enabled: true,
58 },
59 x86_64: {
60 enabled: true,
61 },
62 },
63}
64
65// Generates a 16KB unsigned image for testing.
66genrule {
67 name: "unsigned_test_image",
68 tools: ["avbtool"],
69 out: ["unsigned_test.img"],
70 cmd: "$(location avbtool) generate_test_image --image_size 16384 --output $(out)",
Alice Wangf3d96b12022-12-15 13:10:47 +000071}
Alice Wang6b486f12023-01-06 13:12:16 +000072
Alice Wang86383df2023-01-11 10:03:56 +000073avb_gen_vbmeta_image {
74 name: "test_non_initrd_hashdesc",
75 src: ":unsigned_test_image",
76 partition_name: "non_initrd11",
77 salt: "2222",
78}
79
80avb_add_hash_footer {
81 name: "test_image_with_non_initrd_hashdesc",
82 src: ":unsigned_test_image",
83 partition_name: "boot",
84 private_key: ":pvmfw_sign_key",
Alice Wangf2752862023-01-18 11:51:25 +000085 salt: "3322",
Alice Wang86383df2023-01-11 10:03:56 +000086 include_descriptors_from_images: [
87 ":test_non_initrd_hashdesc",
88 ],
89}
90
91avb_add_hash_footer {
Alice Wangf2752862023-01-18 11:51:25 +000092 name: "test_image_with_initrd_and_non_initrd_desc",
93 src: ":unsigned_test_image",
94 partition_name: "boot",
95 private_key: ":pvmfw_sign_key",
96 salt: "3241",
97 include_descriptors_from_images: [
98 ":microdroid_initrd_normal_hashdesc",
99 ":test_non_initrd_hashdesc",
100 ],
101 enabled: false,
102 arch: {
103 // microdroid_initrd_normal_hashdesc is only available in these architectures.
104 arm64: {
105 enabled: true,
106 },
107 x86_64: {
108 enabled: true,
109 },
110 },
111}
112
113avb_add_hash_footer {
Alice Wang86383df2023-01-11 10:03:56 +0000114 name: "test_image_with_prop_desc",
115 src: ":unsigned_test_image",
116 partition_name: "boot",
117 private_key: ":pvmfw_sign_key",
Alice Wangf2752862023-01-18 11:51:25 +0000118 salt: "2134",
Alice Wang86383df2023-01-11 10:03:56 +0000119 props: [
120 {
121 name: "mock_prop",
122 value: "3333",
123 },
124 ],
125}
126
Alice Wang6b486f12023-01-06 13:12:16 +0000127avb_add_hash_footer {
128 name: "test_image_with_one_hashdesc",
129 src: ":unsigned_test_image",
Alice Wang8aa3cb12023-01-11 09:04:04 +0000130 partition_name: "boot",
Alice Wang6b486f12023-01-06 13:12:16 +0000131 private_key: ":pvmfw_sign_key",
132 salt: "1111",
133}