diff --git a/Cargo.lock b/Cargo.lock index 0eb263f..38b9c80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -460,7 +460,7 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "zeroize" -version = "1.0.3" +version = "1.0.5" dependencies = [ "memsec", "numpy", diff --git a/Cargo.toml b/Cargo.toml index 8dfabd0..6bf1429 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,9 +20,12 @@ crate-type = ["cdylib"] [dependencies] pyo3 = "0.21.2" -zeroize_rs = { version = "1.8.1", package = "zeroize"} +zeroize_rs = { version = "1.8.1", package = "zeroize" } numpy = "0.21" memsec = "0.7.0" [profile.release] panic = "abort" + +[lints.clippy] +too_many_arguments = "allow" diff --git a/examples/lock_and_zeroize.py b/examples/lock_and_zeroize.py index d3fadd4..15b66e5 100644 --- a/examples/lock_and_zeroize.py +++ b/examples/lock_and_zeroize.py @@ -20,6 +20,8 @@ print("locking memory") + + mlock mlock(arr) mlock(arr_np) diff --git a/src/lib.rs b/src/lib.rs index 32094fd..cc6458e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,7 +23,7 @@ use zeroize_rs::Zeroize; /// A Python module implemented in Rust. #[pymodule] -fn zeroize(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { +pub fn zeroize(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_function(wrap_pyfunction!(zeroize1, m)?)?; m.add_function(wrap_pyfunction!(mlock, m)?)?; m.add_function(wrap_pyfunction!(munlock, m)?)?; @@ -31,13 +31,13 @@ fn zeroize(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { } #[pyfunction] -fn zeroize1(arr: &Bound<'_, PyAny>, py: Python<'_>) -> PyResult<()> { +pub fn zeroize1(arr: &Bound<'_, PyAny>, py: Python<'_>) -> PyResult<()> { as_array_mut(arr, py)?.zeroize(); Ok(()) } #[pyfunction] -fn mlock(arr: &Bound<'_, PyAny>, py: Python<'_>) -> PyResult<()> { +pub fn mlock(arr: &Bound<'_, PyAny>, py: Python<'_>) -> PyResult<()> { let arr = as_array_mut(arr, py)?; unsafe { if !_mlock(arr.as_mut_ptr(), arr.len()) { @@ -50,7 +50,7 @@ fn mlock(arr: &Bound<'_, PyAny>, py: Python<'_>) -> PyResult<()> { } #[pyfunction] -fn munlock(arr: &Bound<'_, PyAny>, py: Python<'_>) -> PyResult<()> { +pub fn munlock(arr: &Bound<'_, PyAny>, py: Python<'_>) -> PyResult<()> { let arr = as_array_mut(arr, py)?; unsafe { if !_munlock(arr.as_mut_ptr(), arr.len()) {