MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / drop

Method drop

nodedb-wal/src/secure_mem.rs:42–50  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

40
41impl 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`.

Callers

nothing calls this directly

Calls 3

munlock_best_effortFunction · 0.85
iter_mutMethod · 0.80
as_mut_ptrMethod · 0.45

Tested by

no test coverage detected