7#include <botan/allocator.h>
9#include <botan/mem_ops.h>
10#include <botan/internal/int_utils.h>
11#include <botan/internal/target_info.h>
15#if defined(BOTAN_HAS_LOCKING_ALLOCATOR)
16 #include <botan/internal/locking_allocator.h>
22 if(elems == 0 || elem_size == 0) {
28 throw std::bad_alloc();
31#if defined(BOTAN_HAS_LOCKING_ALLOCATOR)
37#if defined(BOTAN_TARGET_OS_HAS_ALLOC_CONCEAL)
38 void* ptr = ::calloc_conceal(elems, elem_size);
40 void* ptr = std::calloc(elems, elem_size);
43 [[unlikely]]
throw std::bad_alloc();
55#if defined(BOTAN_HAS_LOCKING_ALLOCATOR)
65#if defined(BOTAN_HAS_LOCKING_ALLOCATOR)
static mlock_allocator & instance() noexcept
void deallocate_memory(void *p, size_t elems, size_t elem_size)
void secure_scrub_memory(void *ptr, size_t n)
constexpr std::optional< T > checked_mul(T a, T b)
void initialize_allocator()
BOTAN_MALLOC_FN void * allocate_memory(size_t elems, size_t elem_size)