summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2005-09-05 21:43:43 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2005-09-05 21:43:43 +0000
commit4e37f436f4425ce1c428f93bedd81bfdc4dc23f7 (patch)
tree7c9380467a43a9fd9b4095024796ccabfdce1280
parent25699d1dcc22ac8aaa36d285e02959962e1b502c (diff)
downloadcryptopp-4e37f436f4425ce1c428f93bedd81bfdc4dc23f7.tar.gz
port to GCC 4
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@211 57ff6487-cd31-0410-9ec3-f628ee90f5f0
-rw-r--r--algebra.h4
-rw-r--r--base32.h2
-rw-r--r--base64.h2
-rw-r--r--basecode.h2
-rw-r--r--config.h20
-rw-r--r--dh.h2
-rw-r--r--dll.cpp25
-rw-r--r--eccrypto.cpp2
-rw-r--r--eccrypto.h52
-rw-r--r--eprecomp.h4
-rw-r--r--gf2n.h16
-rw-r--r--hex.h2
-rw-r--r--integer.cpp2
-rw-r--r--integer.h7
-rw-r--r--iterhash.h24
-rw-r--r--osrng.cpp4
-rw-r--r--osrng.h4
-rw-r--r--sha.h20
-rw-r--r--skipjack.h2
-rw-r--r--strciphr.h22
-rw-r--r--test.cpp2
21 files changed, 117 insertions, 103 deletions
diff --git a/algebra.h b/algebra.h
index 498d520..13038bd 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 64b572f..cb1e1af 100644
--- a/base32.h
+++ b/base32.h
@@ -30,7 +30,7 @@ public:
void IsolatedInitialize(const NameValuePairs &parameters);
private:
- static const int *GetDefaultDecodingLookupArray();
+ static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
};
NAMESPACE_END
diff --git a/base64.h b/base64.h
index b9ba801..5a9e184 100644
--- a/base64.h
+++ b/base64.h
@@ -28,7 +28,7 @@ public:
void IsolatedInitialize(const NameValuePairs &parameters) {}
private:
- static const int *GetDecodingLookupArray();
+ static const int * CRYPTOPP_API GetDecodingLookupArray();
};
NAMESPACE_END
diff --git a/basecode.h b/basecode.h
index 8f0b213..cc44c43 100644
--- a/basecode.h
+++ b/basecode.h
@@ -49,7 +49,7 @@ public:
void IsolatedInitialize(const NameValuePairs &parameters);
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 5102607..d66d01d 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 fd95a4a..933d94e 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 22003c3..0c7497d 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 <windows.h>
#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<ECP>;
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC<EC2N>;
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl<Integer>;
-CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word64, HashTransformation>;
-CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase<word32, HashTransformation>;
-CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word32, MessageAuthenticationCode>;
-CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
-CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
-CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
-CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<>;
-CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, OFB_ModePolicy> >;
-CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, CTR_ModePolicy> >;
-CRYPTOPP_DLL_TEMPLATE_CLASS AbstractEuclideanDomain<Integer>;
-#endif
-
template<> const byte PKCS_DigestDecoration<SHA1>::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14};
template<> const unsigned int PKCS_DigestDecoration<SHA1>::length = sizeof(PKCS_DigestDecoration<SHA1>::decoration);
diff --git a/eccrypto.cpp b/eccrypto.cpp
index 5c0e19a..74cb95e 100644
--- a/eccrypto.cpp
+++ b/eccrypto.cpp
@@ -13,7 +13,7 @@
NAMESPACE_BEGIN(CryptoPP)
-#ifndef NDEBUG
+#if 0
static void ECDSA_TestInstantiations()
{
ECDSA<EC2N>::Signer t1;
diff --git a/eccrypto.h b/eccrypto.h
index d281fab..340bf14 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<ECP>;
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC<EC2N>;
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl<DL_GroupParameters_EC<ECP> >;
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl<DL_GroupParameters_EC<EC2N> >;
-
//! EC public key
template <class EC>
class DL_PublicKey_EC : public DL_PublicKeyImpl<DL_GroupParameters_EC<EC> >
@@ -159,11 +154,6 @@ public:
void DEREncodeKey(BufferedTransformation &bt) const;
};
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC<ECP>;
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC<EC2N>;
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl<DL_GroupParameters_EC<ECP> >;
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl<DL_GroupParameters_EC<EC2N> >;
-
//! EC private key
template <class EC>
class DL_PrivateKey_EC : public DL_PrivateKeyImpl<DL_GroupParameters_EC<EC> >
@@ -185,9 +175,6 @@ public:
void DEREncodeKey(BufferedTransformation &bt) const;
};
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC<ECP>;
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC<EC2N>;
-
//! Elliptic Curve Diffie-Hellman, AKA <a href="http://www.weidai.com/scan-mirror/ka.html#ECDH">ECDH</a>
template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<EC>::DefaultCofactorOption>
struct ECDH
@@ -221,15 +208,12 @@ struct DL_Keys_ECDSA
typedef DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_EC<EC>, ECDSA<EC> > PrivateKey;
};
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA<ECP::Point>;
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA<EC2N::Point>;
-
//! ECDSA algorithm
template <class EC>
class DL_Algorithm_ECDSA : public DL_Algorithm_GDSA<typename EC::Point>
{
public:
- static const char * StaticAlgorithmName() {return "ECDSA";}
+ static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECDSA";}
};
//! ECNR algorithm
@@ -237,7 +221,7 @@ template <class EC>
class DL_Algorithm_ECNR : public DL_Algorithm_NR<typename EC::Point>
{
public:
- static const char * StaticAlgorithmName() {return "ECNR";}
+ static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECNR";}
};
//! <a href="http://www.weidai.com/scan-mirror/sig.html#ECDSA">ECDSA</a>
@@ -246,9 +230,6 @@ struct ECDSA : public DL_SS<DL_Keys_ECDSA<EC>, DL_Algorithm_ECDSA<EC>, DL_Signat
{
};
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_EC<ECP>, ECDSA<ECP> >;
-CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_EC<EC2N>, ECDSA<EC2N> >;
-
//! ECNR
template <class EC, class H = SHA>
struct ECNR : public DL_SS<DL_Keys_EC<EC>, DL_Algorithm_ECNR<EC>, DL_SignatureMessageEncodingMethod_NR, H>
@@ -268,9 +249,32 @@ struct ECIES
DL_EncryptionAlgorithm_Xor<HMAC<SHA1>, DHAES_MODE>,
ECIES<EC> >
{
- 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<ECP>;
+CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC<EC2N>;
+CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl<DL_GroupParameters_EC<ECP> >;
+CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl<DL_GroupParameters_EC<EC2N> >;
+CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC<ECP>;
+CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC<EC2N>;
+CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl<DL_GroupParameters_EC<ECP> >;
+CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl<DL_GroupParameters_EC<EC2N> >;
+CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC<ECP>;
+CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC<EC2N>;
+CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA<ECP::Point>;
+CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA<EC2N::Point>;
+CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_EC<ECP>, ECDSA<ECP> >;
+CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_EC<EC2N>, ECDSA<EC2N> >;
+
+NAMESPACE_END
+
#endif
diff --git a/eprecomp.h b/eprecomp.h
index ae38c9c..b4fd605 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 6567928..a2b53e3 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 74302f2..33e3330 100644
--- a/hex.h
+++ b/hex.h
@@ -28,7 +28,7 @@ public:
void IsolatedInitialize(const NameValuePairs &parameters);
private:
- static const int *GetDefaultDecodingLookupArray();
+ static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
};
NAMESPACE_END
diff --git a/integer.cpp b/integer.cpp
index f570eda..7f22fec 100644
--- a/integer.cpp
+++ b/integer.cpp
@@ -108,6 +108,8 @@ void AlignedAllocator<T>::deallocate(void *p, size_type n)
else
delete [] (T *)p;
}
+
+template class CRYPTOPP_DLL AlignedAllocator<word>;
#endif
static int Compare(const word *A, const word *B, size_t N)
diff --git a/integer.h b/integer.h
index 7faf7b6..0c123c6 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<word>;
+ #ifdef CRYPTOPP_IMPORTS
+ CRYPTOPP_DLL_TEMPLATE_CLASS AlignedAllocator<word>;
+ #endif
+
typedef SecBlock<word, AlignedAllocator<word> > SecAlignedWordBlock;
#else
typedef SecWordBlock SecAlignedWordBlock;
diff --git a/iterhash.h b/iterhash.h
index 2138b6d..2f417ce 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<word64, HashTransformation>;
-CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word64, MessageAuthenticationCode>;
-#endif
-
-CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase<word32, HashTransformation>;
-CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word32, MessageAuthenticationCode>;
-
//! _
template <class T_HashWordType, class T_Endianness, unsigned int T_BlockSize, class T_Base = HashTransformation>
class CRYPTOPP_NO_VTABLE IteratedHash : public IteratedHashBase<T_HashWordType, T_Base>
@@ -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<word64, HashTransformation>;
+CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word64, MessageAuthenticationCode>;
+#endif
+
+CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase<word32, HashTransformation>;
+CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word32, MessageAuthenticationCode>;
+
+NAMESPACE_END
+
#endif
diff --git a/osrng.cpp b/osrng.cpp
index c3c4e80..3d307b4 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 5f8ec44..c860cb2 100644
--- a/osrng.h
+++ b/osrng.h
@@ -112,8 +112,6 @@ private:
unsigned int m_counter;
};
-CRYPTOPP_DLL_TEMPLATE_CLASS AutoSeededX917RNG<DES_EDE3>;
-
template <class BLOCK_CIPHER>
void AutoSeededX917RNG<BLOCK_CIPHER>::Reseed(const byte *key, size_t keylength, const byte *seed, const byte *timeVector)
{
@@ -161,6 +159,8 @@ byte AutoSeededX917RNG<BLOCK_CIPHER>::GenerateByte()
return b;
}
+CRYPTOPP_DLL_TEMPLATE_CLASS AutoSeededX917RNG<DES_EDE3>;
+
NAMESPACE_END
#endif
diff --git a/sha.h b/sha.h
index 5c55c78..69b02ff 100644
--- a/sha.h
+++ b/sha.h
@@ -9,8 +9,8 @@ NAMESPACE_BEGIN(CryptoPP)
class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 20, SHA1>
{
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<word32, BigEndian, 64, 32, SHA256>
{
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<word32, BigEndian, 64, 32, SHA224, 28>
{
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<word64, BigEndian, 128, 64, SHA512>
{
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<word64, BigEndian, 128, 64, SHA384, 48>
{
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 e463dd9..5bf66e1 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";}
};
/// <a href="http://www.weidai.com/scan-mirror/cs.html#SKIPJACK">SKIPJACK</a>
diff --git a/strciphr.h b/strciphr.h
index c1470e3..76d7b3d 100644
--- a/strciphr.h
+++ b/strciphr.h
@@ -146,10 +146,6 @@ protected:
size_t m_leftOver;
};
-CRYPTOPP_DLL_TEMPLATE_CLASS TwoBases<SymmetricCipher, RandomNumberGenerator>;
-CRYPTOPP_DLL_TEMPLATE_CLASS AbstractPolicyHolder<AdditiveCipherAbstractPolicy, TwoBases<SymmetricCipher, RandomNumberGenerator> >;
-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<AbstractPolicyHolder<CFB_CipherAbstractPolicy, SymmetricCipher> >;
-CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<>;
-CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<>;
-
//! _
template <class BASE, class INFO = BASE>
class SymmetricCipherFinal : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO>
@@ -316,4 +307,17 @@ void CFB_CipherTemplate<BASE>::UncheckedSetKey(const NameValuePairs &params, con
NAMESPACE_END
+#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES
+#include "strciphr.cpp"
+#endif
+
+NAMESPACE_BEGIN(CryptoPP)
+CRYPTOPP_DLL_TEMPLATE_CLASS TwoBases<SymmetricCipher, RandomNumberGenerator>;
+CRYPTOPP_DLL_TEMPLATE_CLASS AbstractPolicyHolder<AdditiveCipherAbstractPolicy, TwoBases<SymmetricCipher, RandomNumberGenerator> >;
+CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<>;
+CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, SymmetricCipher> >;
+CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<>;
+CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<>;
+NAMESPACE_END
+
#endif
diff --git a/test.cpp b/test.cpp
index e733c33..24fcb8c 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