6#ifndef BITCOIN_SUPPORT_ALLOCATORS_ZEROAFTERFREE_H
7#define BITCOIN_SUPPORT_ALLOCATORS_ZEROAFTERFREE_H
26 return std::allocator<T>{}.allocate(n);
33 std::allocator<T>{}.deallocate(p, n);
49using SerializeData = 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.
friend bool operator!=(const zero_after_free_allocator &, const zero_after_free_allocator< U > &) noexcept
T * allocate(std::size_t n)
void deallocate(T *p, std::size_t n)
friend bool operator==(const zero_after_free_allocator &, const zero_after_free_allocator< U > &) noexcept
zero_after_free_allocator() noexcept=default
std::vector< std::byte, zero_after_free_allocator< std::byte > > SerializeData
Byte-vector that clears its contents before deletion.