From 09bb1aab6411aa9f373a037a46f8986d48b56075 Mon Sep 17 00:00:00 2001 From: weidai Date: Mon, 5 Sep 2005 21:43:43 +0000 Subject: [PATCH] port to GCC 4 --- algebra.h | 4 ++++ base32.h | 2 +- base64.h | 2 +- basecode.h | 2 +- config.h | 20 ++++++++++++++------ dh.h | 2 +- dll.cpp | 25 +------------------------ eccrypto.cpp | 2 +- eccrypto.h | 52 ++++++++++++++++++++++++++++------------------------ eprecomp.h | 4 ++++ gf2n.h | 16 ++++++++-------- hex.h | 2 +- integer.cpp | 2 ++ integer.h | 7 +++++-- iterhash.h | 24 ++++++++++++++++-------- osrng.cpp | 4 ++-- osrng.h | 4 ++-- sha.h | 20 ++++++++++---------- skipjack.h | 2 +- strciphr.h | 22 +++++++++++++--------- test.cpp | 2 +- 21 files changed, 117 insertions(+), 103 deletions(-) diff --git a/algebra.h b/algebra.h index 498d5206..13038bd8 100644 --- a/algebra.h +++ b/algebra.h @@ -278,4 +278,8 @@ protected: NAMESPACE_END +#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES +#include "algebra.cpp" +#endif + #endif diff --git a/base32.h b/base32.h index 64b572fa..cb1e1af8 100644 --- a/base32.h +++ b/base32.h @@ -30,7 +30,7 @@ public: void IsolatedInitialize(const NameValuePairs ¶meters); private: - static const int *GetDefaultDecodingLookupArray(); + static const int * CRYPTOPP_API GetDefaultDecodingLookupArray(); }; NAMESPACE_END diff --git a/base64.h b/base64.h index b9ba801e..5a9e184b 100644 --- a/base64.h +++ b/base64.h @@ -28,7 +28,7 @@ public: void IsolatedInitialize(const NameValuePairs ¶meters) {} private: - static const int *GetDecodingLookupArray(); + static const int * CRYPTOPP_API GetDecodingLookupArray(); }; NAMESPACE_END diff --git a/basecode.h b/basecode.h index 8f0b2137..cc44c434 100644 --- a/basecode.h +++ b/basecode.h @@ -49,7 +49,7 @@ public: void IsolatedInitialize(const NameValuePairs ¶meters); size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); - static void InitializeDecodingLookupArray(int *lookup, const byte *alphabet, unsigned int base, bool caseInsensitive); + static void CRYPTOPP_API InitializeDecodingLookupArray(int *lookup, const byte *alphabet, unsigned int base, bool caseInsensitive); private: const int *m_lookup; diff --git a/config.h b/config.h index 51026074..d66d01d3 100644 --- a/config.h +++ b/config.h @@ -284,20 +284,28 @@ NAMESPACE_END #endif // CRYPTOPP_WIN32_AVAILABLE +#if defined(__MWERKS__) +#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL +#else +#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL +#endif + #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS) #define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL -#elif defined(__MWERKS__) -#define CRYPTOPP_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL #else -#define CRYPTOPP_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL +#define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS +#endif + +#if defined(__MWERKS__) +#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class +#else +#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class #endif #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS) #define CRYPTOPP_STATIC_TEMPLATE_CLASS template class -#elif defined(__MWERKS__) -#define CRYPTOPP_STATIC_TEMPLATE_CLASS extern class #else -#define CRYPTOPP_STATIC_TEMPLATE_CLASS extern template class +#define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS #endif #endif diff --git a/dh.h b/dh.h index fd95a4ad..933d94e6 100644 --- a/dh.h +++ b/dh.h @@ -76,7 +76,7 @@ public: } } - static std::string StaticAlgorithmName() + static std::string CRYPTOPP_API StaticAlgorithmName() {return GroupParameters::StaticAlgorithmNamePrefix() + DH_Algorithm::StaticAlgorithmName();} std::string AlgorithmName() const {return StaticAlgorithmName();} diff --git a/dll.cpp b/dll.cpp index 22003c32..0c7497d4 100644 --- a/dll.cpp +++ b/dll.cpp @@ -6,37 +6,14 @@ #include "dll.h" #pragma warning(default: 4660) -#ifdef CRYPTOPP_WIN32_AVAILABLE +#if defined(CRYPTOPP_EXPORTS) && defined(CRYPTOPP_WIN32_AVAILABLE) #include #endif -#include "iterhash.cpp" -#include "strciphr.cpp" -#include "algebra.cpp" -#include "eprecomp.cpp" -#include "eccrypto.cpp" - #ifndef CRYPTOPP_IMPORTS NAMESPACE_BEGIN(CryptoPP) -#ifdef __MWERKS__ -// CodeWarrior 8 workaround: explicit instantiations have to appear after member function definitions -CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl; -CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase; -CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase; -CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase; -CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate >; -CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate >; -CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate >; -CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<>; -CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate >; -CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate >; -CRYPTOPP_DLL_TEMPLATE_CLASS AbstractEuclideanDomain; -#endif - template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14}; template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); diff --git a/eccrypto.cpp b/eccrypto.cpp index 5c0e19af..74cb95e1 100644 --- a/eccrypto.cpp +++ b/eccrypto.cpp @@ -13,7 +13,7 @@ NAMESPACE_BEGIN(CryptoPP) -#ifndef NDEBUG +#if 0 static void ECDSA_TestInstantiations() { ECDSA::Signer t1; diff --git a/eccrypto.h b/eccrypto.h index d281fab7..340bf14b 100644 --- a/eccrypto.h +++ b/eccrypto.h @@ -93,7 +93,7 @@ public: Integer GetMaxExponent() const {return GetSubgroupOrder()-1;} bool IsIdentity(const Element &element) const {return element.identity;} void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const; - static std::string StaticAlgorithmNamePrefix() {return "EC";} + static std::string CRYPTOPP_API StaticAlgorithmNamePrefix() {return "EC";} // ASN1Key OID GetAlgorithmID() const; @@ -105,7 +105,7 @@ public: // non-inherited // enumerate OIDs for recommended parameters, use OID() to get first one - static OID GetNextRecommendedParametersOID(const OID &oid); + static OID CRYPTOPP_API GetNextRecommendedParametersOID(const OID &oid); void BERDecode(BufferedTransformation &bt); void DEREncode(BufferedTransformation &bt) const; @@ -137,11 +137,6 @@ protected: mutable Integer m_k; // cofactor }; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl >; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl >; - //! EC public key template class DL_PublicKey_EC : public DL_PublicKeyImpl > @@ -159,11 +154,6 @@ public: void DEREncodeKey(BufferedTransformation &bt) const; }; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl >; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl >; - //! EC private key template class DL_PrivateKey_EC : public DL_PrivateKeyImpl > @@ -185,9 +175,6 @@ public: void DEREncodeKey(BufferedTransformation &bt) const; }; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC; - //! Elliptic Curve Diffie-Hellman, AKA ECDH template ::DefaultCofactorOption> struct ECDH @@ -221,15 +208,12 @@ struct DL_Keys_ECDSA typedef DL_PrivateKey_WithSignaturePairwiseConsistencyTest, ECDSA > PrivateKey; }; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA; - //! ECDSA algorithm template class DL_Algorithm_ECDSA : public DL_Algorithm_GDSA { public: - static const char * StaticAlgorithmName() {return "ECDSA";} + static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECDSA";} }; //! ECNR algorithm @@ -237,7 +221,7 @@ template class DL_Algorithm_ECNR : public DL_Algorithm_NR { public: - static const char * StaticAlgorithmName() {return "ECNR";} + static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECNR";} }; //! ECDSA @@ -246,9 +230,6 @@ struct ECDSA : public DL_SS, DL_Algorithm_ECDSA, DL_Signat { }; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest, ECDSA >; -CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest, ECDSA >; - //! ECNR template struct ECNR : public DL_SS, DL_Algorithm_ECNR, DL_SignatureMessageEncodingMethod_NR, H> @@ -268,9 +249,32 @@ struct ECIES DL_EncryptionAlgorithm_Xor, DHAES_MODE>, ECIES > { - static std::string StaticAlgorithmName() {return "ECIES";} // TODO: fix this after name is standardized + static std::string CRYPTOPP_API StaticAlgorithmName() {return "ECIES";} // TODO: fix this after name is standardized }; NAMESPACE_END +#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES +#include "eccrypto.cpp" +#endif + +NAMESPACE_BEGIN(CryptoPP) + +CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl >; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl >; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl >; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl >; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest, ECDSA >; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest, ECDSA >; + +NAMESPACE_END + #endif diff --git a/eprecomp.h b/eprecomp.h index ae38c9c7..b4fd6059 100644 --- a/eprecomp.h +++ b/eprecomp.h @@ -66,4 +66,8 @@ private: NAMESPACE_END +#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES +#include "eprecomp.cpp" +#endif + #endif diff --git a/gf2n.h b/gf2n.h index 6567928f..a2b53e31 100644 --- a/gf2n.h +++ b/gf2n.h @@ -56,18 +56,18 @@ public: {Randomize(rng, bitcount);} //! return x^i - static PolynomialMod2 Monomial(size_t i); + static PolynomialMod2 CRYPTOPP_API Monomial(size_t i); //! return x^t0 + x^t1 + x^t2 - static PolynomialMod2 Trinomial(size_t t0, size_t t1, size_t t2); + static PolynomialMod2 CRYPTOPP_API Trinomial(size_t t0, size_t t1, size_t t2); //! return x^t0 + x^t1 + x^t2 + x^t3 + x^t4 - static PolynomialMod2 Pentanomial(size_t t0, size_t t1, size_t t2, size_t t3, size_t t4); + static PolynomialMod2 CRYPTOPP_API Pentanomial(size_t t0, size_t t1, size_t t2, size_t t3, size_t t4); //! return x^(n-1) + ... + x + 1 - static PolynomialMod2 AllOnes(size_t n); + static PolynomialMod2 CRYPTOPP_API AllOnes(size_t n); //! - static const PolynomialMod2 &Zero(); + static const PolynomialMod2 & CRYPTOPP_API Zero(); //! - static const PolynomialMod2 &One(); + static const PolynomialMod2 & CRYPTOPP_API One(); //@} //! \name ENCODE/DECODE @@ -216,12 +216,12 @@ public: PolynomialMod2 MultiplicativeInverse() const {return IsUnit() ? One() : Zero();} //! greatest common divisor - static PolynomialMod2 Gcd(const PolynomialMod2 &a, const PolynomialMod2 &n); + static PolynomialMod2 CRYPTOPP_API Gcd(const PolynomialMod2 &a, const PolynomialMod2 &n); //! calculate multiplicative inverse of *this mod n PolynomialMod2 InverseMod(const PolynomialMod2 &) const; //! calculate r and q such that (a == d*q + r) && (deg(r) < deg(d)) - static void Divide(PolynomialMod2 &r, PolynomialMod2 &q, const PolynomialMod2 &a, const PolynomialMod2 &d); + static void CRYPTOPP_API Divide(PolynomialMod2 &r, PolynomialMod2 &q, const PolynomialMod2 &a, const PolynomialMod2 &d); //@} //! \name INPUT/OUTPUT diff --git a/hex.h b/hex.h index 74302f28..33e33301 100644 --- a/hex.h +++ b/hex.h @@ -28,7 +28,7 @@ public: void IsolatedInitialize(const NameValuePairs ¶meters); private: - static const int *GetDefaultDecodingLookupArray(); + static const int * CRYPTOPP_API GetDefaultDecodingLookupArray(); }; NAMESPACE_END diff --git a/integer.cpp b/integer.cpp index f570eda8..7f22fecd 100644 --- a/integer.cpp +++ b/integer.cpp @@ -108,6 +108,8 @@ void AlignedAllocator::deallocate(void *p, size_type n) else delete [] (T *)p; } + +template class CRYPTOPP_DLL AlignedAllocator; #endif static int Compare(const word *A, const word *B, size_t N) diff --git a/integer.h b/integer.h index 7faf7b60..0c123c63 100644 --- a/integer.h +++ b/integer.h @@ -26,7 +26,7 @@ #endif // SSE2 intrinsics work in GCC 3.3 or later -#if defined(__SSE2__) && (__GNUC_MAJOR__ > 3 || __GNUC_MINOR__ > 2) +#if defined(__SSE2__) && (__GNUC__ > 3 || __GNUC_MINOR__ > 2) #define SSE2_INTRINSICS_AVAILABLE #endif @@ -56,7 +56,10 @@ NAMESPACE_BEGIN(CryptoPP) #endif }; - template class CRYPTOPP_DLL AlignedAllocator; + #ifdef CRYPTOPP_IMPORTS + CRYPTOPP_DLL_TEMPLATE_CLASS AlignedAllocator; + #endif + typedef SecBlock > SecAlignedWordBlock; #else typedef SecWordBlock SecAlignedWordBlock; diff --git a/iterhash.h b/iterhash.h index 2138b6d8..2f417ce9 100644 --- a/iterhash.h +++ b/iterhash.h @@ -54,14 +54,6 @@ private: T m_countLo, m_countHi; }; -#ifdef WORD64_AVAILABLE -CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase; -CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase; -#endif - -CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase; -CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase; - //! _ template class CRYPTOPP_NO_VTABLE IteratedHash : public IteratedHashBase @@ -105,4 +97,20 @@ protected: NAMESPACE_END +#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES +#include "iterhash.cpp" +#endif + +NAMESPACE_BEGIN(CryptoPP) + +#ifdef WORD64_AVAILABLE +CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase; +CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase; +#endif + +CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase; +CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase; + +NAMESPACE_END + #endif diff --git a/osrng.cpp b/osrng.cpp index c3c4e805..3d307b49 100644 --- a/osrng.cpp +++ b/osrng.cpp @@ -126,8 +126,8 @@ void BlockingRng::GenerateBlock(byte *output, size_t size) { // on some systems /dev/random will block until all bytes // are available, on others it will returns immediately - int len = read(m_fd, output, STDMIN(size, (unsigned int)INT_MAX)); - if (len == -1) + ssize_t len = read(m_fd, output, size); + if (len < 0) throw OS_RNG_Err("read /dev/random"); size -= len; output += len; diff --git a/osrng.h b/osrng.h index 5f8ec44f..c860cb24 100644 --- a/osrng.h +++ b/osrng.h @@ -112,8 +112,6 @@ private: unsigned int m_counter; }; -CRYPTOPP_DLL_TEMPLATE_CLASS AutoSeededX917RNG; - template void AutoSeededX917RNG::Reseed(const byte *key, size_t keylength, const byte *seed, const byte *timeVector) { @@ -161,6 +159,8 @@ byte AutoSeededX917RNG::GenerateByte() return b; } +CRYPTOPP_DLL_TEMPLATE_CLASS AutoSeededX917RNG; + NAMESPACE_END #endif diff --git a/sha.h b/sha.h index 5c55c785..69b02ff7 100644 --- a/sha.h +++ b/sha.h @@ -9,8 +9,8 @@ NAMESPACE_BEGIN(CryptoPP) class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform { public: - static void InitState(HashWordType *state); - static void Transform(word32 *digest, const word32 *data); + static void CRYPTOPP_API InitState(HashWordType *state); + static void CRYPTOPP_API Transform(word32 *digest, const word32 *data); static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-1";} }; @@ -20,8 +20,8 @@ typedef SHA1 SHA; // for backwards compatibility class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform { public: - static void InitState(HashWordType *state); - static void Transform(word32 *digest, const word32 *data); + static void CRYPTOPP_API InitState(HashWordType *state); + static void CRYPTOPP_API Transform(word32 *digest, const word32 *data); static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";} protected: @@ -32,8 +32,8 @@ protected: class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform { public: - static void InitState(HashWordType *state); - static void Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);} + static void CRYPTOPP_API InitState(HashWordType *state); + static void CRYPTOPP_API Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);} static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";} }; @@ -43,8 +43,8 @@ public: class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform { public: - static void InitState(HashWordType *state); - static void Transform(word64 *digest, const word64 *data); + static void CRYPTOPP_API InitState(HashWordType *state); + static void CRYPTOPP_API Transform(word64 *digest, const word64 *data); static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";} protected: @@ -55,8 +55,8 @@ protected: class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform { public: - static void InitState(HashWordType *state); - static void Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);} + static void CRYPTOPP_API InitState(HashWordType *state); + static void CRYPTOPP_API Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);} static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-384";} }; diff --git a/skipjack.h b/skipjack.h index e463dd9b..5bf66e18 100644 --- a/skipjack.h +++ b/skipjack.h @@ -12,7 +12,7 @@ NAMESPACE_BEGIN(CryptoPP) //! _ struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10> { - CRYPTOPP_DLL static const char * StaticAlgorithmName() {return "SKIPJACK";} + CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "SKIPJACK";} }; /// SKIPJACK diff --git a/strciphr.h b/strciphr.h index c1470e3f..76d7b3d6 100644 --- a/strciphr.h +++ b/strciphr.h @@ -146,10 +146,6 @@ protected: size_t m_leftOver; }; -CRYPTOPP_DLL_TEMPLATE_CLASS TwoBases; -CRYPTOPP_DLL_TEMPLATE_CLASS AbstractPolicyHolder >; -CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<>; - class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CFB_CipherAbstractPolicy { public: @@ -263,11 +259,6 @@ public: unsigned int MandatoryBlockSize() const {return this->OptimalBlockSize();} }; -// for Darwin -CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate >; -CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<>; -CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<>; - //! _ template class SymmetricCipherFinal : public AlgorithmImpl, INFO> @@ -316,4 +307,17 @@ void CFB_CipherTemplate::UncheckedSetKey(const NameValuePairs ¶ms, con NAMESPACE_END +#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES +#include "strciphr.cpp" +#endif + +NAMESPACE_BEGIN(CryptoPP) +CRYPTOPP_DLL_TEMPLATE_CLASS TwoBases; +CRYPTOPP_DLL_TEMPLATE_CLASS AbstractPolicyHolder >; +CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<>; +CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate >; +CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<>; +CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<>; +NAMESPACE_END + #endif diff --git a/test.cpp b/test.cpp index e733c33c..24fcb8cf 100644 --- a/test.cpp +++ b/test.cpp @@ -85,7 +85,7 @@ int (*AdhocTest)(int argc, char *argv[]) = NULL; #ifdef __BCPLUSPLUS__ int cmain(int argc, char *argv[]) #else -int main(int argc, char *argv[]) +int __cdecl main(int argc, char *argv[]) #endif { #ifdef _CRTDBG_LEAK_CHECK_DF