We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
write_volatile
1 parent 03ca9d9 commit 0abb475Copy full SHA for 0abb475
src/util/key_obfuscator.rs
@@ -155,8 +155,17 @@ impl KeyObfuscator {
155
impl Drop for KeyObfuscator {
156
fn drop(&mut self) {
157
// Zeroize the owned keys
158
- self.obfuscation_key.copy_from_slice(&[0u8; KEY_LENGTH]);
159
- self.hashing_key.copy_from_slice(&[0u8; KEY_LENGTH]);
+ for elem in self.obfuscation_key.iter_mut() {
+ unsafe {
160
+ ::core::ptr::write_volatile(elem, 0);
161
+ }
162
163
+ for elem in self.hashing_key.iter_mut() {
164
165
166
167
168
+ ::core::sync::atomic::compiler_fence(::core::sync::atomic::Ordering::SeqCst);
169
}
170
171
0 commit comments