Skip to content

Commit 6aa9b81

Browse files
committed
f Use write_volatile
1 parent 3490f2a commit 6aa9b81

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/io/vss_store.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,14 @@ impl KVStore for VssStore {
241241

242242
impl Drop for VssStore {
243243
fn drop(&mut self) {
244-
self.data_encryption_key.copy_from_slice(&[0u8; KEY_LENGTH]);
244+
// Zeroize the data_encryption_key
245+
for elem in self.data_encryption_key.iter_mut() {
246+
unsafe {
247+
::core::ptr::write_volatile(elem, 0);
248+
}
249+
250+
};
251+
::core::sync::atomic::compiler_fence(::core::sync::atomic::Ordering::SeqCst);
245252
}
246253
}
247254

0 commit comments

Comments
 (0)