package { default_applicable_licenses: ["Android-Apache-2.0"], } rust_defaults { name: "libpvmfw_avb_nostd_defaults", crate_name: "pvmfw_avb", srcs: ["src/lib.rs"], prefer_rlib: true, // Require unsafe blocks for inside unsafe functions. flags: ["-Dunsafe_op_in_unsafe_fn"], rustlibs: [ "libavb_bindgen_nostd", "libtinyvec_nostd", ], whole_static_libs: [ "libavb_baremetal", ], } rust_library_rlib { name: "libpvmfw_avb_nostd", defaults: ["libpvmfw_avb_nostd_defaults"], no_stdlibs: true, stdlibs: [ "libcore.rust_sysroot", ], } rust_test { name: "libpvmfw_avb.integration_test", crate_name: "pvmfw_avb_test", srcs: ["tests/*.rs"], test_suites: ["general-tests"], data: [ ":avb_testkey_rsa2048_pub_bin", ":avb_testkey_rsa4096_pub_bin", ":microdroid_kernel_signed", ":microdroid_initrd_normal", ":microdroid_initrd_debuggable", ":test_image_with_one_hashdesc", ":test_image_with_non_initrd_hashdesc", ":test_image_with_initrd_and_non_initrd_desc", ":test_image_with_prop_desc", ":unsigned_test_image", ], prefer_rlib: true, rustlibs: [ "libanyhow", "libavb_bindgen", "libhex", "libpvmfw_avb_nostd", "libopenssl", ], enabled: false, arch: { // Microdroid kernel is only available in these architectures. arm64: { enabled: true, }, x86_64: { enabled: true, }, }, } // Generates a 16KB unsigned image for testing. genrule { name: "unsigned_test_image", tools: ["avbtool"], out: ["unsigned_test.img"], cmd: "$(location avbtool) generate_test_image --image_size 16384 --output $(out)", } avb_gen_vbmeta_image { name: "test_non_initrd_hashdesc", src: ":unsigned_test_image", partition_name: "non_initrd11", salt: "2222", } avb_add_hash_footer { name: "test_image_with_non_initrd_hashdesc", src: ":unsigned_test_image", partition_name: "boot", private_key: ":pvmfw_sign_key", salt: "3322", include_descriptors_from_images: [ ":test_non_initrd_hashdesc", ], } avb_add_hash_footer { name: "test_image_with_initrd_and_non_initrd_desc", src: ":unsigned_test_image", partition_name: "boot", private_key: ":pvmfw_sign_key", salt: "3241", include_descriptors_from_images: [ ":microdroid_initrd_normal_hashdesc", ":test_non_initrd_hashdesc", ], enabled: false, arch: { // microdroid_initrd_normal_hashdesc is only available in these architectures. arm64: { enabled: true, }, x86_64: { enabled: true, }, }, } avb_add_hash_footer { name: "test_image_with_prop_desc", src: ":unsigned_test_image", partition_name: "boot", private_key: ":pvmfw_sign_key", salt: "2134", props: [ { name: "mock_prop", value: "3333", }, ], } avb_add_hash_footer { name: "test_image_with_one_hashdesc", src: ":unsigned_test_image", partition_name: "boot", private_key: ":pvmfw_sign_key", salt: "1111", }