8#ifndef BOTAN_SECURE_MEMORY_BUFFERS_H_
9#define BOTAN_SECURE_MEMORY_BUFFERS_H_
11#include <botan/allocator.h>
12#include <botan/types.h>
17#if !defined(BOTAN_IS_BEING_BUILT) && !defined(BOTAN_DISABLE_DEPRECATED_FEATURES)
25#if !defined(_ITERATOR_DEBUG_LEVEL) || _ITERATOR_DEBUG_LEVEL == 0
33 requires std::is_integral_v<T> || std::is_enum_v<T>
57template <
typename T,
typename U>
62template <
typename T,
typename U>
70#if !defined(BOTAN_IS_BEING_BUILT) && !defined(BOTAN_DISABLE_DEPRECATED_FEATURES)
86 return std::vector<T>(in.begin(), in.end());
91template <
typename T,
typename Alloc,
typename Alloc2>
92std::vector<T, Alloc>&
operator+=(std::vector<T, Alloc>& out,
const std::vector<T, Alloc2>& in) {
93 out.insert(out.end(), in.begin(), in.end());
97template <
typename T,
typename Alloc>
98std::vector<T, Alloc>&
operator+=(std::vector<T, Alloc>& out, std::span<const T> in) {
99 out.insert(out.end(), in.begin(), in.end());
103template <
typename T,
typename Alloc>
104std::vector<T, Alloc>&
operator+=(std::vector<T, Alloc>& out, T in) {
109template <
typename T,
typename Alloc,
typename L>
110std::vector<T, Alloc>&
operator+=(std::vector<T, Alloc>& out,
const std::pair<const T*, L>& in) {
111 out.insert(out.end(), in.first, in.first + in.second);
115template <
typename T,
typename Alloc,
typename L>
116std::vector<T, Alloc>&
operator+=(std::vector<T, Alloc>& out,
const std::pair<T*, L>& in) {
117 out.insert(out.end(), in.first, in.first + in.second);
136template <
typename T,
typename Alloc>
138 for(
size_t i = 0; i != vec.size(); ++i) {
139 vec[i] =
static_cast<T
>(0);
156template <
typename T,
typename Alloc>
157void zap(std::vector<T, Alloc>& vec) {
T * allocate(std::size_t n)
void deallocate(T *p, std::size_t n)
secure_allocator() noexcept=default
void zeroise(std::vector< T, Alloc > &vec)
void zap(std::vector< T, Alloc > &vec)
void deallocate_memory(void *p, size_t elems, size_t elem_size)
secure_vector< T > lock(const std::vector< T > &in)
bool operator!=(const AlgorithmIdentifier &a1, const AlgorithmIdentifier &a2)
std::vector< T > unlock(const secure_vector< T > &in)
bool operator==(const AlgorithmIdentifier &a1, const AlgorithmIdentifier &a2)
std::deque< T, secure_allocator< T > > secure_deque
std::vector< T, Alloc > & operator+=(std::vector< T, Alloc > &out, const std::vector< T, Alloc2 > &in)
BOTAN_MALLOC_FN void * allocate_memory(size_t elems, size_t elem_size)
std::vector< T, secure_allocator< T > > secure_vector
secure_vector< T > SecureVector