6 #if CRYPTOPP_MSC_VERSION 7 # pragma warning(disable: 4189) 8 # if (CRYPTOPP_MSC_VERSION >= 1400) 9 # pragma warning(disable: 6237) 13 #ifndef CRYPTOPP_IMPORTS 22 #if defined(CRYPTOPP_MEMALIGN_AVAILABLE) || defined(CRYPTOPP_MM_MALLOC_AVAILABLE) || defined(QNX) 35 if (IsAligned<word32>(buf) && IsAligned<word32>(mask))
39 for (i=0; i<count/8; i++)
48 for (i=0; i<count/4; i++)
57 for (i=0; i<
count; i++)
68 if (IsAligned<word32>(output) && IsAligned<word32>(input) && IsAligned<word32>(mask))
72 for (i=0; i<count/8; i++)
82 for (i=0; i<count/4; i++)
92 for (i=0; i<
count; i++)
93 output[i] = input[i] ^ mask[i];
105 if (IsAligned<word32>(buf) && IsAligned<word32>(mask))
111 for (i=0; i<count/8; i++)
112 acc64 |= ((
word64*)(
void*)buf)[i] ^ ((
word64*)(
void*)mask)[i];
121 for (i=0; i<count/4; i++)
122 acc32 |= ((
word32*)(
void*)buf)[i] ^ ((
word32*)(
void*)mask)[i];
131 for (i=0; i<
count; i++)
132 acc8 |= buf[i] ^ mask[i];
142 #if (CRYPTOPP_MSC_VERSION >= 1400) 143 size_t len=0,
size=0;
150 err = wcstombs_s(&
size, NULL, 0, str, len*
sizeof(
wchar_t));
157 return std::string();
161 err = wcstombs_s(&
size, &result[0],
size, str, len*
sizeof(
wchar_t));
168 return std::string();
172 if (!result.empty() && result[
size - 1] ==
'\0')
173 result.erase(
size - 1);
175 size_t size = wcstombs(NULL, str, 0);
177 if (size == (
size_t)-1)
182 return std::string();
186 size = wcstombs(&result[0], str, size);
188 if (size == (
size_t)-1)
193 return std::string();
202 using std::new_handler;
203 using std::set_new_handler;
205 new_handler newHandler = set_new_handler(NULL);
207 set_new_handler(newHandler);
212 throw std::bad_alloc();
215 #if CRYPTOPP_BOOL_ALIGN16 217 void * AlignedAllocate(
size_t size)
220 #if defined(CRYPTOPP_APPLE_ALLOC_AVAILABLE) 221 while ((p = (
byte *)calloc(1, size)) == NULL)
222 #elif defined(CRYPTOPP_MM_MALLOC_AVAILABLE) 223 while ((p = (
byte *)_mm_malloc(size, 16)) == NULL)
224 #elif defined(CRYPTOPP_MEMALIGN_AVAILABLE) 225 while ((p = (
byte *)memalign(16, size)) == NULL)
226 #elif defined(CRYPTOPP_MALLOC_ALIGNMENT_IS_16) 227 while ((p = (
byte *)malloc(size)) == NULL)
229 while ((p = (
byte *)malloc(size + 16)) == NULL)
233 #ifdef CRYPTOPP_NO_ALIGNED_ALLOC 234 size_t adjustment = 16-((size_t)p%16);
236 p[-1] = (
byte)adjustment;
243 void AlignedDeallocate(
void *p)
245 #ifdef CRYPTOPP_MM_MALLOC_AVAILABLE 247 #elif defined(CRYPTOPP_NO_ALIGNED_ALLOC) 260 while ((p = malloc(size)) == NULL)
An invalid argument was detected.
Utility functions for the Crypto++ library.
#define NAMESPACE_BEGIN(x)
std::string StringNarrow(const wchar_t *str, bool throwOnError)
Converts a wide character C-string to a multibyte string.
Library configuration file.
void * UnalignedAllocate(size_t size)
Allocates a buffer.
void UnalignedDeallocate(void *p)
Frees a buffer allocated with UnalignedAllocate.
bool IsAlignedOn(const void *ptr, unsigned int alignment)
Determines whether ptr is aligned to a minimum value.
unsigned long long word64
#define CRYPTOPP_ASSERT(exp)
void xorbuf(byte *buf, const byte *mask, size_t count)
Performs an XOR of a buffer with a mask.
void CallNewHandler()
Attempts to reclaim unused memory.
uint8_t const size_t const size
#define CRYPTOPP_BOOL_SLOW_WORD64
std::string IntToString(T value, unsigned int base=10)
Converts a value to a string.
Multiple precision integer with arithmetic operations.
bool VerifyBufsEqual(const byte *buf, const byte *mask, size_t count)
Performs a near constant-time comparison of two equally sized buffers.