ed25519_bip32/securemem.rs
1pub fn zero(to_zero: &mut [u8]) {
2 // the unsafety of this call is bounded to the existence of the pointer
3 // and the accuracy of the length of the array.
4 //
5 // since to_zero existence is bound to live at least as long as the call
6 // of this function and that we use the length (in bytes) of the given
7 // slice, this call is safe.
8 unsafe { ::std::ptr::write_bytes(to_zero.as_mut_ptr(), 0, to_zero.len()) }
9}