(&mut self)
| 40 | |
| 41 | impl Drop for SecureKey { |
| 42 | fn drop(&mut self) { |
| 43 | // Zero the key before releasing. |
| 44 | // Use volatile writes so the compiler cannot optimize them away. |
| 45 | for byte in self.bytes.iter_mut() { |
| 46 | unsafe { std::ptr::write_volatile(byte, 0u8) }; |
| 47 | } |
| 48 | #[cfg(all(unix, not(target_arch = "wasm32")))] |
| 49 | munlock_best_effort(self.bytes.as_mut_ptr() as *mut libc::c_void, 32); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | /// Public convenience wrapper for mlocking raw key bytes from `crypto.rs`. |
nothing calls this directly
no test coverage detected