[test] Test nostd open-dice library in pvmfw dice test

The nostd and std open-dice libraries are not identical. This cl
switches the open-dice library tested by libpvmfw.dice.test
from the std version to nostd version so that the tests will
go through the same library as pvmfw.

Bug: 357008987
Test: m pvmfw_img
Test: atest libpvmfw.dice.test
Change-Id: Ib49a9f9109537dc0dbb84da2b421da397ac939c0
diff --git a/guest/pvmfw/Android.bp b/guest/pvmfw/Android.bp
index 477d0a8..4e4dcd6 100644
--- a/guest/pvmfw/Android.bp
+++ b/guest/pvmfw/Android.bp
@@ -116,7 +116,7 @@
     rustlibs: [
         "libcbor_util",
         "libciborium",
-        "libdiced_open_dice",
+        "libdiced_open_dice_nostd",
         "libpvmfw_avb_nostd",
         "libzerocopy_nostd",
         "libhex",
diff --git a/guest/pvmfw/src/dice.rs b/guest/pvmfw/src/dice.rs
index 470711f..3c22e40 100644
--- a/guest/pvmfw/src/dice.rs
+++ b/guest/pvmfw/src/dice.rs
@@ -192,6 +192,20 @@
     flushed_zeroize(region)
 }
 
+/// Flushes data caches over the provided address range in open-dice.
+///
+/// This function allows the tests below to go through the same nostd open-dice library as pvmfw.
+#[no_mangle]
+#[cfg(test)]
+unsafe extern "C" fn DiceClearMemory(
+    _ctx: *mut core::ffi::c_void,
+    size: usize,
+    addr: *mut core::ffi::c_void,
+) {
+    // SAFETY: The caller ensures that the address and size are valid for write.
+    unsafe { core::ptr::write_bytes(addr as *mut u8, 0, size) };
+}
+
 #[cfg(test)]
 mod tests {
     use crate::{