Crypto++
8.6
Free C++ class library of cryptographic schemes
|
10 #ifndef CRYPTOPP_IMPORTS
18 #if defined(CRYPTOPP_MEMALIGN_AVAILABLE) || defined(CRYPTOPP_MM_MALLOC_AVAILABLE) || defined(QNX)
22 #if defined(CRYPTOPP_POSIX_MEMALIGN_AVAILABLE)
30 using std::new_handler;
31 using std::set_new_handler;
33 new_handler newHandler = set_new_handler(NULLPTR);
35 set_new_handler(newHandler);
40 throw std::bad_alloc();
46 #if defined(CRYPTOPP_MM_MALLOC_AVAILABLE)
47 while ((p = (
byte *)_mm_malloc(size, 16)) == NULLPTR)
48 #elif defined(CRYPTOPP_MEMALIGN_AVAILABLE)
49 while ((p = (
byte *)memalign(16, size)) == NULLPTR)
50 #elif defined(CRYPTOPP_MALLOC_ALIGNMENT_IS_16)
51 while ((p = (
byte *)malloc(size)) == NULLPTR)
52 #elif defined(CRYPTOPP_POSIX_MEMALIGN_AVAILABLE)
53 while (posix_memalign(
reinterpret_cast<void**
>(&p), 16, size) != 0)
55 while ((p = (
byte *)malloc(size + 16)) == NULLPTR)
59 #ifdef CRYPTOPP_NO_ALIGNED_ALLOC
60 size_t adjustment = 16-((size_t)p%16);
63 p[-1] = (
byte)adjustment;
81 #ifdef CRYPTOPP_MM_MALLOC_AVAILABLE
83 #elif defined(CRYPTOPP_NO_ALIGNED_ALLOC)
84 p = (
byte *)p - ((
byte *)p)[-1];
95 while ((p = malloc(size)) == NULLPTR)
107 #endif // CRYPTOPP_IMPORTS
bool IsAlignedOn(const void *ptr, unsigned int alignment)
Determines whether ptr is aligned to a minimum value.
CRYPTOPP_DLL void CallNewHandler()
Attempts to reclaim unused memory.
Debugging and diagnostic assertions.
unsigned char byte
8-bit unsigned datatype
Functions for allocating aligned buffers.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
CRYPTOPP_DLL void * UnalignedAllocate(size_t size)
Allocates a buffer.
CRYPTOPP_DLL void AlignedDeallocate(void *ptr)
Frees a buffer allocated with AlignedAllocate.
CRYPTOPP_DLL void * AlignedAllocate(size_t size)
Allocates a buffer on 16-byte boundary.
Utility functions for the Crypto++ library.
Crypto++ library namespace.
CRYPTOPP_DLL void UnalignedDeallocate(void *ptr)
Frees a buffer allocated with UnalignedAllocate.
Library configuration file.