6#ifndef BITCOIN_SUPPORT_ALLOCATORS_ZEROAFTERFREE_H
7#define BITCOIN_SUPPORT_ALLOCATORS_ZEROAFTERFREE_H
16 using base = std::allocator<T>;
17 using traits = std::allocator_traits<base>;
30 template <
typename Other>
struct rebind {
36 std::allocator<T>::deallocate(
p, n);
42 std::vector<std::byte, zero_after_free_allocator<std::byte>>;
void memory_cleanse(void *ptr, size_t len)
Secure overwrite a buffer (possibly containing secret data) with zero-bytes.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
zero_after_free_allocator< Other > other
typename traits::difference_type difference_type
zero_after_free_allocator(const zero_after_free_allocator< U > &a) noexcept
void deallocate(T *p, std::size_t n)
std::allocator_traits< base > traits
typename traits::const_pointer const_pointer
zero_after_free_allocator() noexcept
typename traits::value_type value_type
~zero_after_free_allocator() noexcept
typename traits::pointer pointer
zero_after_free_allocator(const zero_after_free_allocator &a) noexcept
typename traits::size_type size_type
std::vector< std::byte, zero_after_free_allocator< std::byte > > SerializeData
Byte-vector that clears its contents before deletion.