Re-enable Salsa20 ASM (GH #543)

We are fairly certain this is a false positive due to glibc's __memcmp_sse4_1.
pull/548/head
Jeffrey Walton 2017-11-29 06:55:19 -05:00
parent f86c6124a8
commit 92436b9f9b
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
3 changed files with 8 additions and 21 deletions

View File

@ -116,12 +116,8 @@ void PutDecodedDatumInto(const TestData &data, const char *name, BufferedTransfo
s1 = s1.substr(s1.find(' ')+1);
}
// Convert endian order. Use it with 64-bit words like this:
// Key: word64 BC2560EFC6BBA2B1 E3361F162238EB40 FB8631EE0ABBD175 7B9479D4C5479ED1
// BC2560EFC6BBA2B1 will be processed into B1A2BBC6EF6025BC.
// or:
// Key: word32 BC2560EF E3361F16 FB8631EE 7B9479D4
// BC2560EF will be processed into EF6025BC.
// Convert word32 or word64 to little endian order. Some algorithm test vectors are
// presented in the format. We probably should have named them word32le and word64le.
if (s1.length() >= 6 && (s1.substr(0,6) == "word32" || s1.substr(0,6) == "word64"))
{
std::istringstream iss(s1.substr(6));
@ -489,16 +485,7 @@ void TestSymmetricCipher(TestData &v, const NameValuePairs &overrideParameters)
static_cast<BlockPaddingSchemeDef::BlockPaddingScheme>(paddingScheme));
RandomizedTransfer(StringStore(plaintext).Ref(), encFilter, true);
encFilter.MessageEnd();
/*{
std::string z;
encryptor->Seek(seek);
StringSource ss(plaintext, false, new StreamTransformationFilter(*encryptor, new StringSink(z),
static_cast<BlockPaddingSchemeDef::BlockPaddingScheme>(paddingScheme)));
while (ss.Pump(64)) {}
ss.PumpAll();
for (int i=0; i<z.length(); i++)
CRYPTOPP_ASSERT(encrypted[i] == z[i]);
}*/
if (test != "EncryptXorDigest")
ciphertext = GetDecodedDatum(v, "Ciphertext");
else

View File

@ -74,7 +74,7 @@ void Salsa20_Policy::SeekToIteration(lword iterationCount)
m_state[5] = (word32)SafeRightShift<32>(iterationCount);
}
#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64) && !defined(CRYPTOPP_DISABLE_SALSA_ASM)
#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
unsigned int Salsa20_Policy::GetAlignment() const
{
#if CRYPTOPP_SSE2_ASM_AVAILABLE

View File

@ -12,7 +12,7 @@
// TODO: work around GCC 4.8+ issue with SSE2 ASM until the exact details are known
// and fix is released. Duplicate with "valgrind ./cryptest.exe tv salsa"
// "Inline assembly operands don't work with .intel_syntax", http://llvm.org/bugs/show_bug.cgi?id=24232
#if CRYPTOPP_BOOL_X32 || defined(CRYPTOPP_DISABLE_INTEL_ASM) || (CRYPTOPP_GCC_VERSION >= 40800)
#if CRYPTOPP_BOOL_X32 || defined(CRYPTOPP_DISABLE_INTEL_ASM)
# define CRYPTOPP_DISABLE_SALSA_ASM
#endif
@ -22,7 +22,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief Salsa20 stream cipher information
struct Salsa20_Info : public VariableKeyLength<32, 16, 32, 16, SimpleKeyingInterface::UNIQUE_IV, 8>
{
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Salsa20";}
static std::string StaticAlgorithmName() {return "Salsa20";}
};
//! \class Salsa20_Policy
@ -35,7 +35,7 @@ protected:
void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length);
bool CipherIsRandomAccess() const {return true;}
void SeekToIteration(lword iterationCount);
#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64) && !defined(CRYPTOPP_DISABLE_SALSA_ASM)
#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
unsigned int GetAlignment() const;
unsigned int GetOptimalBlockSize() const;
#endif
@ -58,7 +58,7 @@ struct Salsa20 : public Salsa20_Info, public SymmetricCipherDocumentation
//! \brief XSalsa20 stream cipher information
struct XSalsa20_Info : public FixedKeyLength<32, SimpleKeyingInterface::UNIQUE_IV, 24>
{
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "XSalsa20";}
static std::string StaticAlgorithmName() {return "XSalsa20";}
};
//! \class XSalsa20_Policy