Skip to main content

Zeroize

Trait Zeroize 

Source
pub trait Zeroize {
    // Required method
    fn zeroize(&mut self);
}
Expand description

Trait for securely erasing values from memory.

Required Methods§

Source

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.

Implementations on Foreign Types§

Source§

impl Zeroize for str

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for Box<str>

Available on crate feature alloc only.
Source§

fn zeroize(&mut self)

Source§

impl Zeroize for String

Available on crate feature alloc only.
Source§

fn zeroize(&mut self)

Source§

impl Zeroize for __m128

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for __m128d

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for __m128i

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for __m256

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for __m256d

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for __m256i

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for NonZero<i8>

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for NonZero<i16>

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for NonZero<i32>

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for NonZero<i64>

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for NonZero<i128>

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for NonZero<isize>

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for NonZero<u8>

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for NonZero<u16>

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for NonZero<u32>

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for NonZero<u64>

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for NonZero<u128>

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for NonZero<usize>

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for CompressedEdwardsY

Available on crate feature zeroize only.
Source§

fn zeroize(&mut self)

Reset this CompressedEdwardsY to the compressed form of the identity element.

Source§

impl Zeroize for EdwardsPoint

Available on crate feature zeroize only.
Source§

fn zeroize(&mut self)

Reset this CompressedEdwardsPoint to the identity element.

Source§

impl Zeroize for MontgomeryPoint

Available on crate feature zeroize only.
Source§

fn zeroize(&mut self)

Source§

impl Zeroize for CompressedRistretto

Available on crate feature zeroize only.
Source§

fn zeroize(&mut self)

Source§

impl Zeroize for RistrettoPoint

Available on crate feature zeroize only.
Source§

fn zeroize(&mut self)

Source§

impl Zeroize for Scalar

Available on crate feature zeroize only.
Source§

fn zeroize(&mut self)

Source§

impl Zeroize for SecretKey

Source§

fn zeroize(&mut self)

Securely clears the shared secret from memory.

§Security

This implementation follows the same security methodology as the zeroize crate to ensure that sensitive cryptographic material is reliably cleared from memory:

  • Volatile writes: Uses ptr::write_volatile to prevent dead store elimination and other compiler optimizations that might remove the zeroing operation.
  • Memory ordering: Includes a sequentially consistent compiler fence (SeqCst) to prevent instruction reordering that could expose the secret data after this function returns.
Source§

impl Zeroize for SecretKey

Source§

fn zeroize(&mut self)

Source§

impl Zeroize for SharedSecret

Source§

fn zeroize(&mut self)

Securely clears the shared secret from memory.

§Security

This implementation follows the same security methodology as the zeroize crate to ensure that sensitive cryptographic material is reliably cleared from memory:

  • Volatile writes: Uses ptr::write_volatile to prevent dead store elimination and other compiler optimizations that might remove the zeroing operation.
  • Memory ordering: Includes a sequentially consistent compiler fence (SeqCst) to prevent instruction reordering that could expose the secret data after this function returns.
Source§

impl Zeroize for SharedSecret

Source§

fn zeroize(&mut self)

Securely clears the shared secret from memory.

§Security

This implementation follows the same security methodology as the zeroize crate to ensure that sensitive cryptographic material is reliably cleared from memory:

  • Volatile writes: Uses ptr::write_volatile to prevent dead store elimination and other compiler optimizations that might remove the zeroing operation.
  • Memory ordering: Includes a sequentially consistent compiler fence (SeqCst) to prevent instruction reordering that could expose the secret data after this function returns.
Source§

impl<A> Zeroize for (A,)
where A: Zeroize,

Source§

fn zeroize(&mut self)

Source§

impl<A, B> Zeroize for (A, B)
where A: Zeroize, B: Zeroize,

Source§

fn zeroize(&mut self)

Source§

impl<A, B, C> Zeroize for (A, B, C)
where A: Zeroize, B: Zeroize, C: Zeroize,

Source§

fn zeroize(&mut self)

Source§

impl<A, B, C, D> Zeroize for (A, B, C, D)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize,

Source§

fn zeroize(&mut self)

Source§

impl<A, B, C, D, E> Zeroize for (A, B, C, D, E)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize, E: Zeroize,

Source§

fn zeroize(&mut self)

Source§

impl<A, B, C, D, E, F> Zeroize for (A, B, C, D, E, F)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize, E: Zeroize, F: Zeroize,

Source§

fn zeroize(&mut self)

Source§

impl<A, B, C, D, E, F, G> Zeroize for (A, B, C, D, E, F, G)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize, E: Zeroize, F: Zeroize, G: Zeroize,

Source§

fn zeroize(&mut self)

Source§

impl<A, B, C, D, E, F, G, H> Zeroize for (A, B, C, D, E, F, G, H)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize, E: Zeroize, F: Zeroize, G: Zeroize, H: Zeroize,

Source§

fn zeroize(&mut self)

Source§

impl<A, B, C, D, E, F, G, H, I> Zeroize for (A, B, C, D, E, F, G, H, I)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize, E: Zeroize, F: Zeroize, G: Zeroize, H: Zeroize, I: Zeroize,

Source§

fn zeroize(&mut self)

Source§

impl<A, B, C, D, E, F, G, H, I, J> Zeroize for (A, B, C, D, E, F, G, H, I, J)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize, E: Zeroize, F: Zeroize, G: Zeroize, H: Zeroize, I: Zeroize, J: Zeroize,

Source§

fn zeroize(&mut self)

Source§

impl<C> Zeroize for EphemeralSecret<C>
where C: CurveArithmetic,

Source§

fn zeroize(&mut self)

Source§

impl<C> Zeroize for NonZeroScalar<C>
where C: CurveArithmetic,

Source§

fn zeroize(&mut self)

Source§

impl<Size> Zeroize for EncodedPoint<Size>
where Size: ModulusSize,

Available on crate feature zeroize only.
Source§

fn zeroize(&mut self)

Source§

impl<T, N> Zeroize for GenericArray<T, N>
where T: Zeroize, N: ArrayLength<T>,

Source§

fn zeroize(&mut self)

Source§

impl<Z> Zeroize for Option<Z>
where Z: Zeroize,

Source§

fn zeroize(&mut self)

Source§

impl<Z> Zeroize for [Z]
where Z: DefaultIsZeroes,

Impl Zeroize on slices of types that can be zeroized with Default.

This impl can eventually be optimized using an memset intrinsic, such as core::intrinsics::volatile_set_memory. For that reason the blanket impl on slices is bounded by DefaultIsZeroes.

To zeroize a mut slice of Z: Zeroize which does not impl DefaultIsZeroes, call iter_mut().zeroize().

Source§

fn zeroize(&mut self)

Source§

impl<Z> Zeroize for Box<[Z]>
where Z: Zeroize,

Available on crate feature alloc only.
Source§

fn zeroize(&mut self)

Unlike Vec, Box<[Z]> cannot reallocate, so we can be sure that we are not leaving values on the heap.

Source§

impl<Z> Zeroize for Vec<Z>
where Z: Zeroize,

Available on crate feature alloc only.
Source§

fn zeroize(&mut self)

“Best effort” zeroization for Vec.

Ensures the entire capacity of the Vec is zeroed. Cannot ensure that previous reallocations did not leave values on the heap.

Source§

impl<Z> Zeroize for PhantomData<Z>

PhantomData is always zero sized so provide a Zeroize implementation.

Source§

fn zeroize(&mut self)

Source§

impl<Z> Zeroize for Wrapping<Z>
where Z: Zeroize,

Source§

fn zeroize(&mut self)

Source§

impl<Z> Zeroize for IterMut<'_, Z>
where Z: Zeroize,

Source§

fn zeroize(&mut self)

Source§

impl<Z> Zeroize for MaybeUninit<Z>

Impl Zeroize on MaybeUninit types.

This fills the memory with zeroes. Note that this ignore invariants that Z might have, because MaybeUninit removes all invariants.

Source§

fn zeroize(&mut self)

Source§

impl<Z> Zeroize for [MaybeUninit<Z>]

Impl Zeroize on slices of MaybeUninit types.

This impl can eventually be optimized using an memset intrinsic, such as core::intrinsics::volatile_set_memory.

This fills the slice with zeroes.

Note that this ignore invariants that Z might have, because MaybeUninit removes all invariants.

Source§

fn zeroize(&mut self)

Source§

impl<Z, const N: usize> Zeroize for [Z; N]
where Z: Zeroize,

Impl Zeroize on arrays of types that impl Zeroize.

Source§

fn zeroize(&mut self)

Source§

impl<const LIMBS: usize> Zeroize for DynResidue<LIMBS>

Available on crate feature zeroize only.

NOTE: this does not zeroize the parameters, in order to maintain some form of type consistency

Source§

fn zeroize(&mut self)

Implementors§

Source§

impl Zeroize for miden_protocol::crypto::dsa::falcon512_poseidon2::SecretKey

Source§

impl<F> Zeroize for Polynomial<F>
where F: Zeroize,

Source§

impl<Z> Zeroize for Zeroizing<Z>
where Z: Zeroize,

Source§

impl<Z> Zeroize for Z
where Z: DefaultIsZeroes,