Merge d2e4615337 into d9de314e86
commit
aefc2a0cf8
8
config.h
8
config.h
|
|
@ -216,12 +216,6 @@ typedef unsigned int word32;
|
|||
typedef word64 lword;
|
||||
const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
|
||||
|
||||
// Clang pretends to be VC++, too.
|
||||
// See http://github.com/weidai11/cryptopp/issues/147
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
# error: "Unsupported configuration"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
|
@ -335,7 +329,7 @@ NAMESPACE_END
|
|||
#define CRYPTOPP_FASTCALL
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define CRYPTOPP_NO_VTABLE __declspec(novtable)
|
||||
#else
|
||||
#define CRYPTOPP_NO_VTABLE
|
||||
|
|
|
|||
|
|
@ -745,7 +745,7 @@ void StreamTransformationFilter::LastPut(const byte *inString, size_t length)
|
|||
if (m_padding == PKCS_PADDING)
|
||||
{
|
||||
byte pad = space[s-1];
|
||||
if (pad < 1 || pad > s || std::find_if(space+s-pad, space+s, std::bind2nd(std::not_equal_to<byte>(), pad)) != space+s)
|
||||
if (pad < 1 || pad > s || std::find_if(space+s-pad, space+s, std::bind(std::not_equal_to<byte>(), std::placeholders::_1, pad)) != space+s)
|
||||
throw InvalidCiphertext("StreamTransformationFilter: invalid PKCS #7 block padding found");
|
||||
length = s-pad;
|
||||
}
|
||||
|
|
|
|||
4
ida.cpp
4
ida.cpp
|
|
@ -389,7 +389,7 @@ size_t PaddingRemover::Put2(const byte *begin, size_t length, int messageEnd, bo
|
|||
|
||||
if (m_possiblePadding)
|
||||
{
|
||||
size_t len = std::find_if(begin, end, std::bind2nd(std::not_equal_to<byte>(), byte(0))) - begin;
|
||||
size_t len = std::find_if(begin, end, std::bind(std::not_equal_to<byte>(), std::placeholders::_1, byte(0))) - begin;
|
||||
m_zeroCount += len;
|
||||
begin += len;
|
||||
if (begin == end)
|
||||
|
|
@ -402,7 +402,7 @@ size_t PaddingRemover::Put2(const byte *begin, size_t length, int messageEnd, bo
|
|||
m_possiblePadding = false;
|
||||
}
|
||||
|
||||
const byte *x = std::find_if(RevIt(end), RevIt(begin), std::bind2nd(std::not_equal_to<byte>(), byte(0))).base();
|
||||
const byte *x = std::find_if(RevIt(end), RevIt(begin), std::bind(std::not_equal_to<byte>(), std::placeholders::_1, byte(0))).base();
|
||||
if (x != begin && *(x-1) == 1)
|
||||
{
|
||||
AttachedTransformation()->Put(begin, x-begin-1);
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ static word AtomicInverseModPower2(word A)
|
|||
#define HighWord(a) a##1
|
||||
#ifdef _MSC_VER
|
||||
#define MultiplyWordsLoHi(p0, p1, a, b) p0 = _umul128(a, b, &p1);
|
||||
#ifndef __INTEL_COMPILER
|
||||
#if !defined(__INTEL_COMPILER) && !defined(__clang__)
|
||||
#define Double3Words(c, d) d##1 = __shiftleft128(d##0, d##1, 1); d##0 = __shiftleft128(c, d##0, 1); c *= 2;
|
||||
#endif
|
||||
#elif defined(__DECCXX)
|
||||
|
|
|
|||
2
oaep.cpp
2
oaep.cpp
|
|
@ -82,7 +82,7 @@ DecodingResult OAEP_Base::Unpad(const byte *oaepBlock, size_t oaepBlockLen, byte
|
|||
// DB = pHash' || 00 ... || 01 || M
|
||||
byte *M = std::find(maskedDB+hLen, maskedDB+dbLen, 0x01);
|
||||
invalid = (M == maskedDB+dbLen) || invalid;
|
||||
invalid = (std::find_if(maskedDB+hLen, M, std::bind2nd(std::not_equal_to<byte>(), byte(0))) != M) || invalid;
|
||||
invalid = (std::find_if(maskedDB+hLen, M, std::bind(std::not_equal_to<byte>(), std::placeholders::_1, byte(0))) != M) || invalid;
|
||||
invalid = !pHash->VerifyDigest(maskedDB, encodingParameters.begin(), encodingParameters.size()) || invalid;
|
||||
|
||||
if (invalid)
|
||||
|
|
|
|||
2
pssr.cpp
2
pssr.cpp
|
|
@ -125,7 +125,7 @@ DecodingResult PSSR_MEM_Base::RecoverMessageFromRepresentative(
|
|||
|
||||
// extract salt and recoverableMessage from DB = 00 ... || 01 || M || salt
|
||||
byte *salt = representative + representativeByteLength - u - digestSize - saltSize;
|
||||
byte *M = std::find_if(representative, salt-1, std::bind2nd(std::not_equal_to<byte>(), byte(0)));
|
||||
byte *M = std::find_if(representative, salt-1, std::bind(std::not_equal_to<byte>(), std::placeholders::_1, byte(0)));
|
||||
recoverableMessageLength = salt-M-1;
|
||||
if (*M == 0x01 &&
|
||||
(size_t)(M - representative - (representativeBitLength % 8 != 0)) >= MinPadLen(digestSize) &&
|
||||
|
|
|
|||
32
rdrand.cpp
32
rdrand.cpp
|
|
@ -152,6 +152,14 @@ inline void RDRAND32(void* output)
|
|||
: "=a" (*reinterpret_cast<word32*>(output))
|
||||
: : "cc"
|
||||
);
|
||||
#elif defined(CRYPTOPP_MSC_VERSION) && defined(CRYPTOPP_LLVM_CLANG_VERSION)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
".byte 0x0f, 0xc7, 0xf0;\n"
|
||||
".byte 0x73, 0xfb;\n"
|
||||
: "=a" (*reinterpret_cast<word32*>(output))
|
||||
: : "cc"
|
||||
);
|
||||
#elif defined(ALL_RDRAND_INTRIN_AVAILABLE)
|
||||
while(!_rdrand32_step(reinterpret_cast<word32*>(output))) {}
|
||||
#else
|
||||
|
|
@ -194,6 +202,14 @@ inline void RDRAND64(void* output)
|
|||
: "=a" (*reinterpret_cast<word64*>(output))
|
||||
: : "cc"
|
||||
);
|
||||
#elif defined(CRYPTOPP_MSC_VERSION) && defined(CRYPTOPP_LLVM_CLANG_VERSION)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
".byte 0x48, 0x0f, 0xc7, 0xf0;\n"
|
||||
".byte 0x73, 0xfa;\n"
|
||||
: "=a" (*reinterpret_cast<word64*>(output))
|
||||
: : "cc"
|
||||
);
|
||||
#elif defined(ALL_RDRAND_INTRIN_AVAILABLE)
|
||||
while(!_rdrand64_step(reinterpret_cast<unsigned long long*>(output))) {}
|
||||
#else
|
||||
|
|
@ -309,6 +325,14 @@ inline void RDSEED32(void* output)
|
|||
: "=a" (*reinterpret_cast<word32*>(output))
|
||||
: : "cc"
|
||||
);
|
||||
#elif defined(CRYPTOPP_MSC_VERSION) && defined(CRYPTOPP_LLVM_CLANG_VERSION)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
".byte 0x0f, 0xc7, 0xf8;\n"
|
||||
".byte 0x73, 0xfb;\n"
|
||||
: "=a" (*reinterpret_cast<word32*>(output))
|
||||
: : "cc"
|
||||
);
|
||||
#elif defined(ALL_RDSEED_INTRIN_AVAILABLE)
|
||||
while(!_rdseed32_step(reinterpret_cast<word32*>(output))) {}
|
||||
#else
|
||||
|
|
@ -351,6 +375,14 @@ inline void RDSEED64(void* output)
|
|||
: "=a" (*reinterpret_cast<word64*>(output))
|
||||
: : "cc"
|
||||
);
|
||||
#elif defined(CRYPTOPP_MSC_VERSION) && defined(CRYPTOPP_LLVM_CLANG_VERSION)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
".byte 0x48, 0x0f, 0xc7, 0xf8;\n"
|
||||
".byte 0x73, 0xfa;\n"
|
||||
: "=a" (*reinterpret_cast<word64*>(output))
|
||||
: : "cc"
|
||||
);
|
||||
#elif defined(ALL_RDSEED_INTRIN_AVAILABLE)
|
||||
while(!_rdseed64_step(reinterpret_cast<unsigned long long*>(output))) {}
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -676,11 +676,11 @@ void Deflator::EncodeBlock(bool eof, unsigned int blockType)
|
|||
m_literalCounts[256] = 1;
|
||||
HuffmanEncoder::GenerateCodeLengths(literalCodeLengths, 15, m_literalCounts, 286);
|
||||
m_dynamicLiteralEncoder.Initialize(literalCodeLengths, 286);
|
||||
unsigned int hlit = (unsigned int)(std::find_if(RevIt(literalCodeLengths.end()), RevIt(literalCodeLengths.begin()+257), std::bind2nd(std::not_equal_to<unsigned int>(), 0)).base() - (literalCodeLengths.begin()+257));
|
||||
unsigned int hlit = (unsigned int)(std::find_if(RevIt(literalCodeLengths.end()), RevIt(literalCodeLengths.begin()+257), std::bind(std::not_equal_to<unsigned int>(), std::placeholders::_1, 0)).base() - (literalCodeLengths.begin()+257));
|
||||
|
||||
HuffmanEncoder::GenerateCodeLengths(distanceCodeLengths, 15, m_distanceCounts, 30);
|
||||
m_dynamicDistanceEncoder.Initialize(distanceCodeLengths, 30);
|
||||
unsigned int hdist = (unsigned int)(std::find_if(RevIt(distanceCodeLengths.end()), RevIt(distanceCodeLengths.begin()+1), std::bind2nd(std::not_equal_to<unsigned int>(), 0)).base() - (distanceCodeLengths.begin()+1));
|
||||
unsigned int hdist = (unsigned int)(std::find_if(RevIt(distanceCodeLengths.end()), RevIt(distanceCodeLengths.begin()+1), std::bind(std::not_equal_to<unsigned int>(), std::placeholders::_1, 0)).base() - (distanceCodeLengths.begin()+1));
|
||||
|
||||
SecBlockWithHint<unsigned int, 286+30> combinedLengths(hlit+257+hdist+1);
|
||||
memcpy(combinedLengths, literalCodeLengths, (hlit+257)*sizeof(unsigned int));
|
||||
|
|
|
|||
Loading…
Reference in New Issue