00001
00002
00003 #include "pch.h"
00004
00005 #ifndef CRYPTOPP_IMPORTS
00006
00007 #include "misc.h"
00008 #include "words.h"
00009 #include <new>
00010
00011 NAMESPACE_BEGIN(CryptoPP)
00012
00013 void xorbuf(byte *buf, const byte *mask, size_t count)
00014 {
00015 if (((size_t)buf | (size_t)mask | count) % WORD_SIZE == 0)
00016 XorWords((word *)buf, (const word *)mask, count/WORD_SIZE);
00017 else
00018 {
00019 for (unsigned int i=0; i<count; i++)
00020 buf[i] ^= mask[i];
00021 }
00022 }
00023
00024 void xorbuf(byte *output, const byte *input, const byte *mask, size_t count)
00025 {
00026 if (((size_t)output | (size_t)input | (size_t)mask | count) % WORD_SIZE == 0)
00027 XorWords((word *)output, (const word *)input, (const word *)mask, count/WORD_SIZE);
00028 else
00029 {
00030 for (unsigned int i=0; i<count; i++)
00031 output[i] = input[i] ^ mask[i];
00032 }
00033 }
00034
00035 #if !(defined(_MSC_VER) && (_MSC_VER < 1300))
00036 using std::new_handler;
00037 using std::set_new_handler;
00038 #endif
00039
00040 void CallNewHandler()
00041 {
00042 new_handler newHandler = set_new_handler(NULL);
00043 if (newHandler)
00044 set_new_handler(newHandler);
00045
00046 if (newHandler)
00047 newHandler();
00048 else
00049 throw std::bad_alloc();
00050 }
00051
00052 NAMESPACE_END
00053
00054 #endif