Add libopen_dice nostd wrapper and test it in vmbase_example
This integrates libopen_dice into vmbase_example and performs basic
integration tests.
Bug: 237372981
Test: atest vmbase_example.integration_test
Change-Id: I67f11094cac04c7d72d19497b8b705386d1f0fe1
diff --git a/vmbase/example/Android.bp b/vmbase/example/Android.bp
index 4e62090..e9a3f98 100644
--- a/vmbase/example/Android.bp
+++ b/vmbase/example/Android.bp
@@ -11,6 +11,7 @@
rustlibs: [
"libaarch64_paging",
"libbuddy_system_allocator",
+ "libdice_nostd",
"liblog_rust_nostd",
"libvmbase",
],
diff --git a/vmbase/example/src/main.rs b/vmbase/example/src/main.rs
index 9b362b2..d6a966c 100644
--- a/vmbase/example/src/main.rs
+++ b/vmbase/example/src/main.rs
@@ -94,6 +94,7 @@
info!("Activated.");
check_data();
+ check_dice();
}
fn check_stack_guard() {
@@ -148,3 +149,18 @@
assert_eq!(vector[2], 42);
info!("Vec seems to work.");
}
+
+fn check_dice() {
+ info!("Testing DICE integration...");
+ let hash = dice::hash("hello world".as_bytes()).expect("DiceHash failed");
+ assert_eq!(
+ hash,
+ [
+ 0x30, 0x9e, 0xcc, 0x48, 0x9c, 0x12, 0xd6, 0xeb, 0x4c, 0xc4, 0x0f, 0x50, 0xc9, 0x02,
+ 0xf2, 0xb4, 0xd0, 0xed, 0x77, 0xee, 0x51, 0x1a, 0x7c, 0x7a, 0x9b, 0xcd, 0x3c, 0xa8,
+ 0x6d, 0x4c, 0xd8, 0x6f, 0x98, 0x9d, 0xd3, 0x5b, 0xc5, 0xff, 0x49, 0x96, 0x70, 0xda,
+ 0x34, 0x25, 0x5b, 0x45, 0xb0, 0xcf, 0xd8, 0x30, 0xe8, 0x1f, 0x60, 0x5d, 0xcf, 0x7d,
+ 0xc5, 0x54, 0x2e, 0x93, 0xae, 0x9c, 0xd7, 0x6f
+ ]
+ );
+}