From e4295fda977bcbddb3d14d344ba45c19c43c6b28 Mon Sep 17 00:00:00 2001 From: weidai Date: Wed, 4 Mar 2009 09:27:52 +0000 Subject: fix compile on ICC 11 --- GNUmakefile | 6 ++++++ adler32.h | 3 ++- bench.cpp | 42 ++++-------------------------------------- crc.h | 3 ++- dll.h | 3 +++ regtest.cpp | 8 ++++++++ strciphr.h | 1 + 7 files changed, 26 insertions(+), 40 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index d59c71c5..8f075529 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -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 diff --git a/adler32.h b/adler32.h index 1cc90ce6..0ed803da 100644 --- a/adler32.h +++ b/adler32.h @@ -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;} diff --git a/bench.cpp b/bench.cpp index a48d06d7..ca83b30e 100644 --- a/bench.cpp +++ b/bench.cpp @@ -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 -void BenchMarkKeyed(const char *name, double timeTotal, const NameValuePairs ¶ms = 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 -void BenchMarkKeyedVariable(const char *name, double timeTotal, unsigned int keyLength, const NameValuePairs ¶ms = 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 -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 @@ -282,8 +250,8 @@ void BenchmarkAll(double t, double hertz) BenchMarkByName("DMAC(AES)"); cout << "\n"; - BenchMarkKeyless("CRC-32", t); - BenchMarkKeyless("Adler-32", t); + BenchMarkByNameKeyLess("CRC32"); + BenchMarkByNameKeyLess("Adler32"); BenchMarkByNameKeyLess("MD5"); BenchMarkByNameKeyLess("SHA-1"); BenchMarkByNameKeyLess("SHA-256"); @@ -303,10 +271,8 @@ void BenchmarkAll(double t, double hertz) BenchMarkByName("Salsa20", 0, "Salsa20/8", MakeParameters(Name::Rounds(), 8)); BenchMarkByName("Sosemanuk"); BenchMarkByName("MARC4"); - BenchMarkKeyed::Encryption>("SEAL-3.0-BE", t); - BenchMarkKeyed::Encryption>("SEAL-3.0-LE", t); - BenchMarkKeyed::Encryption>("WAKE-OFB-BE", t); - BenchMarkKeyed::Encryption>("WAKE-OFB-LE", t); + BenchMarkByName("SEAL-3.0-LE"); + BenchMarkByName("WAKE-OFB-LE"); cout << "\n"; BenchMarkByName("AES/CTR", 16); diff --git a/crc.h b/crc.h index 1cacf5b5..f75ea384 100644 --- a/crc.h +++ b/crc.h @@ -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];} diff --git a/dll.h b/dll.h index c046ca0a..5e42d46f 100644 --- a/dll.h +++ b/dll.h @@ -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" diff --git a/regtest.cpp b/regtest.cpp index 8f85bc9f..6a32e6cf 100644 --- a/regtest.cpp +++ b/regtest.cpp @@ -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(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); RegisterDefaultFactoryFor(); RegisterDefaultFactoryFor(); RegisterDefaultFactoryFor(); @@ -102,6 +108,8 @@ void RegisterFactories() RegisterSymmetricCipherDefaultFactories(); RegisterSymmetricCipherDefaultFactories(); RegisterSymmetricCipherDefaultFactories(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); RegisterAuthenticatedSymmetricCipherDefaultFactories >(); RegisterAuthenticatedSymmetricCipherDefaultFactories >(); RegisterSymmetricCipherDefaultFactories >(); diff --git a/strciphr.h b/strciphr.h index 9334b0cd..d4ad79a2 100644 --- a/strciphr.h +++ b/strciphr.h @@ -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; -- cgit v1.2.1