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

Function mlock_key_bytes

nodedb-wal/src/secure_mem.rs:57–62  ·  view source on GitHub ↗

Public convenience wrapper for mlocking raw key bytes from `crypto.rs`. Locks `len` bytes starting at `ptr`. Best-effort: logs a warning on failure. No-op on non-Unix targets.

(ptr: *mut u8, len: usize)

Source from the content-addressed store, hash-verified

55/// Locks `len` bytes starting at `ptr`. Best-effort: logs a warning on failure.
56/// No-op on non-Unix targets.
57pub fn mlock_key_bytes(ptr: *mut u8, len: usize) {
58 #[cfg(all(unix, not(target_arch = "wasm32")))]
59 mlock_best_effort(ptr as *mut libc::c_void, len);
60 #[cfg(not(all(unix, not(target_arch = "wasm32"))))]
61 let _ = (ptr, len);
62}
63
64/// Attempt to mlock `len` bytes starting at `ptr`.
65///

Callers 1

from_bytesMethod · 0.85

Calls 1

mlock_best_effortFunction · 0.85

Tested by

no test coverage detected