fix compile on ICC 11

pull/2/head
weidai 2009-03-04 09:27:52 +00:00
parent a47f06515b
commit e4295fda97
7 changed files with 26 additions and 40 deletions

View File

@ -35,6 +35,12 @@ CXXFLAGS += -march=native -mtune=native
endif
endif
ifneq ($(INTEL_COMPILER),0)
# "internal error: backend signals" occurs on some x86 inline assembly with ICC 9 and some x64 inline assembly with ICC 11
# if you want to use Crypto++'s assembly code with ICC, try enabling it on individual files
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
endif
ifeq ($(GAS210_OR_LATER),0) # .intel_syntax wasn't supported until GNU assembler 2.10
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
else

View File

@ -14,7 +14,8 @@ public:
void Update(const byte *input, size_t length);
void TruncatedFinal(byte *hash, size_t size);
unsigned int DigestSize() const {return DIGESTSIZE;}
std::string AlgorithmName() const {return "Adler32";}
static const char * StaticAlgorithmName() {return "Adler32";}
std::string AlgorithmName() const {return StaticAlgorithmName();}
private:
void Reset() {m_s1 = 1; m_s2 = 0;}

View File

@ -3,10 +3,6 @@
#define _CRT_SECURE_NO_DEPRECATE
#include "bench.h"
#include "crc.h"
#include "adler32.h"
#include "wake.h"
#include "seal.h"
#include "aes.h"
#include "blumshub.h"
#include "rng.h"
@ -177,34 +173,6 @@ void BenchMarkKeying(SimpleKeyingInterface &c, size_t keyLength, const NameValue
OutputResultKeying(iterations, timeTaken);
}
//VC60 workaround: compiler bug triggered without the extra dummy parameters
template <class T>
void BenchMarkKeyed(const char *name, double timeTotal, const NameValuePairs &params = g_nullNameValuePairs, T *x=NULL)
{
T c;
c.SetKey(key, c.DefaultKeyLength(), CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(key, c.IVSize()), false)));
BenchMark(name, c, timeTotal);
BenchMarkKeying(c, c.DefaultKeyLength(), CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(key, c.IVSize()), false)));
}
//VC60 workaround: compiler bug triggered without the extra dummy parameters
template <class T>
void BenchMarkKeyedVariable(const char *name, double timeTotal, unsigned int keyLength, const NameValuePairs &params = g_nullNameValuePairs, T *x=NULL)
{
T c;
c.SetKey(key, keyLength, CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(key, c.IVSize()), false)));
BenchMark(name, c, timeTotal);
BenchMarkKeying(c, keyLength, CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(key, c.IVSize()), false)));
}
//VC60 workaround: compiler bug triggered without the extra dummy parameters
template <class T>
void BenchMarkKeyless(const char *name, double timeTotal, T *x=NULL)
{
T c;
BenchMark(name, c, timeTotal);
}
//VC60 workaround: compiler bug triggered without the extra dummy parameters
// on VC60 also needs to be named differently from BenchMarkByName
template <class T_FactoryOutput, class T_Interface>
@ -282,8 +250,8 @@ void BenchmarkAll(double t, double hertz)
BenchMarkByName<MessageAuthenticationCode>("DMAC(AES)");
cout << "\n<TBODY style=\"background: yellow\">";
BenchMarkKeyless<CRC32>("CRC-32", t);
BenchMarkKeyless<Adler32>("Adler-32", t);
BenchMarkByNameKeyLess<HashTransformation>("CRC32");
BenchMarkByNameKeyLess<HashTransformation>("Adler32");
BenchMarkByNameKeyLess<HashTransformation>("MD5");
BenchMarkByNameKeyLess<HashTransformation>("SHA-1");
BenchMarkByNameKeyLess<HashTransformation>("SHA-256");
@ -303,10 +271,8 @@ void BenchmarkAll(double t, double hertz)
BenchMarkByName<SymmetricCipher>("Salsa20", 0, "Salsa20/8", MakeParameters(Name::Rounds(), 8));
BenchMarkByName<SymmetricCipher>("Sosemanuk");
BenchMarkByName<SymmetricCipher>("MARC4");
BenchMarkKeyed<SEAL<BigEndian>::Encryption>("SEAL-3.0-BE", t);
BenchMarkKeyed<SEAL<LittleEndian>::Encryption>("SEAL-3.0-LE", t);
BenchMarkKeyed<WAKE_OFB<BigEndian>::Encryption>("WAKE-OFB-BE", t);
BenchMarkKeyed<WAKE_OFB<LittleEndian>::Encryption>("WAKE-OFB-LE", t);
BenchMarkByName<SymmetricCipher>("SEAL-3.0-LE");
BenchMarkByName<SymmetricCipher>("WAKE-OFB-LE");
cout << "\n<TBODY style=\"background: yellow\">";
BenchMarkByName<SymmetricCipher>("AES/CTR", 16);

3
crc.h
View File

@ -24,7 +24,8 @@ public:
void Update(const byte *input, size_t length);
void TruncatedFinal(byte *hash, size_t size);
unsigned int DigestSize() const {return DIGESTSIZE;}
std::string AlgorithmName() const {return "CRC32";}
static const char * StaticAlgorithmName() {return "CRC32";}
std::string AlgorithmName() const {return StaticAlgorithmName();}
void UpdateByte(byte b) {m_crc = m_tab[CRC32_INDEX(m_crc) ^ b] ^ CRC32_SHIFTED(m_crc);}
byte GetCrcByte(size_t i) const {return ((byte *)&(m_crc))[i];}

3
dll.h
View File

@ -10,6 +10,8 @@
#include "aes.h"
#include "cbcmac.h"
#include "ccm.h"
#include "cmac.h"
#include "channels.h"
#include "des.h"
#include "dh.h"
@ -19,6 +21,7 @@
#include "ecp.h"
#include "files.h"
#include "fips140.h"
#include "gcm.h"
#include "hex.h"
#include "hmac.h"
#include "modes.h"

View File

@ -42,6 +42,10 @@
#include "dmac.h"
#include "blowfish.h"
#include "seed.h"
#include "wake.h"
#include "seal.h"
#include "crc.h"
#include "adler32.h"
USING_NAMESPACE(CryptoPP)
@ -52,6 +56,8 @@ void RegisterFactories()
return;
RegisterDefaultFactoryFor<SimpleKeyAgreementDomain, DH>();
RegisterDefaultFactoryFor<HashTransformation, CRC32>();
RegisterDefaultFactoryFor<HashTransformation, Adler32>();
RegisterDefaultFactoryFor<HashTransformation, Weak::MD5>();
RegisterDefaultFactoryFor<HashTransformation, SHA1>();
RegisterDefaultFactoryFor<HashTransformation, SHA224>();
@ -102,6 +108,8 @@ void RegisterFactories()
RegisterSymmetricCipherDefaultFactories<Salsa20>();
RegisterSymmetricCipherDefaultFactories<Sosemanuk>();
RegisterSymmetricCipherDefaultFactories<Weak::MARC4>();
RegisterSymmetricCipherDefaultFactories<WAKE_OFB<LittleEndian> >();
RegisterSymmetricCipherDefaultFactories<SEAL<LittleEndian> >();
RegisterAuthenticatedSymmetricCipherDefaultFactories<CCM<AES> >();
RegisterAuthenticatedSymmetricCipherDefaultFactories<GCM<AES> >();
RegisterSymmetricCipherDefaultFactories<CTR_Mode<Camellia> >();

View File

@ -39,6 +39,7 @@ class CRYPTOPP_NO_VTABLE AbstractPolicyHolder : public BASE
{
public:
typedef POLICY_INTERFACE PolicyInterface;
virtual ~AbstractPolicyHolder() {}
protected:
virtual const POLICY_INTERFACE & GetPolicy() const =0;