tests: Use libopen_dice_clear_memory

Stop re-implementing DiceClearMemory() wherever needed and use the
standalone implementation provided by upstream open-dice in our tests.

Note that the following tests:

- libservice_vm_requests.test
- libdiced_open_dice_nostd.integration_test

ues libdiced_open_dice_nostd but don't seem to require a definition of
DiceClearMemory(), which _could_ mean that one of their dependencies is
providing it e.g. libopen_dice_cbor or libopen_dice_cbor_p384.

Bug: 357008987
Test: m libpvmfw.dice.test
Test: m libdiced_sample_inputs_nostd.integration_test
Change-Id: I4b4ef61705ced42747fe5ddf3ebad13d91122554
diff --git a/guest/pvmfw/Android.bp b/guest/pvmfw/Android.bp
index 4e4dcd6..cd09579 100644
--- a/guest/pvmfw/Android.bp
+++ b/guest/pvmfw/Android.bp
@@ -121,6 +121,7 @@
         "libzerocopy_nostd",
         "libhex",
     ],
+    static_libs: ["libopen_dice_clear_memory"],
 }
 
 genrule {
diff --git a/guest/pvmfw/src/dice.rs b/guest/pvmfw/src/dice.rs
index 3c22e40..470711f 100644
--- a/guest/pvmfw/src/dice.rs
+++ b/guest/pvmfw/src/dice.rs
@@ -192,20 +192,6 @@
     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::{