Merge "pvmfw: Panic on fill_with_entropy error for BSSL" am: 188ab2e6b1 am: 2a87d5a0b0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/2634649
Change-Id: I1294889fa74d0fd5747d0853215fc3f671ebc0d0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/pvmfw/src/rand.rs b/pvmfw/src/rand.rs
index bf0edd5..b45538a 100644
--- a/pvmfw/src/rand.rs
+++ b/pvmfw/src/rand.rs
@@ -42,6 +42,12 @@
}
}
+impl fmt::Debug for Error {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "{self}")
+ }
+}
+
/// Configure the source of entropy.
pub fn init() -> Result<()> {
match hvc::trng_version()? {
@@ -105,5 +111,5 @@
extern "C" fn CRYPTO_sysrand(out: *mut u8, req: usize) {
// SAFETY - We need to assume that out points to valid memory of size req.
let s = unsafe { core::slice::from_raw_parts_mut(out, req) };
- let _ = fill_with_entropy(s);
+ fill_with_entropy(s).unwrap()
}