8 #ifndef BOTAN_SECURE_MEMORY_BUFFERS_H__     9 #define BOTAN_SECURE_MEMORY_BUFFERS_H__    11 #include <botan/allocate.h>    12 #include <botan/mem_ops.h>    29       size_t size()
 const { 
return used; }
    35       bool empty()
 const { 
return (used == 0); }
    41       operator T* () { 
return buf; }
    47       operator const T* () 
const { 
return buf; }
    59       const T* 
begin()
 const { 
return buf; }
    71       const T* 
end()
 const { 
return (buf + 
size()); }
    87       bool operator<(const MemoryRegion<T>& other) 
const;
    95          { 
return (!(*
this == other)); }
   108             this->
copy(&other[0], other.
size());
   120       void copy(
const T in[], 
size_t n)
   134       void copy(
size_t off, 
const T in[], 
size_t n)
   189       void init(
bool locking, 
size_t length = 0)
   193       T* allocate(
size_t n)
   195          return static_cast<T*
>(alloc->
allocate(
sizeof(T)*n));
   198       void deallocate(T* p, 
size_t n)
   199          { 
if(alloc && p && n) alloc->
deallocate(p, 
sizeof(T)*n); }
   221       T* new_buf = allocate(n);
   223       deallocate(buf, allocated);
   225       allocated = used = n;
   238    for(
size_t i = 0; i != min_size; ++i)
   240       if(buf[i] < other[i])
   242       if(buf[i] > other[i])
   335             this->
copy(&other[0], other.
size());
   356          this->
copy(&in[0], n);
   376    const size_t copy_offset = out.
size();
   390 template<
typename T, 
typename L>
   392                             const std::pair<const T*, L>& in)
   394    const size_t copy_offset = out.
size();
   396    copy_mem(&out[copy_offset], in.first, in.second);
   400 template<
typename T, 
typename L>
   402                             const std::pair<T*, L>& in)
   404    const size_t copy_offset = out.
size();
   406    copy_mem(&out[copy_offset], in.first, in.second);
 
virtual void deallocate(void *ptr, size_t n)=0
bool same_mem(const T *p1, const T *p2, size_t n)
SecureVector(const T in[], size_t n)
virtual void * allocate(size_t n)=0
void clear_mem(T *ptr, size_t n)
MemoryRegion< T > & operator=(const MemoryRegion< T > &other)
bool operator==(const MemoryRegion< T > &other) const
static Allocator * get(bool locking)
bool operator!=(const MemoryRegion< T > &other) const
void copy(const T in[], size_t n)
void init(bool locking, size_t length=0)
SecureVector< T > & operator=(const MemoryRegion< T > &other)
MemoryVector(const MemoryRegion< T > &in)
MemoryVector< T > & operator=(const MemoryRegion< T > &in)
MemoryVector(const T in[], size_t n)
SecureVector(const MemoryRegion< T > &in)
void copy_mem(T *out, const T *in, size_t n)
MemoryRegion< T > & operator+=(MemoryRegion< T > &out, const MemoryRegion< T > &in)
void swap(MemoryRegion< T > &other)
void swap(Botan::MemoryRegion< T > &x, Botan::MemoryRegion< T > &y)
void copy(size_t off, const T in[], size_t n)
MemoryRegion(const MemoryRegion< T > &other)
void zeroise(MemoryRegion< T > &vec)
bool operator<(const MemoryRegion< T > &other) const