// misc.cpp - written and placed in the public domain by Wei Dai #include "pch.h" #ifndef CRYPTOPP_IMPORTS #include "misc.h" #include "words.h" #include #if defined(CRYPTOPP_MEMALIGN_AVAILABLE) || defined(CRYPTOPP_MM_MALLOC_AVAILABLE) || defined(QNX) #include #endif NAMESPACE_BEGIN(CryptoPP) // Vectorization at -O3 requires IsStrictAligned for GCC 4.8 and above with xorbuf and VerifyBufsEqual. // Problems have not been experienced for the word32 variant, but it may aoccur in the future. void xorbuf(byte *buf, const byte *mask, size_t count) { size_t i; if (IsAligned(buf) && IsAligned(mask)) { if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsStrictAligned(buf) && IsStrictAligned(mask)) { assert(IsAlignedOn(buf, GetStrictAlignmentOf())); assert(IsAlignedOn(mask, GetStrictAlignmentOf())); for (i=0; i(output) && IsAligned(input) && IsAligned(mask)) { if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsStrictAligned(output) && IsStrictAligned(input) && IsStrictAligned(mask)) { assert(IsAlignedOn(output, GetStrictAlignmentOf())); assert(IsAlignedOn(input, GetStrictAlignmentOf())); assert(IsAlignedOn(mask, GetStrictAlignmentOf())); for (i=0; i(buf) && IsAligned(mask)) { word32 acc32 = 0; if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsStrictAligned(buf) && IsStrictAligned(mask)) { assert(IsAlignedOn(buf, GetStrictAlignmentOf())); assert(IsAlignedOn(mask, GetStrictAlignmentOf())); word64 acc64 = 0; for (i=0; i>32); } for (i=0; i>8) | byte(acc32>>16) | byte(acc32>>24); } for (i=0; i