aboutsummaryrefslogtreecommitdiff
path: root/rust/tests/test_data.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/tests/test_data.rs')
-rw-r--r--rust/tests/test_data.rs55
1 files changed, 55 insertions, 0 deletions
diff --git a/rust/tests/test_data.rs b/rust/tests/test_data.rs
new file mode 100644
index 0000000..f7fc499
--- /dev/null
+++ b/rust/tests/test_data.rs
@@ -0,0 +1,55 @@
+// Copyright 2024, The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//! Test data used in libavb_rs tests.
+//!
+//! These constants must match the values used to create the images in Android.bp.
+
+pub const TEST_IMAGE_PATH: &str = "test_image.img";
+pub const TEST_IMAGE_SIZE: usize = 16 * 1024;
+pub const TEST_IMAGE_SALT_HEX: &str = "1000";
+pub const TEST_HASHTREE_SALT_HEX: &str = "B000";
+pub const TEST_VBMETA_PATH: &str = "test_vbmeta.img";
+pub const TEST_VBMETA_2_PARTITIONS_PATH: &str = "test_vbmeta_2_parts.img";
+pub const TEST_VBMETA_PERSISTENT_DIGEST_PATH: &str = "test_vbmeta_persistent_digest.img";
+pub const TEST_VBMETA_WITH_PROPERTY_PATH: &str = "test_vbmeta_with_property.img";
+pub const TEST_VBMETA_WITH_HASHTREE_PATH: &str = "test_vbmeta_with_hashtree.img";
+pub const TEST_VBMETA_WITH_COMMANDLINE_PATH: &str = "test_vbmeta_with_commandline.img";
+pub const TEST_VBMETA_WITH_CHAINED_PARTITION_PATH: &str = "test_vbmeta_with_chained_partition.img";
+pub const TEST_IMAGE_WITH_VBMETA_FOOTER_PATH: &str = "avbrs_test_image_with_vbmeta_footer.img";
+pub const TEST_IMAGE_WITH_VBMETA_FOOTER_FOR_BOOT_PATH: &str =
+ "avbrs_test_image_with_vbmeta_footer_for_boot.img";
+pub const TEST_IMAGE_WITH_VBMETA_FOOTER_FOR_TEST_PART_2: &str =
+ "avbrs_test_image_with_vbmeta_footer_for_test_part_2.img";
+pub const TEST_PUBLIC_KEY_PATH: &str = "data/testkey_rsa4096_pub.bin";
+pub const TEST_PUBLIC_KEY_RSA8192_PATH: &str = "data/testkey_rsa8192_pub.bin";
+pub const TEST_PARTITION_NAME: &str = "test_part";
+pub const TEST_PARTITION_SLOT_C_NAME: &str = "test_part_c";
+pub const TEST_PARTITION_2_NAME: &str = "test_part_2";
+pub const TEST_PARTITION_PERSISTENT_DIGEST_NAME: &str = "test_part_persistent_digest";
+pub const TEST_PARTITION_HASH_TREE_NAME: &str = "test_part_hashtree";
+pub const TEST_VBMETA_ROLLBACK_LOCATION: usize = 0; // Default value, we don't explicitly set this.
+pub const TEST_PROPERTY_KEY: &str = "test_prop_key";
+pub const TEST_PROPERTY_VALUE: &[u8] = b"test_prop_value";
+pub const TEST_KERNEL_COMMANDLINE: &str = "test_cmdline_key=test_cmdline_value";
+pub const TEST_CHAINED_PARTITION_ROLLBACK_LOCATION: usize = 4;
+pub const TEST_CHAINED_PARTITION_ROLLBACK_INDEX: u64 = 7;
+
+// Expected values determined by examining the vbmeta image with `avbtool info_image`.
+// Images can be found in <out>/soong/.intermediates/external/avb/rust/.
+pub const TEST_IMAGE_DIGEST_HEX: &str =
+ "89e6fd3142917b8c34ac7d30897a907a71bd3bf5d9b39d00bf938b41dcf3b84f";
+pub const TEST_IMAGE_HASH_ALGO: &str = "sha256";
+pub const TEST_HASHTREE_DIGEST_HEX: &str = "5373fc4ee3dd898325eeeffb5a1dbb041900c5f1";
+pub const TEST_HASHTREE_ALGORITHM: &str = "sha1";